function viewModel(RYXZ) { this.RYXZ = RYXZ //初始化数据 this.init = function () { var that = this; //查询油表图 $.ajax({ url: '/Home/QueryNotFinishCount', method: 'get', success: function (data) { $.each(data, function (i, n) { var val = 0; if (data[i].数量 != undefined) { val = data[i].数量; } that.gauge('container' + i, data[i].类型, 100, val); }); } }); //加载公告 $.post("/Notice/GetHome", function (data) { for (var i in data) { var val = data[i].发布时间; if (val < 1) { data[i].发布时间 = parseInt(val * 60) + "分钟前"; } else if (val < 24) { data[i].发布时间 = val + "小时前"; } else if (48 > val > 24) { data[i].发布时间 = "昨天"; } else { data[i].发布时间 = parseInt(val / 24) + '天' + '前'; } $("#Newnoty").append("

" + data[i].标题 + " " + data[i].发布时间 + "

"); } }) //查询各渠道的数量 $.ajax({ url: '/Home/QueryCompanyProblemCount', method: 'get', success: function (data) { var names = []; var series = []; //添加bug var serieBug = {}; serieBug.name = 'BUG'; serieBug.data = []; //添加任务 var serieTask = {}; serieTask.name = '任务'; serieTask.data = []; //需求 var serieReq = {}; serieReq.name = '需求'; serieReq.data = []; //咨询 var serieAsk = {}; serieAsk.name = '咨询'; serieAsk.data = []; //循环读序列 $.each(data, function (i, n) { names.push(data[i].名称); serieBug.data.push(data[i].BUG); serieTask.data.push(data[i].任务); serieReq.data.push(data[i].需求); serieAsk.data.push(data[i].咨询); }); series.push(serieBug); series.push(serieTask); series.push(serieReq); series.push(serieAsk); that.column('container-column', 'bar', '所有还未处理的问题', names, series); } }); //查询问题停留环节 $.ajax({ url: '/Home/QueryAllProblemStopWorkFlow', method: 'post', success: function (data) { var lineCategories = []; var lineSeries = []; var lineSerie = {}; lineSerie.data = []; $.each(data, function (i, n) { var val = 0; if (data[i].名称 != undefined) { lineCategories.push(data[i].名称); } lineSerie.name = '停留数量'; lineSerie.data.push(data[i].数量); }); //添加到序列中 lineSeries.push(lineSerie); //设置 model.column('problemStop', 'column', '未处理问题延迟所在环节', lineCategories, lineSeries); } }); //与我相关的问题 $('#dgMyProlem').datagrid({ fit: true, border: false, columns: [[ { field: '编号', title: '编号', width: 60, align: 'center' }, { field: '问题性质', title: '性质', width: 60, align: 'center', formatter: function (val, row, index) { switch (val) { case 1: return "Bug"; case 2: return "咨询"; case 3: return "需求"; case 4: return "任务"; default: break; } } }, { field: '当前环节', title: '当前环节', width: 90, halign: 'center' }, { field: '问题标题', title: '【问题标题】', width: 351, halign: 'center' } ]], singleSelect: true, striped: true, url: '/Home/QueryMyProblemList', onDblClickRow: function (rowIndex, rowData) { that.checkproblem(); } }); //常见问题 $('#dgNorProlems').datagrid({ fit: true, border: false, singleSelect: true, striped: true, columns: [[ { field: '编号', title: '编号', width: 60, align: 'center' }, { field: '问题标题', title: '【问题标题】', width: 361, halign: 'center' }, { field: '版本号', title: '版本号', width: 60 }, { field: '登记日期', title: '登记日期', width: 80 } ]], url: '/Home/QueryOftenProblemList' }) }; //加载油表图 //id:元素id,text:标题,maxvalu:最大值,value:当前值 this.gauge = function (id, text, maxval, value) { //油表图基本信息 var gaugeOptions = { chart: { type: 'solidgauge' }, title: { text: text }, pane: { center: ['50%', '85%'], size: '140%', startAngle: -90, endAngle: 90, background: { backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE', innerRadius: '60%', outerRadius: '100%', shape: 'arc' } }, tooltip: { enabled: false }, credits: { enabled: false }, // the value axis yAxis: { min: 0, max: maxval, title: { text: text }, stops: [ [0.1, '#55BF3B'], // green [0.5, '#DDDF0D'], // yellow [0.9, '#DF5353'] // red ], lineWidth: 0, minorTickInterval: null, tickAmount: 2, title: { y: -70 }, labels: { y: 16 } }, plotOptions: { solidgauge: { dataLabels: { y: 5, borderWidth: 0, useHTML: true } } }, series: [{ name: 'gauge', data: [value], dataLabels: { format: '
{y}
' + '待处理
' } }] }; //设置图表 Highcharts.chart(id, gaugeOptions); }; //显示柱状堆积图id:元素id,text:标题,type:bar/column /*categories:渠道列表['中联西安公司', '沈阳技术服务中心'...] series:值,[{name: '需求', data: [5, 3, 4, 7, 2, 5, 3, 4, 7, 2]}, { name: 'Bug', data: [2, 2, 3, 2, 1, 5, 3, 4, 7, 2]}]*/ this.column = function (id, type, text, categories, series) { var columnJson = { chart: { type: type }, title: { text: text }, credits: { enabled: false }, xAxis: { categories: categories }, yAxis: { min: 0, stackLabels: { enabled: true } }, legend: { reversed: true }, tooltip: { headerFormat: '{point.key}', pointFormat: '' + '', footerFormat: '
{series.name}: {point.y:1f} 个
', shared: true, useHTML: true }, plotOptions: { series: { stacking: 'normal' }, column: { colorByPoint: true } }, series: series } //设置到元素上 Highcharts.chart(id, columnJson); }; //线性图 //id:元素id,text:标题,categories:人员['张三', '李四'...],series:,[{name: '项目问题', data: [5, 3, 4, 7, 2, 5, 3, 4, 7, 2]}, { name: '产品问题', data: [2, 2, 3, 2, 1, 5, 3, 4, 7, 2]}]*/ this.line = function (id, text, subtitle, categories, series) { var lineJson = { chart: { type: 'line' }, title: { text: text }, subtitle: { text: subtitle }, credits: { enabled: false }, xAxis: { categories: categories }, plotOptions: { line: { dataLabels: { enabled: true }, enableMouseTracking: false } }, series: series }; //设置到元素上 Highcharts.chart(id, lineJson); }; //区域图 //id:元素id,text:标题,categories:人员['张三', '李四'...],series:,[{name: '项目问题', data: [5, 3, 4, 7, 2, 5, 3, 4, 7, 2]}, { name: '产品问题', data: [2, 2, 3, 2, 1, 5, 3, 4, 7, 2]}]*/ this.area = function (id, text, categories, series) { var json = { chart: { type: 'areaspline' }, title: { text: text }, legend: { layout: 'vertical', align: 'left', verticalAlign: 'top', x: 150, y: 100, floating: true, borderWidth: 1, backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF' }, xAxis: { categories: categories }, yAxis: { title: { text: '' } }, tooltip: { shared: true }, credits: { enabled: false }, plotOptions: { areaspline: { fillOpacity: 0.5 } }, series: series }; //设置到元素上 Highcharts.chart(id, json); } //查看问题弹窗 this.checkproblem = function () { var that=this var WT = $('#dgMyProlem').datagrid("getSelected"); if (WT == null) { top.ZLPMS.Msg("请选择一行数据!"); } else { top.ZLPMS.OpenNewWindow("查看问题", "/Problem/CheckProblemWindow/" + WT["ID"], '880px', '600px', function () { that.DealProblem(0, 0, WT["ID"]); }); } } //处理问题 this.DealProblem = function (showAtt, IsSupport, ProblemId) { var that = this //是否为技术支持处理 IsSupport = IsSupport || 0; //受理问题 var receiveProblem = function (title,HJID) { var index = top.ZLPMS.Loading3(2); //受理问题 $.ajax({ url: '/Support/ReceiveProblem', data: { id: ProblemId }, method: 'post', success: function (data) { top.ZLPMS.UnLoading(index); var url = "/Problem/ProductionPdeal?id=" + ProblemId + "&showAtt=" + showAtt + '&workflowid=' + HJID + '&IsSupport=' + IsSupport; //成功后调用 if (data.code == 200) { top.ZLPMS.OpenNewWindow("处理问题:" + title, url, '1000px', '640px', function () { //回调用刷新(只有确定后才刷新) }); } else {//显示具体原因,并提示是否强制处理 top.ZLPMS.Confirm('该问题已被他人受理,您确定要继续处理吗?', 3, function (idx) { top.ZLPMS.CloseWindow(idx); top.ZLPMS.OpenNewWindow("处理问题", url, '1000px', '640px'); }) } } }); }; $.post('/Problem/GetProblemById/' + ProblemId, function (data) { var row = data[0]; if (row) { /*已关闭的问题,已解决的问题,已受理的问题, 不需要处理*/ if (row.是否终止 == 1) { top.ZLPMS.Msg('已终止的问题不需要再处理!'); return; } if (row.是否解决 == 1) { top.ZLPMS.Msg('已解决的问题不需要再处理!'); return; } if (row.环节ID > 3 && that.RYXZ != '1') { top.ZLPMS.Msg('非本部人员不能处理技术支持与研发处理环节问题,仅能查阅!'); return; } if (row.环节ID == 3 && (that.RYXZ == '3' || that.RYXZ == '4' || that.RYXZ == '5')) {//客户,机构管理员,卫计委人员无法处理项目问题 top.ZLPMS.Msg('客户,机构管理员,卫计委人员无法处理项目问题,仅能查阅!'); return; } //打开处理窗口 receiveProblem(row.编号, row.环节ID); } else {//提醒用户没有选择问题记录 top.ZLPMS.Msg('没有选择需要处理的问题记录,请选择后再处理!'); } }) } }