1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900 |
- '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,
- "wxincident": {
- "serviceState": {
- "id": 1650
- }
- }
- };
- // 根据权限查询
- if($rootScope.user.duty){
- // 当前的所属责任科室
- filterData.wxincident.duty = $rootScope.user.duty;
- }else if($rootScope.user.branch){
- // 当前的所属院区
- filterData.wxincident.branch = $rootScope.user.branch.id;
- }
- api_bpm_data.fetchDataList("wxincident", 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);
- }
- }
- ]);
|