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: '{series.name}: | ' + '{point.y:1f} 个 |