123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893 |
- '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);
- }
- }
- ]);
|