123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- 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("<p><a href='#' onclick=\"MessageDeatil('" + data[i].ID + "')\" >" + data[i].标题 + "</a><a style='float:right'> " + data[i].发布时间 + "</a></p>");
- }
- })
- //查询各渠道的数量
- $.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 "<i class='fa fa-bug' title='Bug' style='color:red'>Bug</i>";
- case 2:
- return "<i class='fa fa-commenting-o' title='咨询'>咨询</i>";
- case 3:
- return "<i class='fa fa-dropbox' title='需求' style='color:#3279b6'>需求</i>";
- case 4:
- return "<i class='fa fa-history' title='任务'>任务</i>";
- 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: '<div style="text-align:center"><span style="font-size:20px;color:' +
- ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y}</span><br/>' +
- '<span style="font-size:13px;color:Green">待处理</span></div>'
- }
- }]
- };
- //设置图表
- 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: '<span style="font-size:10px">{point.key}</span><table>',
- pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
- '<td style="padding:0"><b>{point.y:1f} 个</b></td></tr>',
- footerFormat: '</table>',
- 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('没有选择需要处理的问题记录,请选择后再处理!');
- }
- })
-
- }
- }
|