'use strict'; /** * controllers used for the dashboard */ var appFormly = angular.module('formlyDashboard', [ 'formly', 'formlyBootstrap', 'ui.bootstrap', 'ngSanitize', 'ui.select', 'ui.grid' ]); app.requires.push('formlyDashboard'); // var appFormly = angular.module('formlyExample', [ // 'formly', 'formlyBootstrap','ui.bootstrap', // 'ngSanitize','ui.select','ui.grid'], appFormly.config( function config(formlyConfigProvider) { //格式转换方法 XXX-XXX转驼峰命名 }); appFormly.controller('newDashCtrl', ['$rootScope', '$auth', '$scope', '$parse', '$injector', '$http', '$q', '$state', '$modal', '$timeout', '$interval', 'SweetAlert', 'i18nService', '$window', "ngTableParams", 'Restangular', 'UserRestangular', 'BpmRestangular', 'api_configure_form', 'api_bpm_domain', 'api_bpm_data','api_event_form', 'api_user_data', 'api_report', 'api_msg', 'api_bpm_schedule', 'api_newreport', 'api_statistic', "calendarConfig", "api_login","api_sysinfo","api_category", function($rootScope, $auth, $scope, $parse, $injector, $http, $q, $state, $modal, $timeout, $interval, SweetAlert, i18nService, $window, ngTableParams, Restangular, UserRestangular, BpmRestangular, api_configure_form, api_bpm_domain, api_bpm_data,api_event_form, api_user_data, api_report, api_msg, api_bpm_schedule, api_newreport, api_statistic, calendarConfig, api_login,api_sysinfo,api_category) { $scope.incidentlist = {}; $scope.bodyheight = {}; // $scope.tableParams = {}; $scope.sumline = ''; $scope.gaoliangleft = true; $scope.gaoliangright = false; $scope.userlist = []; $scope.totalPage = ""; $scope.thisuserrole = "admin"; $rootScope.app.layout.isNavbarFixed = false; $rootScope.app.layout.isSidebarFixed = false; $scope.thisalldata = moment(new Date()).format('YYYY-MM-DD hh:mm:ss'); $scope.thissomedata = moment(new Date()).format('YYYY-MM'); $scope.thisdatatop5 = moment(new Date()).format('YYYY年MM月'); $scope.thismonthtop5 = (new Date()).getMonth() + 1; $scope.thisyertop5 = (new Date()).getFullYear(); $scope.thismonthjiejue = (new Date()).getMonth() + 1; $scope.thisyerjiejue = (new Date()).getFullYear(); $scope.thisdatajiejue = moment(new Date()).format('YYYY年MM月'); $scope.maxtoptime = true; $scope.maxjiejuetime = true; $scope.paiming = '(暂无)'; $scope.loginBtn = { closeEl: '.close', modal: { templateUrl: 'assets/views/loginform.html', postion: 'center' } }; // 判断是否是事件经理 $scope.isEventManager = $rootScope.user.role.some(v => v.rolecode == 'incident manager'); var getMenus = function() { function convertListToTree(data, treeMap) { var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup var root = null; //Initially set our loop to null var parentNode = null; //loop over data for (var i = 0; i < data.length; i++) { // data[i].id = Number(data[i].id); var datum = data[i]; //each node will have children, so let's give it a "children" poperty datum.children = []; //add an entry for this node to the map so that any future children can //lookup the parent idToNodeMap[datum.id] = datum; //Does this node have a parent? if (typeof datum.parentid === "undefined" || datum.parentid == null) { //Doesn't look like it, so this node is the root of the tree root = datum; treeMap[datum.id] = root; } else { //This node has a parent, so let's look it up using the id parentNode = idToNodeMap[datum.parentid]; //We don't need this property, so let's delete it. //delete datum.parentid; //Let's add the current node as a child of the parent node. parentNode.children.push(datum); } } return root; } function convertParentToChildList(data) { var treeMap = {}; var list = []; convertListToTree(data, treeMap); angular.forEach(treeMap, function(item) { list.push(item); }); list = window._.sortBy(list, function(o) { return o.orders; }); return list; } //if(userMenus.length==0){ var userMenus = []; var idMapMenu = {}; if ($rootScope.user) { if ($rootScope.user.menu) { userMenus = convertParentToChildList($rootScope.user.menu); } } //} $rootScope.userMenus = userMenus; if ($rootScope.userMenus.length > 0) { // getpending(); // setInterval(getpending, 30000); } return userMenus; } var url = location.hash; //获取url中"?"符后的字串 var index=obj.lastIndexOf("\-"); var theRequest = {}; var index = url.substring(index + 1, url.length).lastIndexOf("\?"); if (url.indexOf("?") != -1 && url.indexOf("dashboard")) { var str = url.substr(index + 1); var strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); } $rootScope.statuscall = 1; $scope.loginForm = { username: theRequest.username, password: theRequest.password } $auth.submitLogin($scope.loginForm) .then(function(resp) { localStorage.setItem("jry_user", JSON.stringify(resp)); $rootScope.user = JSON.parse(localStorage.getItem("jry_user")); $rootScope.userMenus = JSON.parse(localStorage.getItem("jry_user")).menu; var loginUser = $rootScope.user; $scope.allFlag = false;//全部事件 for (var i = 0; i < loginUser.menu.length; i++) { if (loginUser.menu[i].link == "shijianliebiao_all") { $scope.allFlag = true } } getMenus(); if (resp.error != 500) { $rootScope.app.isLoginFixed = false; var filterDataone = { "assignee": $rootScope.user.id, "searchType": "todo", "idx": 0, "sum": 5 } var filterDatatwo = { "alarmIncident": { "state": "未处理" }, "idx": 0, "sum": 5 } $scope.filterData = { "assignee": $rootScope.user.id, "searchType": "todo", "idx": 0, "sum": 5 } $scope.nian = [(new Date()).getFullYear(), (new Date()).getFullYear() - 1, (new Date()).getFullYear() - 2, (new Date()).getFullYear() - 3, (new Date()).getFullYear() - 4, (new Date()).getFullYear() - 5, (new Date()).getFullYear() - 6, (new Date()).getFullYear() - 7, (new Date()).getFullYear() - 8, (new Date()).getFullYear() - 9, (new Date()).getFullYear() - 10, (new Date()).getFullYear() - 11, (new Date()).getFullYear() - 12, (new Date()).getFullYear() - 13, (new Date()).getFullYear() - 14, (new Date()).getFullYear() - 15, (new Date()).getFullYear() - 16, (new Date()).getFullYear() - 17, (new Date()).getFullYear() - 18, (new Date()).getFullYear() - 19]; $scope.yue = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] changeDivHeight();          window.onresize = function() {  changeDivHeight(); }               function  changeDivHeight() {                                var  h  =  document.documentElement.clientHeight; //获取页面可见高度   $scope.bodyheight = { "height": h + "px" };   $scope.sumline = (h - 60) * 0.45 / 34; } //角色判断 for (var i = 0; i < $rootScope.user.role.length; i++) { if ($rootScope.user.role[i].rolecode == "call center") { $scope.thisuserrole = "center"; break; } else if ($rootScope.user.role[i].rolecode == "admin general") { $scope.thisuserrole = "admin"; break; } else if ($rootScope.user.role[i].rolecode == "3164d1ab-b733-4cb0-98bc-7d1593df3ebc") { $scope.thisuserrole = "yunwei"; break; } } $scope.gowechart = function() { $state.go('app.desk.chart'); } $scope.gobaojin = function() { $state.go('app.desk.jry_emergency'); } $scope.goWxWeb = function() { $state.go('app.desk.chart'); } $scope.goCalllog = function() { $state.go('app.desk.calllog'); } $scope.goliuyan = function() { $state.go('app.desk.record'); } $scope.gotonghua = function() { $state.go('app.desk.calllog'); } $scope.gonewincident = function() { $state.go('app.incident.editor'); } $scope.goyuqi = function() { var fildata = { searchType: "overDate" } $state.go('app.incident.list', { model: JSON.stringify(fildata) }); } $scope.goknowledge = function() { $state.go('app.knowledge.manager'); } $scope.gohuifang = function() { $state.go('app.incident.list'); } $scope.gopaiban = function() { $state.go('app.scheduling.myscheduling'); } //新建问题 $scope.gonewproblem = function() { $state.go('app.problem.editor'); } //新建变更 $scope.gonewchange = function() { $state.go('app.change.editor'); } //cmdb $scope.gocmdb = function() { $state.go('app.means.listd'); } $scope.jingjiinform = function(row) { if (row.alarm.alarmExtension) { row.alarm.alarmExtension = row.alarm.alarmExtension.replace('{', ""); row.alarm.alarmExtension = row.alarm.alarmExtension.replace('}', ""); row.alarm.alarmExtension = row.alarm.alarmExtension.replace(/,/g, '\n'); } event.stopPropagation(); var modelfile = { model: row }; $state.go('app.desk.form_editor', { formKey: 'desk_emergency', service: 'api_user_data', model: JSON.stringify(modelfile) }); }; // $scope.goschedule = function(time) { // } //我的排班 $scope.scheevents = []; $scope.getschedule = function(time) { api_bpm_schedule.fetchSchedule($rootScope.user.id, time.startTime, time.endTime).then(function(response) { if (response.status == 200) { $scope.scheevents = []; var myData = response.list; angular.forEach(myData, function(item) { var eventTemp = {}; eventTemp.title = item.description; // eventTemp.title = item.name; eventTemp.type = item.scheduleClass.code; eventTemp.startsAt = moment(item['scheduleOrder'].startTime).toDate(); eventTemp.endsAtTime = moment(item['scheduleOrder'].endTime).toDate(); eventTemp.startTime = moment(item['scheduleOrder'].startTime).format('YYYY-MM-DD hh:mm') eventTemp.endTime = moment(item['scheduleOrder'].endTime).format('YYYY-MM-DD hh:mm') eventTemp.id = item.id; eventTemp.deletable = false; eventTemp.user = item.user; $scope.scheevents.push(eventTemp); }) $scope.scheevents = $scope.scheevents.slice(0, 5) } }); } $scope.getschedule({ 'time': { 'startTime': "2018-09-01 00:00:00", 'endTime': "2018-09-30 23:59:59" } }); //去处理 $scope.gotuclose = function(data) { if (data.type == 1) { $state.go('app.incident.editor', { taskId: data.taskId, processInstanceId: data.procInstId }); } else if (data.type == 2) { $state.go('app.change.editor', { taskId: data.taskId, processInstanceId: data.procInstId }); } else if (data.type == 3) { $state.go('app.problem.editor', { taskId: data.taskId, processInstanceId: data.procInstId }); } else if (data.type == 4) { $state.go('app.means.applyediter', { taskId: data.taskId, processInstanceId: data.procInstId }); } } //消息通知 // api_user_data.fetchDataList('user', { "idx": 0, "sum": 10 }).then(function(response) { // if (response) { // if (response.status = 200) { // $scope.userlist = response.list; // } // } // }) $scope.message_yes = function(type) { //已读0 var fildata = { "idx": 0, "sum": 5, "messageStation": { "readStatus": 1, "userId": $rootScope.user.id } }; api_msg.msgDataList(fildata).then(function(data) { if (data.status == 200) { api_user_data.fetchDataList('user', { "idx": 0, "sum": 1000, user: {engineer: 1,} }).then(function(response) { if (response) { $scope.xiaoxilist = data.list; angular.forEach(data.list, function(item, index) { angular.forEach(response.list, function(itemone) { if (item.userId == itemone.id) { $scope.xiaoxilist[index].user = itemone; } }) }) } }) } else {} }) }; $scope.message_yes(); //代办事项 function getincidentlist(fildata) { api_statistic.getTask($rootScope.user.id, $scope.filterData.idx, 5).then(function(data) { if (data) { // var myData = Restangular.stripRestangular(data); // var list = []; $scope.totalPage = Math.ceil(data.sum / 5); // $scope.myData = myData.data; // for (var i = 0; i < $scope.myData.length; i++) { // $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum // } if ($scope.totalPage <= 1) { $scope.gaoliangright = true; } $scope.incidentlist = data.task; angular.forEach($scope.incidentlist, function(item) { if (item.type == 1) { item.tolabelname = "事件工单" } else if (item.type == 2) { item.tolabelname = "变更工单" } else if (item.type == 3) { item.tolabelname = "问题工单" } else if (item.type == 4) { item.tolabelname = "资产审核" } }) // $scope.tableParams = new ngTableParams({ // page: 1, // show first page // count: 5 // count per page // }, { // total: $scope.incidentlist.length, // length of data // getData: function($defer, params) { // $defer.resolve($scope.incidentlist.slice((params.page() - 1) * params.count(), params.page() * params.count())); // } // }); } else { SweetAlert.swal({ title: "系统错误", text: "请稍后再试!", type: "error" }); } }, function() {}); } getincidentlist(filterDataone, ) //翻页 $scope.parselist = function() { if ($scope.gaoliangleft == false) { $scope.incidentlist = []; $scope.filterData.idx = $scope.filterData.idx - 1; if ($scope.filterData.idx == 0) { $scope.gaoliangleft = true; } $scope.gaoliangright = false; getincidentlist($scope.filterData) } } $scope.nextlist = function() { if ($scope.gaoliangright == false) { $scope.incidentlist = []; $scope.filterData.idx = $scope.filterData.idx + 1; if ($scope.filterData.idx == $scope.totalPage - 1) { $scope.gaoliangright = true; } $scope.gaoliangleft = false; getincidentlist($scope.filterData) } } //告警列表 api_bpm_data.fetchDataList("alarmIncident", filterDatatwo, 'alarmIncident').then(function(data) { $scope.myDataalarmincident = data.list; }, function() { }); //start事件月统计图 var domfault = document.getElementById("fault"); var myChartfault = echarts.init(domfault); var app = {}; var optionfault = null; app.title = '当月事件工单处理TOP5'; var XData = []; var yData = []; // XData.map(function() { // yData.push((Math.random() * 1000 + 100).toFixed(0)) // }) // var dataMin=parseInt(Math.min.apply(null, yData)/2); myChartfault.showLoading({   text: '数据加载中...', color: '#c23531', textColor: '#fff', maskColor: 'rgba(255,255,255,0)', zlevel: 0 }); myChartfault.hideLoading(); optionfault = { title: { // text: '(件)故障数量', x: '10', y: '0', textStyle: { fontWeight: 'normal', fontSize: 12, color: "#56c9ff", } }, xAxis: { axisTick: { show: false }, splitLine: { show: false, }, splitArea: { show: false }, // data: XData, data: ['', '', '', '', ''], axisLine: { lineStyle: { color: '#ddd' } }, axisLabel: { textStyle: { color: '#999999', fontSize: 12, } }, }, yAxis: { axisTick: { show: false }, splitLine: { show: true, lineStyle: { type: 'dashed', color: '#eee' } }, splitArea: { show: false }, axisLabel: { show: true, textStyle: { color: '#999999', fontSize: 12, } }, axisLine: { show: false, lineStyle: { color: '#4d4d4d' } } }, grid: { left: 10, top: 25, bottom: 0, right: 10, containLabel: true }, "tooltip": { "trigger": "item", "textStyle": { "fontSize": 12 }, "formatter": "{b0}:{c0}" }, series: { type: "bar", itemStyle: { normal: { color: function(params) { // type = 'linear'; var colorList = [ '#204266', '#1b3651', '#00437a', '#005395', '#79a3c4' ]; return colorList[params.dataIndex] }, } }, label: { normal: { show: true, position: 'top', textStyle: { // color: '#56c9ff' } } }, barWidth: 18, // barWidth: '30%', // data: yData data: [0, 0, 0, 0, 0] } }; // if (optionfault && typeof optionfault === "object") { // myChartfault.setOption(optionfault, true); // } function getinternettop5(data) { api_newreport.fetchDataList('handlePersonResolve', data).then(function(data) { if (data.status == 200) { var xaxisdata = []; if (data.data.length > 0) { for (var i = 0; i < 5 && i < data.data.length; i++) { xaxisdata.push(data.data[i].name); } for (var i = 0; i < data.data.length; i++) { if (data.data[i].name == $rootScope.user.name) { $scope.paiming = i + 1; break } else { $scope.paiming = "(暂无)"; } } } else { $scope.paiming = "(暂无)"; } // angular.forEach(data.data, function(item, index) { // if (item.name == $rootScope.user.name) { // $scope.paiming = I // } // }) optionfault.xAxis.data = xaxisdata; optionfault.series.data[0] = parseInt(data.data[0] ? data.data[0].num : 0); optionfault.series.data[1] = parseInt(data.data[1] ? data.data[1].num : 0); optionfault.series.data[2] = parseInt(data.data[2] ? data.data[2].num : 0); optionfault.series.data[3] = parseInt(data.data[3] ? data.data[3].num : 0); optionfault.series.data[4] = parseInt(data.data[4] ? data.data[4].num : 0); myChartfault.setOption(optionfault, true); myChartfault.hideLoading(); } }) } $scope.maxtoptime = true; getinternettop5({ "paramDateFrom": moment(new Date()).startOf('month').format('YYYY-MM-DD 00:00:00'), "paramDateTo": moment(new Date()).endOf('month').format('YYYY-MM-DD 23:59:59') }); var loginUser = $rootScope.user; var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $scope.scheduleClass = {}; $scope.odr = 2; $scope.searchstate = 2; $scope.events = []; $scope.calendarView = 'month'; $scope.calendarDate = moment().startOf('month').toDate(); $scope.calendarDatejiejue = moment().startOf('month').toDate(); $scope.calendarTitle; $scope.timeLabel = "时间"; $scope.eventLabel = "描述"; $scope.moment = function(string) { return moment(string); } $scope.eventClicked = function(event) { // console.log("event="+JSON.stringify(event)) showModal('Clicked', event); }; $scope.eventEdited = function(event) { showModal('Edited', event); }; var updateViews = function(newvalue, oldvalue) { // if (newvalue.getMonth() > (new Date()).getMonth()) { // $scope.maxtoptime = true; // $scope.calendarDate = oldvalue; // } else { if (oldvalue == newvalue) return; $scope.maxtoptime = false; var timeStart, timeEnd, timeStartSpan, timeEndSpan; timeStart = moment(newvalue).startOf('month'); timeEnd = moment(newvalue).endOf('month'); timeStartSpan = timeStart.format('YYYY-MM-DD 00:00:00'); timeEndSpan = timeEnd.format('YYYY-MM-DD 23:59:59'); $scope.thisdatatop5 = moment(newvalue).startOf('month').format('YYYY年MM月'); $scope.thismonthtop5 = newvalue.getMonth() + 1; $scope.thisyertop5 = newvalue.getFullYear(); // if (newvalue.getMonth() == (new Date()).getMonth()) { // $scope.maxtoptime = true; // } else { // $scope.maxtoptime = false; // } getinternettop5({ "paramDateFrom": timeStartSpan, "paramDateTo": timeEndSpan }); // } } $scope.$watch('calendarDate', updateViews); $scope.changeyear = function(yeardata) { $scope.calendarDate = new Date((new Date($scope.calendarDate)).setYear(yeardata)); } $scope.changemonth = function(monthdata) { $scope.calendarDate = new Date((new Date($scope.calendarDate)).setMonth(monthdata - 1)); } $scope.next = function() { $scope.getmonth = 'nextmonth'; $scope.calendarControl.next(); } $scope.prev = function() { $scope.calendarControl.prev(); } $scope.setCalendarToToday = function() { $scope.calendarDay = new Date(); }; $scope.toggle = function($event, field, event) { $event.preventDefault(); $event.stopPropagation(); event[field] = !event[field]; }; // $scope.nexttop5 = function() { // $state.go('app.desk.chart'); // } // setInterval(function() { // getinternettop5({ "paramDateFrom": "2018-09-01 00:00:00", "paramDateTo": "2018-09-30 23:59:59" }); // }, 10000); //end事件月统计图 //当月工单解决率 var domfinish = document.getElementById("finish"); var myChartfinish = echarts.init(domfinish); var app = {}; var optionfinish = null; app.title = '当月工单解决率'; myChartfinish.showLoading({   text: '数据加载中...', color: '#c23531', textColor: '#fff', maskColor: 'rgba(255,255,255,0)', zlevel: 0 }); myChartfinish.hideLoading(); optionfinish = { title: { "text": 0, subtext: '事件总数', itemGap: 3, "x": '48%', "y": '35%', textAlign: "center", "textStyle": { "fontWeight": 'normal', "fontSize": 18, "color": '#005395', }, "subtextStyle": { "fontWeight": 'normal', "fontSize": 12, "color": '#333', "lineHeight": 14 }, }, tooltip: { // show: false, trigger: 'item', formatter: function(a) { // console.log(a) return ( a['data']['name'] + ":" + a['data']['value'] ) }, position: ['50%', '30%'] }, grid: { left: 10, top: 0, bottom: 0, right: 10, containLabel: true }, legend: { show: true, orient: 'vertical', x: 'center', // y: 'bottom', bottom: 40, itemWidth: 14, itemHeight: 14, // shadowOffsetX: 20, textStyle: { fontSize: '14', fontWeight: 'normal', color: '#666', }, data: ['按时解决', '逾期解决'], formatter: function(name) { var oa = optionfinish.series[0].data; var num = oa[0].value + oa[1].value + oa[2].value; for (var i = 0; i < optionfinish.series[0].data.length; i++) { if (name == oa[i].name) { return ' ' + name + ' ' + oa[i].value + ' ' + oa[i].percent + '%'; } } } }, "color": ["#79a3c4", "#005395", "transparent", "transparent"], "startAngle": 180, series: [{ name: '', type: 'pie', radius: ['60%', '80%'], avoidLabelOverlap: false, startAngle: 180, center: ["50%", "50%"], //stillShowZeroSum:0, label: { normal: { show: false, position: 'inner', textStyle: { color: '#fff', fontSize: 12 } }, emphasis: { show: false, textStyle: { fontSize: '12', fontWeight: 'bold' } } }, labelLine: { normal: { show: false } }, data: [{ value: 50, name: '按时解决' }, { value: 50, name: '逾期解决' }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }] }] }; // if (optionfinish && typeof optionfinish === "object") { // myChartfinish.setOption(optionfinish, true); // } function getinternetAlarm(data) { api_newreport.fetchDataList('getIncidentSolveRatio', data).then(function(data) { if (data.code == 200) { optionfinish.series[0].data[0].value = data.noOverdue; optionfinish.series[0].data[0].percent = data.noOverdueRatio; optionfinish.series[0].data[1].value = data.overdue; optionfinish.series[0].data[1].percent = data.overdueRatio; optionfinish.series[0].data[2].value = data.sum / 2; optionfinish.series[0].data[3].value = data.sum / 2; optionfinish.title.text = data.sum; myChartfinish.setOption(optionfinish, true); myChartfinish.hideLoading(); } else { // optionfinish.series[0].data[0].value = 0; // optionfinish.series[0].data[1].value = 0; // optionfinish.series[0].data[2].value = 0; // myChartfinish.setOption(optionfinish); // myChartfinish.hideLoading(); } }) } getinternetAlarm({ "date": $scope.thissomedata }); var updateViewsalarm = function(newvalue, oldvalue) { if (oldvalue == newvalue) return; var timeStart, timeEnd, timeStartSpan, timeEndSpan; timeStart = moment(newvalue).startOf('month'); timeEnd = moment(newvalue).endOf('month'); timeStartSpan = timeStart.format('YYYY-MM-DD 00:00:00'); timeEndSpan = timeEnd.format('YYYY-MM-DD 23:59:59'); $scope.thisdatajiejue = moment(newvalue).startOf('month').format('YYYY年MM月'); $scope.thismonthjiejue = newvalue.getMonth() + 1; $scope.thisyerjiejue = newvalue.getFullYear(); getinternetAlarm({ "date": timeStart.format('YYYY-MM') }); } $scope.$watch('calendarDatejiejue', updateViewsalarm) $scope.jiejueyear = function(yeardata) { $scope.calendarDatejiejue = new Date((new Date($scope.calendarDatejiejue)).setYear(yeardata)); } $scope.jiejuemonth = function(monthdata) { $scope.calendarDatejiejue = new Date((new Date($scope.calendarDatejiejue)).setMonth(monthdata - 1)); } //知识库撰写量 var domknowlege = document.getElementById("knowlege"); var myChartknowlege = echarts.init(domknowlege); var app = {}; var optionknowlege = null; app.title = '知识库撰写量'; myChartknowlege.showLoading({   text: '数据加载中...', color: '#c23531', textColor: '#fff', maskColor: 'rgba(255,255,255,0)', zlevel: 0 }); myChartknowlege.hideLoading(); optionknowlege = { title: { "text": 0, subtext: '知识库总数', itemGap: 3, "x": '48%', "y": '35%', textAlign: "center", "textStyle": { "fontWeight": 'normal', "fontSize": 18, "color": '#005395', }, "subtextStyle": { "fontWeight": 'normal', "fontSize": 12, "color": '#333', "lineHeight": 14 }, }, tooltip: { // show: false, trigger: 'item', formatter: function(a) { // console.log(a) return ( a['data']['name'] + ":" + a['data']['value'] ) }, position: ['50%', '30%'] }, grid: { left: 10, top: 0, bottom: 0, right: 10, containLabel: true }, legend: { show: true, orient: 'vertical', x: 'center', // y: 'bottom', bottom: 40, itemWidth: 14, itemHeight: 14, // shadowOffsetX: 20, textStyle: { fontSize: '14', fontWeight: 'normal', color: '#666', }, data: ['我撰写', '其他人撰写'], formatter: function(name) { var oa = optionknowlege.series[0].data; var num = parseInt(oa[0].value) + parseInt(oa[1].value) + parseInt(oa[2].value); for (var i = 0; i < optionknowlege.series[0].data.length; i++) { if (name == oa[i].name) { return ' ' + name + ' ' + oa[i].value + ' ' + oa[i].percent + '%'; } } } }, "color": ["#005395", "#79a3c4", "transparent", "transparent"], "startAngle": 180, series: [{ name: '', type: 'pie', radius: ['60%', '80%'], avoidLabelOverlap: false, startAngle: 180, center: ["50%", "50%"], label: { normal: { show: false, position: 'inner', textStyle: { color: '#fff', fontSize: 12 }, // formatter: function(params) { // if (params.value > 0) { // return params.percent + '%' // } else { // return '' // } // } }, emphasis: { show: false, textStyle: { fontSize: '12', fontWeight: 'bold' } } }, labelLine: { normal: { show: false } }, data: [{ value: 50, name: '我撰写' }, { value: 50, name: '其他人撰写' }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }] }] }; // if (optionknowlege && typeof optionknowlege === "object") { // myChartknowlege.setOption(optionknowlege, true); // } function getinternetknow(data) { api_newreport.fetchDataList('getSolutionCountByMyself', data).then(function(data) { if (data.status == "200") { optionknowlege.series[0].data[0].value = data.data[0] ? data.data[0].num : 0; optionknowlege.series[0].data[0].percent = data.data[0] ? data.data[0].percent : 0 if (data.data == 0) { optionknowlege.series[0].data[1].percent = 0 } else { optionknowlege.series[0].data[1].percent = data.otherPercent ? data.otherPercent : 0 } optionknowlege.series[0].data[1].value = data.total - (data.data[0] ? data.data[0].num : 0); optionknowlege.series[0].data[2].value = data.total / 2; optionknowlege.series[0].data[3].value = data.total / 2; optionknowlege.title.text = data.total; myChartknowlege.setOption(optionknowlege, true); myChartknowlege.hideLoading(); } else { } }) } getinternetknow({ "user": $rootScope.user.id }); } else { SweetAlert.swal("用户名或者密码验证失败,请重试!", "error"); } }) // $scope.login_signquick(theRequest) } else { var filterDataone = { "assignee": $rootScope.user.id, "searchType": "todo", "idx": 0, "sum": 5 } var filterDatatwo = { "alarmIncident": { "state": "未处理" }, "idx": 0, "sum": 5 } $scope.filterData = { "assignee": $rootScope.user.id, "searchType": "todo", "idx": 0, "sum": 5 } $scope.nian = [(new Date()).getFullYear(), (new Date()).getFullYear() - 1, (new Date()).getFullYear() - 2, (new Date()).getFullYear() - 3, (new Date()).getFullYear() - 4, (new Date()).getFullYear() - 5, (new Date()).getFullYear() - 6, (new Date()).getFullYear() - 7, (new Date()).getFullYear() - 8, (new Date()).getFullYear() - 9, (new Date()).getFullYear() - 10, (new Date()).getFullYear() - 11, (new Date()).getFullYear() - 12, (new Date()).getFullYear() - 13, (new Date()).getFullYear() - 14, (new Date()).getFullYear() - 15, (new Date()).getFullYear() - 16, (new Date()).getFullYear() - 17, (new Date()).getFullYear() - 18, (new Date()).getFullYear() - 19]; $scope.yue = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] changeDivHeight(); window.onresize = function() { changeDivHeight(); } function changeDivHeight() { var h = document.documentElement.clientHeight; //获取页面可见高度   $scope.bodyheight = { "height": h + "px" }; $scope.sumline = (h - 60) * 0.45 / 34; } //角色判断 for (var i = 0; i < $rootScope.user.role.length; i++) { if ($rootScope.user.role[i].rolecode == "call center") { $scope.thisuserrole = "center"; break; } else if ($rootScope.user.role[i].rolecode == "admin general") { $scope.thisuserrole = "admin"; break; } else if ($rootScope.user.role[i].rolecode == "3164d1ab-b733-4cb0-98bc-7d1593df3ebc") { $scope.thisuserrole = "yunwei"; break; } } $scope.gowechart = function() { $state.go('app.desk.chart'); } $scope.gobaojin = function() { $state.go('app.desk.jry_emergency'); } $scope.goWxWeb = function() { $state.go('app.desk.chart'); } $scope.goCalllog = function() { $state.go('app.desk.calllog'); } $scope.goliuyan = function() { $state.go('app.desk.record'); } $scope.gotonghua = function() { $state.go('app.desk.calllog'); } $scope.gonewincident = function() { $state.go('app.incident.editor'); } $scope.goyuqi = function() { var fildata = { searchType: "all" } $state.go('app.incident.list', { model: JSON.stringify(fildata) }); window.sessionStorage.setItem('isGoyuqi','yes'); } $scope.goknowledge = function() { $state.go('app.knowledge.manager'); } $scope.gohuifang = function() { $state.go('app.incident.list'); } $scope.gopaiban = function() { $state.go('app.scheduling.myscheduling'); } //新建问题 $scope.gonewproblem = function() { $state.go('app.problem.editor'); } //新建变更 $scope.gonewchange = function() { $state.go('app.change.editor'); } //cmdb $scope.gocmdb = function() { $state.go('app.means.listd'); } $scope.jingjiinform = function(row) { if (row.alarm.alarmExtension) { row.alarm.alarmExtension = row.alarm.alarmExtension.replace('{', ""); row.alarm.alarmExtension = row.alarm.alarmExtension.replace('}', ""); row.alarm.alarmExtension = row.alarm.alarmExtension.replace(/,/g, '\n'); } event.stopPropagation(); var modelfile = { model: row }; $state.go('app.desk.form_editor', { formKey: 'desk_emergency', service: 'api_user_data', model: JSON.stringify(modelfile) }); }; //去处理 $scope.gotuclose = function(data) { if (data.type == 1) { $state.go('app.incident.editor', { taskId: data.taskId, processInstanceId: data.procInstId,dataId: data.id }); } else if (data.type == 2) { $state.go('app.change.editor', { taskId: data.taskId, processInstanceId: data.procInstId }); } else if (data.type == 3) { $state.go('app.problem.editor', { taskId: data.taskId, processInstanceId: data.procInstId }); } else if (data.type == 4) { $state.go('app.means.applyediter', { taskId: data.taskId, processInstanceId: data.procInstId }); } } // 消息通知 $scope.message_yes = function(type) { var fildata = { "idx": 0, "sum": 5, "messageStation": { "readStatus": 0, "userId": $rootScope.user.id } }; api_msg.msgDataList(fildata).then(function(data) { if (data.status == 200) { api_user_data.fetchDataList('user', { "idx": 0, "sum": 1000,user: {engineer: 1,} }).then(function(response) { if (response) { $scope.xiaoxilist = data.list; angular.forEach(data.list, function(item, index) { angular.forEach(response.list, function(itemone) { if (item.userId == itemone.id) { $scope.xiaoxilist[index].user = itemone; } }) }) } }) } else {} }) }; // 最新五条微信WEB工单(未受理) $scope.wxWebList = []; $scope.getWxWeb = function() { var filterData = { "idx": 0, "sum": 5, "incident": { "source": {value: "im"}, "state": { "id": 1765 } } }; api_bpm_data.fetchDataList("incident", filterData).then(function(data) { if (data.status == 200) { $scope.wxWebList = data.list; } }) }; // 最新五条通话记录 $scope.calllogList = []; $scope.getCalllog = function() { var filterData = { "idx": 0, "sum": 5, callrecord: { todayTime: moment().format('YYYY-MM-DD') + ' 00:00:00', todayTimeEnd: moment().format('YYYY-MM-DD') + ' 23:59:59' } }; api_bpm_data.fetchDataList("callrecord", filterData).then(function(data) { if (data.status == 200) { $scope.calllogList = data.list; } }) }; //录音 $scope.recordcall = function(data) { var modalInstance = $modal.open({ backdrop: "static", templateUrl: 'assets/views/incident/tpl/audio.html', controller: function($rootScope, $scope, $modalInstance, $sce, $http, api_playservice) { $scope.audioUrl=$sce.trustAsResourceUrl(callIp+data.recordingFileName); $scope.cancel = function() { $modalInstance.dismiss('cancel'); }; $modalInstance.close(); } }); modalInstance.result.then(function(result) { // $rootScope.setidle(); }, function(reason) { $rootScope.setidle(); }); }; // 近15天建单数(当前用户建单数 $scope.getInfo5 = function(){ // 近15天建单数(当前用户建单数)start var domfault = document.getElementById("fault"); var myChartfault = echarts.init(domfault); myChartfault.showLoading({   text: '数据加载中...', color: '#c23531', textColor: '#fff', maskColor: 'rgba(255,255,255,0)', zlevel: 0 }); myChartfault.hideLoading(); var optionfault = { tooltip: { trigger: "axis", axisPointer: { // 坐标轴指示器,坐标轴触发有效 // type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' lineStyle: { color: "#49A9EE", type: "dotted", }, }, }, legend: { // data: ["响应平均时长"], align: "left", // itemWidth:10, // itemHeight:10, bottom: 0, }, grid: { left: "1%", right: "0%", bottom: "15%", containLabel: true, }, xAxis: [ { type: "category", // axisTick: { // alignWithLabel: true // }, axisLabel: { interval:0, textStyle: { color: "#7B7B7B", // fontSize: '14', }, }, axisLine: { show: true, lineStyle: { color: "#7B7B7B", // type: 'dotted' }, }, data: [], }, ], yAxis: [ { type: "value", scale: true, name: "单数", min: 0, boundaryGap: [0.2, 0.2], minInterval: 1, // axisLabel: { // formatter: '{value}' // } axisLabel: { textStyle: { color: "#7B7B7B", // fontSize: '14', }, }, axisLine: { show: true, lineStyle: { color: "#7B7B7B", // type: 'dotted' }, }, }, ], series: [ { name: "单数", type: "line", itemStyle: { normal: { color: "#49A9EE", }, }, lineStyle: { normal: { color: "#49A9EE", }, }, data: [], } ], }; function getinternettop5(data) { api_bpm_data.createIncidentCount(data).then(function(data) { if (data.status == 200) { optionfault.xAxis[0].data = data.data.map(v => v[0]); optionfault.series[0].data = data.data.map(v => v[1]); myChartfault.setOption(optionfault, true); myChartfault.hideLoading(); } }) } getinternettop5({ "startTime": moment().day(moment().day() - 14).format('YYYY-MM-DD 00:00:00'), "endTime": moment().format('YYYY-MM-DD 23:59:59'), userId: $rootScope.user.id }); // 近15天建单数(当前用户建单数)end } //知识库撰写量 $scope.getInfo6 = function(){ //知识库撰写量 var domknowlege = document.getElementById("knowlege"); var myChartknowlege = echarts.init(domknowlege); var app = {}; var optionknowlege = null; app.title = '知识库撰写量'; myChartknowlege.showLoading({   text: '数据加载中...', color: '#c23531', textColor: '#fff', maskColor: 'rgba(255,255,255,0)', zlevel: 0 }); myChartknowlege.hideLoading(); optionknowlege = { title: { "text": 0, subtext: '知识库总数', itemGap: 3, "x": '48%', "y": '35%', textAlign: "center", "textStyle": { "fontWeight": 'normal', "fontSize": 18, "color": '#005395', }, "subtextStyle": { "fontWeight": 'normal', "fontSize": 12, "color": '#333', "lineHeight": 14 }, }, tooltip: { // show: false, trigger: 'item', formatter: function(a) { // console.log(a) return ( a['data']['name'] + ":" + a['data']['value'] ) }, position: ['50%', '30%'] }, grid: { left: 10, top: 0, bottom: 0, right: 10, containLabel: true }, legend: { show: true, orient: 'vertical', x: 'center', // y: 'bottom', bottom: 40, itemWidth: 14, itemHeight: 14, // shadowOffsetX: 20, textStyle: { fontSize: '14', fontWeight: 'normal', color: '#666', }, data: ['我撰写', '其他人撰写'], formatter: function(name) { var oa = optionknowlege.series[0].data; var num = parseInt(oa[0].value) + parseInt(oa[1].value) + parseInt(oa[2].value); for (var i = 0; i < optionknowlege.series[0].data.length; i++) { if (name == oa[i].name) { return ' ' + name + ' ' + oa[i].value + ' ' + oa[i].percent + '%'; } } } }, "color": ["#005395", "#79a3c4", "transparent", "transparent"], "startAngle": 180, series: [{ name: '', type: 'pie', radius: ['60%', '80%'], avoidLabelOverlap: false, startAngle: 180, center: ["50%", "50%"], label: { normal: { show: false, position: 'inner', textStyle: { color: '#fff', fontSize: 12 }, // formatter: function(params) { // if (params.value > 0) { // return params.percent + '%' // } else { // return '' // } // } }, emphasis: { show: false, textStyle: { fontSize: '12', fontWeight: 'bold' } } }, labelLine: { normal: { show: false } }, data: [{ value: 50, name: '我撰写' }, { value: 50, name: '其他人撰写' }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }, { value: 50, name: '', tooltip: { formatter: function(a) { return "" } } }] }] }; function getinternetknow(data) { api_newreport.fetchDataList('getSolutionCountByMyself', data).then(function(data) { if (data.status == "200") { optionknowlege.series[0].data[0].value = data.data[0] ? data.data[0].num : 0; optionknowlege.series[0].data[0].percent = data.data[0] ? data.data[0].percent : 0 if (data.data == 0) { optionknowlege.series[0].data[1].percent = 0 } else { optionknowlege.series[0].data[1].percent = data.otherPercent ? data.otherPercent : 0 } optionknowlege.series[0].data[1].value = data.total - (data.data[0] ? data.data[0].num : 0); optionknowlege.series[0].data[2].value = data.total / 2; optionknowlege.series[0].data[3].value = data.total / 2; optionknowlege.title.text = data.total; myChartknowlege.setOption(optionknowlege, true); myChartknowlege.hideLoading(); } else { } }) } getinternetknow({ "user": $rootScope.user.id }); } //科室基础信息展示 $scope.dutyOrderCountList = []; $scope.dutyOrderCount = function(){ var postData = {} // 根据权限查询 if($rootScope.user.duty){ // 当前的所属责任科室 postData.dutyId = $rootScope.user.duty.id; }else if($rootScope.user.branch){ // 当前的所属院区 postData.branchId = $rootScope.user.branch.id; } api_newreport.fetchDataListIndex('dutyOrderCount', postData).then(function(data) { if (data.status == 200) { let result = data.data || []; $scope.dutyOrderCountList = _.chunk(result, 2); } }) } //今日各人员工作情况 $scope.filterDataTodayUserOrderCount = { "idx": 0, "sum": 5 } $scope.filterDataTodayUserOrderCountTotalPage = 1; $scope.gaoliangleftTodayUserOrderCount = true; $scope.gaoliangrightTodayUserOrderCount= true; $scope.todayUserOrderCountList = []; $scope.todayUserOrderCount = function(){ if(!$scope.parameters.duty1){ $scope.filterDataTodayUserOrderCountTotalPage = 1; $scope.gaoliangleftTodayUserOrderCount = true; $scope.gaoliangrightTodayUserOrderCount= true; $scope.todayUserOrderCountList = []; return; } $scope.filterDataTodayUserOrderCount.dutyId = $scope.parameters.duty1.id; api_newreport.fetchDataListIndex('todayUserOrderCount', $scope.filterDataTodayUserOrderCount).then(function(data) { if (data.status == 200) { $scope.filterDataTodayUserOrderCountTotalPage = Math.ceil(data.totalNum / 5) || 1; $scope.gaoliangrightTodayUserOrderCount = $scope.filterDataTodayUserOrderCount.idx >= $scope.filterDataTodayUserOrderCountTotalPage - 1; $scope.gaoliangleftTodayUserOrderCount = $scope.filterDataTodayUserOrderCount.idx <= 0; $scope.todayUserOrderCountList = data.data || []; } }) } //今日各人员工作情况-翻页 $scope.parselistTodayUserOrderCount = function() { if ($scope.gaoliangleftTodayUserOrderCount == false) { $scope.todayUserOrderCountList = []; $scope.filterDataTodayUserOrderCount.idx = $scope.filterDataTodayUserOrderCount.idx - 1; if ($scope.filterDataTodayUserOrderCount.idx <= 0) { $scope.gaoliangleftTodayUserOrderCount = true; } $scope.gaoliangrightTodayUserOrderCount = false; $scope.todayUserOrderCount(); } } $scope.nextlistTodayUserOrderCount = function() { if ($scope.gaoliangrightTodayUserOrderCount == false) { $scope.todayUserOrderCountList = []; $scope.filterDataTodayUserOrderCount.idx = $scope.filterDataTodayUserOrderCount.idx + 1; if ($scope.filterDataTodayUserOrderCount.idx >= $scope.filterDataTodayUserOrderCountTotalPage - 1) { $scope.gaoliangrightTodayUserOrderCount = true; } $scope.gaoliangleftTodayUserOrderCount = false; $scope.todayUserOrderCount(); } } // 今日各人员工作情况-切换责任科室 $scope.changeDuty1 = function(){ $scope.filterDataTodayUserOrderCount.idx = 0; $scope.todayUserOrderCount(); } //建单数量排行 $scope.secondCategoryGraphEcharts = function(){ // 建单数量排行start var domfault = document.getElementById("secondCategoryGraph"); $scope.myChartfaultSecondCategoryGraph = echarts.init(domfault); $scope.secondCategoryGraph(); // 建单数量排行end } $scope.secondCategoryGraph = function(){ if(!$scope.parameters.duty2){ return; } api_newreport.fetchDataListIndex('secondCategoryGraph', {dutyId: $scope.parameters.duty2.id}).then(function(data) { if (data.status == 200) { data.data = data.data || []; var optionfault = { title: { x: '10', y: '0', textStyle: { fontWeight: 'normal', fontSize: 12, color: "#56c9ff", } }, xAxis: { axisTick: { show: false }, splitLine: { show: false, }, splitArea: { show: false }, data: [], axisLine: { lineStyle: { color: '#ddd' } }, axisLabel: { textStyle: { color: '#999999', fontSize: 12, } }, }, yAxis: { minInterval: 1, axisTick: { show: false }, splitLine: { show: true, lineStyle: { type: 'dashed', color: '#eee' } }, splitArea: { show: false }, axisLabel: { show: true, textStyle: { color: '#999999', fontSize: 12, } }, axisLine: { show: false, lineStyle: { color: '#4d4d4d' } } }, grid: { left: 10, top: 25, bottom: 0, right: 10, containLabel: true }, "tooltip": { "trigger": "item", "textStyle": { "fontSize": 12 }, "formatter": "{b0}:{c0}" }, series: { type: "bar", itemStyle: { normal: { color: function(params) { var colorList = [ '#204266', '#1b3651', '#00437a', '#005395', '#79a3c4' ]; return colorList[params.dataIndex] }, } }, label: { normal: { show: true, position: 'top', textStyle: {} } }, barWidth: 18, data: [] } }; var result = _.zip.apply(null, data.data); optionfault.xAxis.data = result[0] || []; optionfault.series.data = result[1] || []; $scope.myChartfaultSecondCategoryGraph.setOption(optionfault, true); } }) } // 建单数量排行-切换责任科室 $scope.changeDuty2 = function(){ $scope.secondCategoryGraph(); } //超时工单 $scope.filterDataOvertimeOrderCount = { "idx": 0, "sum": 5 } $scope.filterDataOvertimeOrderCountTotalPage = 1; $scope.gaoliangleftOvertimeOrderCount = true; $scope.gaoliangrightOvertimeOrderCount= true; $scope.overtimeOrderCountList = []; $scope.overtimeOrderCount = function(){ if(!$scope.parameters.duty3){ $scope.filterDataOvertimeOrderCountTotalPage = 1; $scope.gaoliangleftOvertimeOrderCount = true; $scope.gaoliangrightOvertimeOrderCount= true; $scope.overtimeOrderCountList = []; return; } $scope.filterDataOvertimeOrderCount.dutyId = $scope.parameters.duty3.id; api_newreport.fetchDataListIndex('overtimeOrderCount', $scope.filterDataOvertimeOrderCount).then(function(data) { if (data.status == 200) { $scope.filterDataOvertimeOrderCountTotalPage = Math.ceil(data.totalNum / 5) || 1; $scope.gaoliangrightOvertimeOrderCount = $scope.filterDataOvertimeOrderCount.idx >= $scope.filterDataOvertimeOrderCountTotalPage - 1; $scope.gaoliangleftOvertimeOrderCount = $scope.filterDataOvertimeOrderCount.idx <= 0; $scope.overtimeOrderCountList = data.data || []; } }) } //超时工单-翻页 $scope.parselistOvertimeOrderCount = function() { if ($scope.gaoliangleftOvertimeOrderCount == false) { $scope.overtimeOrderCountList = []; $scope.filterDataOvertimeOrderCount.idx = $scope.filterDataOvertimeOrderCount.idx - 1; if ($scope.filterDataOvertimeOrderCount.idx <= 0) { $scope.gaoliangleftOvertimeOrderCount = true; } $scope.gaoliangrightOvertimeOrderCount = false; $scope.overtimeOrderCount(); } } $scope.nextlistOvertimeOrderCount = function() { if ($scope.gaoliangrightOvertimeOrderCount == false) { $scope.overtimeOrderCountList = []; $scope.filterDataOvertimeOrderCount.idx = $scope.filterDataOvertimeOrderCount.idx + 1; if ($scope.filterDataOvertimeOrderCount.idx >= $scope.filterDataOvertimeOrderCountTotalPage - 1) { $scope.gaoliangrightOvertimeOrderCount = true; } $scope.gaoliangleftOvertimeOrderCount = false; $scope.overtimeOrderCount(); } } // 超时工单-切换责任科室 $scope.changeDuty3 = function(){ $scope.filterDataOvertimeOrderCount.idx = 0; $scope.overtimeOrderCount(); } // 近15天各部门的建单数 $scope.dutyOrderGraphEcharts = function(){ var domfault = document.getElementById("fault"); $scope.myChartfaultDutyOrderGraph = echarts.init(domfault); $scope.dutyOrderGraph(); } $scope.dutyOrderGraph = function(){ // 近15天各部门的建单数start var postData = {} // 根据权限查询 if($rootScope.user.duty){ // 当前的所属责任科室 postData.dutyId = $rootScope.user.duty.id; }else if($rootScope.user.branch){ // 当前的所属院区 postData.branchId = $rootScope.user.branch.id; } api_newreport.fetchDataListIndex('dutyOrderGraph', postData).then(function(data) { if (data.status == 200) { data.dataList = data.dataList || []; data.timeList = data.timeList || []; data.nameList = data.nameList || []; var optionfault = { tooltip: { trigger: "axis", axisPointer: { lineStyle: { color: "#49A9EE", type: "dotted", }, }, }, legend: { data: data.nameList }, grid: { left: "1%", right: "0%", bottom: "5%", containLabel: true, }, xAxis: [ { type: "category", axisLabel: { interval:0, textStyle: { color: "#7B7B7B", }, }, axisLine: { show: true, lineStyle: { color: "#7B7B7B", }, }, data: [], }, ], yAxis: [ { type: "value", scale: true, name: "单数", min: 0, boundaryGap: [0.2, 0.2], minInterval: 1, axisLabel: { textStyle: { color: "#7B7B7B", }, }, axisLine: { show: true, lineStyle: { color: "#7B7B7B", }, }, }, ], series: [], }; optionfault.xAxis[0].data = data.timeList; data.dataList.forEach(function(v, i){ optionfault.series.push({ name: data.nameList[i], type: "line", data: v }) }) $scope.myChartfaultDutyOrderGraph.setOption(optionfault, true); } }) // 近15天各部门的建单数end } // 获取责任科室 $scope.parameters = {}; $scope.dutys = []; $scope.getOwnDuty = function(isFirst = false){ api_category.getOwnDuty({}).then(function (response) { if (response) { if ((response.status = 200)) { $scope.dutys = response.data; if(isFirst && $scope.dutys[0]){ $scope.parameters.duty1 = $scope.dutys[0]; $scope.parameters.duty2 = $scope.dutys[0]; $scope.parameters.duty3 = $scope.dutys[0]; $scope.todayUserOrderCount(); $timeout($scope.secondCategoryGraphEcharts, 0); $scope.overtimeOrderCount(); } } } }); } // 判断是否是事件经理,显示不同页面 if($scope.isEventManager){ $scope.getOwnDuty(true); $scope.dutyOrderCount(); $timeout($scope.dutyOrderGraphEcharts, 0); }else{ $scope.getInfo5(); $scope.getInfo6(); $scope.getCalllog(); $scope.getWxWeb(); $scope.message_yes(); } } // setInterval(function() { // getinternetknow({ "user": 23 }); // }, 10000); // 当前登录用户 console.log($rootScope.user); var loginUser = $rootScope.user; if(loginUser){ $scope.allFlag = false;//全部事件 for (var i = 0; i < loginUser.menu.length; i++) { if (loginUser.menu[i].link == "shijianliebiao_all") { $scope.allFlag = true } } } // 判断首页统计页面是否显示 // if($rootScope.user.role.length){ // $scope.isShowTj = $rootScope.user.role.some(function(v){ // return v.rolecode === "incident-category-manager" || v.rolecode === "incident manager"; // }) // }else{ // $scope.isShowTj = false; // } // 首页统计数据(新) $scope.managerIndexInfo = {}; $scope.getDataIndex = function(){ // 获取今日上下班情况 api_bpm_data.getManagerIndexInfo({}).then(function(result) { $scope.managerIndexInfo = result.data; }); // 当日工单情况 // api_event_form.fetchZhtjList({ // "startTime": moment(new Date()).format('YYYY-MM-DD'), // "endTime": moment(new Date()).format('YYYY-MM-DD'), // "sortData": 'total', // "sortType": 'desc' // }).then(function(result) { // $scope.fetchZhtjList = result.title; // }); // 当日请求微信web api_event_form.fetchWebList({ "startTime": moment(new Date()).format('YYYY-MM-DD'), "endTime": moment(new Date()).format('YYYY-MM-DD'), "sortData": 'total', "sortType": 'desc' }).then(function(result) { $scope.fetchWebList = result.title; }); // 当日请求电话 api_event_form.fetchDhtjList({ "startTime": moment(new Date()).format('YYYY-MM-DD'), "endTime": moment(new Date()).format('YYYY-MM-DD'), "sortData": 'total', "sortType": 'desc' }).then(function(result) { $scope.fetchDhtjList = result.title; }); } // 获取首页统计数据 $scope.serviceUserIndexInfo = []; $scope.getServiceCount = function(){ api_bpm_data.serviceCount({userId: $rootScope.user.id}).then(function(data) { if (data.status == 200) { $scope.serviceUserIndexInfo = Array.isArray(data.data) ? (Array.isArray(data.data[0]) ? data.data[0] : []) : []; } }) } // 判断首页统计页面是否显示 $scope.ifShowTj = false; $scope.ifShowTjFunc = function(){ // api_sysinfo.fetchDataList('systemConfiguration',{ // "idx": 0, // "sum": 1, // systemConfiguration: { // keyconfig: "ifWorking" // } // }).then(function(result) { // $scope.ifShowTj = result.list[0].valueconfig == 1; // if($scope.allFlag){ // $scope.getDataIndex(); // } // }); var loginUser = $rootScope.user; if(loginUser){ $scope.ifShowTj = loginUser.role.some( v => v.rolecode == 'call center'); if($scope.ifShowTj){ $scope.getServiceCount(); } } } !$scope.isEventManager && $scope.ifShowTjFunc(); // 跳转 $scope.goTo = function(url,data){ state.go(url,data); } } ]);