incidentSetUpCtrl.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "$interval", "SweetAlert", "$modal", "Restangular", "api_bpm_data", "api_solution", "api_user_data","api_wechatfile","api_sysinfo","api_statistic","api_bpm","jry_api_bpm", function($rootScope, $scope, $state, $timeout, $interval, SweetAlert, $modal, Restangular, api_bpm_data, api_solution, api_user_data,api_wechatfile,api_sysinfo,api_statistic,api_bpm,jry_api_bpm) {
  2. var loginUser = $rootScope.user;
  3. $scope.xinzeng=false;
  4. $scope.shanchu=false;
  5. $scope.bianji=false;
  6. for(var i=0;i<loginUser.menu.length;i++){
  7. if(loginUser.menu[i].link=="shijianshezhi_xinzeng"){
  8. $scope.xinzeng=true
  9. }
  10. if(loginUser.menu[i].link=="shijianshezhi_shanchu"){
  11. $scope.shanchu=true
  12. }
  13. if(loginUser.menu[i].link=="shijianshezhi_bianji"){
  14. $scope.bianji=true
  15. }
  16. }
  17. $scope.listData=[
  18. {"name":"事件分类"},
  19. {"name":"事件紧急度"},
  20. {"name":"事件影响度"},
  21. {"name":"事件优先级"},
  22. {"name":"优先级规则"},
  23. {"name":"工单权重"},
  24. {"name":"服务级别协议"},
  25. {"name":"事件来源"},
  26. {"name":"关闭代码"},
  27. {"name":"事件状态"},
  28. {"name":"满意度评价"},
  29. {"name":"结果类型"}
  30. ]
  31. $scope.leftListIdx=0;
  32. $scope.leftListName="事件分类";
  33. $scope.leftListCli=function(idx,data){
  34. $scope.leftListIdx=idx;
  35. $scope.leftListName=data.name
  36. }
  37. // 事件分类开始
  38. // $scope.langs=i18nService.getAllLangs();
  39. // $scope.lang = 'zh-cn';
  40. var loginUser = $rootScope.user;
  41. //组
  42. api_user_data.fetchDataList('group', { "idx": 0, "sum": 1000 }).then(function(data) {
  43. $scope.group = data.list;
  44. });
  45. //优先级
  46. // api_bpm_data.fetchDataList('priority', { "idx": 0, "sum": 10 }).then(function(data) {
  47. // $scope.priority = data.list;
  48. // });
  49. api_wechatfile.getDictionary({"key":"incident_priority","type":"list"}).then(function(data){
  50. $scope.priority=data
  51. })
  52. // 工单权重
  53. api_wechatfile.getDictionary({"key":"incident_complexity","type":"list"}).then(function(data){
  54. $scope.complexity=data
  55. })
  56. /* ----- tree----- */
  57. var apple_selected, tree, treedata_avm, treedata_geography;
  58. //$scope.selectedTreeNode = {};ssss
  59. var i = 0;
  60. $scope.out = [];
  61. $scope.outdata = [];
  62. var systemtype = [];
  63. $scope.subdata={};
  64. $scope.addcate = false;
  65. $scope.changecate = false;
  66. // $scope.refreshListData = function(){
  67. // var data ={"idx":0,"sum":1000};
  68. // api_bpm_data.fetchDataList('incidentcategory',data).then(function(response){
  69. // if(response){
  70. // if(response.status=200){
  71. // $scope.outdata = response.list;
  72. // }
  73. // }
  74. // })
  75. // }
  76. // $scope.refreshListData();
  77. $scope.filterTree = function (data,id) {
  78. data = angular.copy(data);
  79. var newTree = data.filter(x => x.id !== id)
  80. newTree.forEach(x => x.children && (x.children = $scope.filterTree(x.children,id)))
  81. return newTree
  82. }
  83. var childdata = {};
  84. $scope.thisParent={};//当前点击节点的父节点
  85. $scope.userOrGroupType={};//当前节点运维组/运维人员
  86. $scope.dataSave = [];//储存$scope.tree_data
  87. $scope.my_tree_handler = function(branch) {
  88. console.log($scope.dataSave)
  89. if($scope.dataSave.length === 0){
  90. $scope.dataSave = angular.copy($scope.tree_data);
  91. }
  92. console.log(branch)
  93. if(branch.parent){
  94. $scope.tree_data = $scope.filterTree($scope.dataSave,branch.id);
  95. console.log($scope.tree_data,'过滤后');
  96. }
  97. $scope.changecate = true;
  98. $scope.addcate = false;
  99. filterData.treeIds = branch.id;
  100. $scope.selectedTreeNode = branch;
  101. $scope.output = branch;
  102. $scope.thisParent=branch.parent||null;
  103. if($scope.thisParent){
  104. $scope.thisParent.label=$scope.thisParent.category;
  105. $scope.thisParent.isExpanded=true;
  106. $scope.thisParent.selected=true;
  107. $scope.subdata['parent']=$scope.thisParent
  108. };
  109. // console.log($scope.thisParent,$scope.subdata)
  110. if(branch.hasPlace==1){
  111. $scope.subdata.hasPlace=true
  112. }else{
  113. $scope.subdata.hasPlace=false
  114. }
  115. convertchildToTree(branch);
  116. console.log(branch)
  117. if(branch.managerUser){
  118. $scope.subdata.managerUser = branch.managerUser
  119. }
  120. if(branch.userOrGroupType){
  121. $scope.userOrGroupType['type']=branch.userOrGroupType;
  122. $scope.userGroupChecked['groupCheck']=branch.group||{};
  123. $scope.userGroupChecked['userCheck']=branch.handleUser||{};
  124. }else{
  125. $scope.userOrGroupType['type']=0;
  126. $scope.userGroupChecked={}
  127. }
  128. // $scope.subdata=branch;
  129. $scope.subdata.category=branch.label;
  130. var eqflag = false;
  131. angular.forEach($scope.outdata, function(item) {
  132. if (item.id == $scope.output.id) eqflag = true;
  133. });
  134. if (eqflag) {
  135. } else {
  136. $scope.outdata.push({
  137. 'name': $scope.output.label,
  138. 'id': $scope.output.id
  139. });
  140. var postData = {
  141. typeList: []
  142. };
  143. if ($scope.outdata.length > 0) {
  144. angular.forEach($scope.outdata, function(data) {
  145. postData.typeList.push({ id: data.id });
  146. })
  147. }
  148. // api_solution.findSolutionTypesUser(postData).then(function(response){
  149. // //Restangular.
  150. // $scope.userdata = response.data;
  151. // });
  152. }
  153. };
  154. $scope.addType = function(element) {
  155. $scope.tree_data = $scope.dataSave.length?angular.copy($scope.dataSave):$scope.tree_data;
  156. $scope.addcate = true
  157. $scope.changecate = false
  158. // var modalInstance = $modal.open({
  159. // templateUrl: 'assets/views/system/tpl/systemclose.html',
  160. // controller: function($scope, $modalInstance, api_bpm_data){
  161. // // api_bpm_data.fetchDataList('closecode',filterData).then(function(data){
  162. // // var myData = Restangular.stripRestangular(data);
  163. // // }
  164. // }
  165. // });
  166. }
  167. /* -----start remove incidet category----- */
  168. $scope.remove = function(element) {
  169. var modalInstance = $modal.open({
  170. templateUrl: 'assets/views/delete.html',
  171. controller: function($scope, scope, $modalInstance, api_bpm_data) {
  172. // $scope.title = '优先级删除';
  173. // $scope.connect = '确定要删除此优先级?';
  174. $scope.title = "事件分类删除?";
  175. $scope.connect = "确定要删除此事件分类?";
  176. $scope.ok = function() {
  177. $modalInstance.close(element);
  178. };
  179. $scope.cancel = function() {
  180. $modalInstance.dismiss('cancel');
  181. };
  182. },
  183. size: 'sm',
  184. resolve: {
  185. scope: function() {
  186. return $scope;
  187. }
  188. }
  189. });
  190. modalInstance.result.then(function(selectedItem) {
  191. if (selectedItem) {
  192. var rmvList = [];
  193. rmvList.push(selectedItem.id);
  194. if (selectedItem.children.length > 0) {
  195. SweetAlert.swal({
  196. title: "删除失败!",
  197. text: "请先删除选中的分类的子级",
  198. type: "error"
  199. })
  200. } else {
  201. api_bpm_data.rmvData('incidentcategory', rmvList).then(function(response) {
  202. if (response.data) {
  203. SweetAlert.swal({
  204. title: "删除成功!",
  205. type: "success",
  206. confirmButtonColor: "#007AFF"
  207. }, function() {
  208. $scope.try_async_load();
  209. $scope.$apply($scope.my_data);
  210. });
  211. } else {
  212. SweetAlert.swal({
  213. title: "操作异常!",
  214. text: "系统异常,请稍后重试,或者联系管理员!",
  215. type: "error"
  216. });
  217. }
  218. })
  219. }
  220. }
  221. })
  222. }
  223. /* -----end remove incidet category----- */
  224. function convertchildToTree(datum) {
  225. $scope.subdata = {};
  226. if (datum.parent) {
  227. $scope.subdata = { 'id': datum.id, 'category': datum.label, 'group': datum.group||{}, 'hasPlace': datum.hasPlace, 'hasSimple': datum.hasSimple, 'priority': datum.priority, 'complexity': datum.complexity, 'parent': datum.parent }
  228. } else {
  229. $scope.subdata = { 'id': datum.id, 'category': datum.label, 'group': datum.group||{}, 'hasSimple': datum.hasSimple, 'hasPlace': datum.hasPlace, 'priority': datum.priority, 'complexity': datum.complexity }
  230. }
  231. }
  232. function convertListToTree(data, treeMap) {
  233. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  234. var root = null; //Initially set our loop to null
  235. //loop over data
  236. for (var i = 0; i < data.length; i++) {
  237. var datum = data[i];
  238. //each node will have children, so let's give it a "children" poperty
  239. datum.children = [];
  240. //add an entry for this node to the map so that any future children can
  241. //lookup the parent
  242. idToNodeMap[datum.id] = datum;
  243. //Does this node have a parent?
  244. // console.log("datum="+JSON.stringify(datum))
  245. if (typeof datum.parent === "undefined") {
  246. //Doesn't look like it, so this node is the root of the tree
  247. root = datum;
  248. treeMap[datum.id] = root;
  249. } else {
  250. //This node has a parent, so let's look it up using the id
  251. parentNode = idToNodeMap[datum.parent.id];
  252. //We don't need this property, so let's delete it.
  253. // delete datum.parent;
  254. //Let's add the current node as a child of the parent node.
  255. parentNode.children.push(datum);
  256. }
  257. }
  258. return root;
  259. }
  260. function convertParentToChildList(data) {
  261. var treeMap = {};
  262. var list = [];
  263. convertListToTree(data, treeMap);
  264. angular.forEach(treeMap, function(item) {
  265. list.push(item);
  266. });
  267. return list;
  268. }
  269. $scope.onFilterCallback = function(item){
  270. // $scope.addcategory.parent=item.label;
  271. $scope.selectedChangeCategory=item;
  272. console.log(item)
  273. }
  274. $scope.parentdata = {};
  275. $scope.try_async_load = function() {
  276. $scope.my_data = [];
  277. $scope.doing_async = true;
  278. var data = { "idx": 0, "sum": 1000 };
  279. api_bpm_data.fetchDataList('incidentcategory', data).then(function(response) {
  280. var data = response.list;
  281. var objects = [];
  282. $scope.parentdata = data;
  283. for (var i = 0; i < data.length; i++) {
  284. var object = {};
  285. object.id = data[i].id;
  286. if (angular.isDefined(data[i].parent)) {
  287. object.parent = data[i].parent;
  288. }
  289. if (angular.isDefined(data[i].hasPlace)) {
  290. object.hasPlace = data[i].hasPlace;
  291. }
  292. if (angular.isDefined(data[i].hasSimple)) {
  293. object.hasSimple = data[i].hasSimple;
  294. }
  295. if (angular.isDefined(data[i].group)) {
  296. object.group = data[i].group||{};
  297. }
  298. if (angular.isDefined(data[i].priority)) {
  299. object.priority = data[i].priority;
  300. }
  301. if (angular.isDefined(data[i].complexity)) {
  302. object.complexity = data[i].complexity;
  303. }
  304. if (angular.isDefined(data[i].handleUser)) {
  305. object.handleUser = data[i].handleUser||{};
  306. }
  307. if(angular.isDefined(data[i].userOrGroupType)){
  308. object.userOrGroupType=data[i].userOrGroupType;
  309. }
  310. if(angular.isDefined(data[i].managerUser)){
  311. object.managerUser=data[i].managerUser||{};
  312. }
  313. object.label = data[i].category;
  314. // object.actions = data[i][3]; //权限部分
  315. // object.group = "1";
  316. // object.user = "2";
  317. object.state = {
  318. "opened": true
  319. };
  320. object.typeName = "type";
  321. // if()
  322. // if (object.actions.indexOf("2") >= 0) { //知识库类型 具有增加权限--系统管理员
  323. $scope.showAddSolutionType = true;
  324. // }
  325. // if (object.actions.indexOf("5") >= 0) { //知识库类型 具有授权权限--系统管理员
  326. $scope.showReviewKnowledgeType = true;
  327. // }
  328. objects.push(object);
  329. }
  330. $scope.my_data = convertParentToChildList(objects);
  331. $scope.tree_data = angular.copy($scope.my_data);
  332. if ($scope.my_data.length > 0) {
  333. $scope.doing_async = false;
  334. }
  335. });
  336. };
  337. $scope.closethis = function(formdata) {
  338. formdata.category = "";
  339. formdata.parent.category = "";
  340. };
  341. /* -----start submit incidet category----- */
  342. $scope.userGroupChecked={};//选中人/组数据
  343. $scope.submitchange = function(formdata) {
  344. // if (formdata.hasArea) {
  345. // formdata.hasArea = 1;
  346. // formdata.hasPlace = 1;
  347. // } else {
  348. // formdata.hasArea = 0;
  349. // formdata.hasPlace = 0;
  350. // }
  351. if (formdata.hasPlace==true) {
  352. formdata.hasPlace = 1;
  353. } else {
  354. formdata.hasPlace = 0;
  355. }
  356. // }
  357. if (formdata.hasSimple == true) {
  358. formdata.hasSimple = 1;
  359. } else {
  360. formdata.hasSimple = 0;
  361. }
  362. // if ($scope.selectedTreeNode.parent) {
  363. // formdata.parent = { "id": $scope.selectedTreeNode.parent.id };
  364. // }
  365. // console.log($scope.thisParent)
  366. if($scope.selectedChangeCategory){
  367. formdata['parentCategory'] ={'id':$scope.selectedChangeCategory.id};
  368. delete formdata.parent
  369. }else if($scope.thisParent){
  370. formdata['parentCategory'] ={'id':$scope.thisParent.id};
  371. delete formdata.parent
  372. }
  373. // console.log(formdata)
  374. if($scope.userOrGroupType.type){
  375. formdata.userOrGroupType=$scope.userOrGroupType.type
  376. }
  377. if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
  378. formdata.group={id:$scope.userGroupChecked.groupCheck.id};
  379. // delete formdata.handleUser;
  380. }
  381. if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
  382. formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
  383. // delete formdata.group;
  384. }
  385. if($scope.subdata.complexity){
  386. formdata.complexity=$scope.subdata.complexity
  387. }
  388. if($scope.subdata.priority){
  389. formdata.priority=$scope.subdata.priority
  390. }
  391. if($scope.subdata.managerUser){
  392. formdata.managerUser=$scope.subdata.managerUser
  393. }
  394. var filedata = { "incidentcategory": formdata }
  395. console.log(filedata);
  396. // return;
  397. api_bpm_data.updData('incidentcategory', filedata).then(function(response) {
  398. if (response) {
  399. if (response.status == 200) {
  400. $scope.try_async_load()
  401. SweetAlert.swal({
  402. title: "修改成功!",
  403. type: "success"
  404. }, function() {
  405. $scope.$apply($scope.my_data);
  406. })
  407. } else {
  408. SweetAlert.swal({
  409. title: "修改失败!",
  410. type: "error"
  411. })
  412. }
  413. }
  414. });
  415. };
  416. $scope.adddata = {};
  417. $scope.addparent = false;
  418. // 新增保存提交
  419. $scope.userGroupCheckedAdd={};//选中人/组数据
  420. $scope.userOrGroupTypeAdd={};//运维组/运维人员
  421. $scope.submitadd = function(formdata) {
  422. console.log(formdata)
  423. // var paret = {};
  424. // var filedata = {};
  425. // filedata = angular.copy(formdata);
  426. // delete filedata.addp
  427. // if (angular.isDefined(formdata.parent) && addparent) {
  428. // angular.forEach($scope.parentdata, function(data) {
  429. // if (formdata.parent.category.id == data.id) {
  430. // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": data.id } } }
  431. // }
  432. // })
  433. // } else {
  434. // filedata = { "incidentcategory": { "category": formdata.category } }
  435. // }
  436. // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": formdata.parentNode.id } } }
  437. // if (formdata.hasArea && formdata.hasArea == true) {
  438. // if (formdata.hasArea) {
  439. // formdata.hasArea = 1;
  440. // formdata.hasPlace = 1;
  441. // } else {
  442. // formdata.hasArea = 0;
  443. // formdata.hasPlace = 0;
  444. // }
  445. if (formdata.hasPlace == true) {
  446. formdata.hasPlace = 1;
  447. } else {
  448. formdata.hasPlace = 0;
  449. }
  450. if (formdata.hasSimple == true) {
  451. formdata.hasSimple = 1;
  452. } else {
  453. formdata.hasSimple = 0;
  454. }
  455. if (formdata.parent) {
  456. formdata['parentCategory'] = { "id": formdata.parent.id };
  457. delete formdata.parent
  458. }
  459. if($scope.userOrGroupTypeAdd.type){
  460. formdata.userOrGroupType=$scope.userOrGroupTypeAdd.type
  461. }
  462. if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.groupCheck){
  463. formdata.group={id:$scope.userGroupCheckedAdd.groupCheck.id};
  464. // delete formdata.handleUser;
  465. }
  466. if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.userCheck){
  467. formdata.handleUser={id:$scope.userGroupCheckedAdd.userCheck.id};
  468. // delete formdata.group;
  469. }
  470. var filedata = { "incidentcategory": formdata }
  471. console.log(filedata);
  472. // return;
  473. api_bpm_data.addData('incidentcategory', filedata).then(function(response) {
  474. if (response) {
  475. if (response.status == 200) {
  476. $scope.userdata = [];
  477. $scope.outdata = [];
  478. $scope.try_async_load();
  479. SweetAlert.swal({
  480. title: "增加成功!",
  481. type: "success"
  482. })
  483. } else if (response.status == 408) {
  484. SweetAlert.swal({
  485. title: "增加失败!",
  486. text: response.error,
  487. type: "error"
  488. })
  489. } else {
  490. SweetAlert.swal({
  491. title: "增加失败!",
  492. type: "error"
  493. })
  494. }
  495. }
  496. });
  497. };
  498. /* -----end submit incidet category----- */
  499. $scope.try_async_load();
  500. // $scope.ldloading={};
  501. var filterData = {
  502. key: 'null',
  503. status: 0,
  504. pageIndex: 0,
  505. pageSum: 10,
  506. //treeIds:'[]',
  507. userId: loginUser.id
  508. }
  509. // 事件分类结束
  510. // 事件紧急度开始
  511. $scope.incident_emergencyData=[];
  512. $scope.getIncident_emergency=function(){
  513. var data={
  514. "key":"incident_emergency",
  515. "type":"list"
  516. }
  517. api_wechatfile.getDictionary(data).then(function(res){
  518. $scope.incident_emergencyData=res;
  519. })
  520. }
  521. $scope.getIncident_emergency();
  522. $scope.incident_emergencySave=function(){
  523. for(var i=0;i<$scope.incident_emergencyData.length;i++){
  524. api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
  525. })
  526. }
  527. SweetAlert.swal({
  528. title: "保存成功!",
  529. type: "success",
  530. confirmButtonColor: "#007AFF"
  531. });
  532. $timeout(function(){
  533. $scope.getIncident_emergency();
  534. },2000)
  535. }
  536. $scope.incident_emergencyReturn=function(){
  537. $scope.incident_emergencyData[0].name="紧急";
  538. $scope.incident_emergencyData[1].name="高";
  539. $scope.incident_emergencyData[2].name="中";
  540. $scope.incident_emergencyData[3].name="低";
  541. for(var i=0;i<$scope.incident_emergencyData.length;i++){
  542. api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
  543. })
  544. }
  545. SweetAlert.swal({
  546. title: "恢复成功!",
  547. type: "success",
  548. confirmButtonColor: "#007AFF"
  549. });
  550. $timeout(function(){
  551. $scope.getIncident_emergency();
  552. },2000)
  553. }
  554. // 事件紧急度结束
  555. // 事件影响度开始
  556. $scope.incident_influenceData=[];
  557. $scope.getIncident_influence=function(){
  558. var data={
  559. "key":"incident_influence",
  560. "type":"list"
  561. }
  562. api_wechatfile.getDictionary(data).then(function(res){
  563. $scope.incident_influenceData=res;
  564. })
  565. }
  566. $scope.getIncident_influence();
  567. $scope.incident_influenceSave=function(){
  568. for(var i=0;i<$scope.incident_influenceData.length;i++){
  569. api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
  570. })
  571. }
  572. SweetAlert.swal({
  573. title: "保存成功!",
  574. type: "success",
  575. confirmButtonColor: "#007AFF"
  576. });
  577. $timeout(function(){
  578. $scope.getIncident_influence();
  579. },2000)
  580. }
  581. $scope.incident_influenceReturn=function(){
  582. $scope.incident_influenceData[0].name="高";
  583. $scope.incident_influenceData[1].name="中";
  584. $scope.incident_influenceData[2].name="低";
  585. for(var i=0;i<$scope.incident_influenceData.length;i++){
  586. api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
  587. })
  588. }
  589. SweetAlert.swal({
  590. title: "恢复成功!",
  591. type: "success",
  592. confirmButtonColor: "#007AFF"
  593. });
  594. $timeout(function(){
  595. $scope.getIncident_influence();
  596. },2000)
  597. }
  598. // 事件影响度结束
  599. // 事件状态开始
  600. $scope.incident_classificationData=[];
  601. $scope.getIncident_classification=function(){
  602. var data={
  603. "key":"incident_status",
  604. "type":"list"
  605. }
  606. api_wechatfile.getDictionary(data).then(function(res){
  607. $scope.incident_classificationData=res;
  608. })
  609. }
  610. $scope.getIncident_classification();
  611. $scope.incident_classificationSave=function(){
  612. for(var i=0;i<$scope.incident_classificationData.length;i++){
  613. api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
  614. })
  615. }
  616. SweetAlert.swal({
  617. title: "保存成功!",
  618. type: "success",
  619. confirmButtonColor: "#007AFF"
  620. });
  621. $timeout(function(){
  622. $scope.getIncident_classification();
  623. },2000)
  624. }
  625. $scope.incident_classificationReturn=function(){
  626. $scope.incident_classificationData[0].name="待接单";
  627. $scope.incident_classificationData[1].name="处理中";
  628. $scope.incident_classificationData[2].name="已解决";
  629. $scope.incident_classificationData[3].name="已关闭";
  630. $scope.incident_classificationData[4].name="暂存";
  631. $scope.incident_classificationData[5].name="重新指派";
  632. for(var i=0;i<$scope.incident_classificationData.length;i++){
  633. api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
  634. })
  635. }
  636. SweetAlert.swal({
  637. title: "恢复成功!",
  638. type: "success",
  639. confirmButtonColor: "#007AFF"
  640. });
  641. $timeout(function(){
  642. $scope.getIncident_classification();
  643. },2000)
  644. }
  645. // 事件状态结束
  646. // 满意度评价开始
  647. $scope.incident_evaluateData=[];
  648. $scope.getIncident_evaluate=function(){
  649. var data={
  650. "key":"incident_degree",
  651. "type":"list"
  652. }
  653. api_wechatfile.getDictionary(data).then(function(res){
  654. $scope.incident_evaluateData=res;
  655. })
  656. }
  657. $scope.getIncident_evaluate();
  658. $scope.incident_evaluateSave=function(){
  659. for(var i=0;i<$scope.incident_evaluateData.length;i++){
  660. api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
  661. })
  662. }
  663. SweetAlert.swal({
  664. title: "保存成功!",
  665. type: "success",
  666. confirmButtonColor: "#007AFF"
  667. });
  668. $timeout(function(){
  669. $scope.getIncident_evaluate();
  670. },2000)
  671. }
  672. $scope.incident_evaluateReturn=function(){
  673. $scope.incident_evaluateData[0].name="非常满意";
  674. $scope.incident_evaluateData[1].name="较满意";
  675. $scope.incident_evaluateData[2].name="满意";
  676. $scope.incident_evaluateData[3].name="一般";
  677. $scope.incident_evaluateData[4].name="不满意";
  678. for(var i=0;i<$scope.incident_evaluateData.length;i++){
  679. api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
  680. })
  681. }
  682. SweetAlert.swal({
  683. title: "恢复成功!",
  684. type: "success",
  685. confirmButtonColor: "#007AFF"
  686. });
  687. $timeout(function(){
  688. $scope.getIncident_evaluate();
  689. },2000)
  690. }
  691. // 满意度评价结束
  692. // 结果类型开始
  693. $scope.incident_resultData=[];
  694. $scope.getIncident_result=function(){
  695. var data={
  696. "key":"incident_handleresult",
  697. "type":"list"
  698. }
  699. api_wechatfile.getDictionary(data).then(function(res){
  700. $scope.incident_resultData=res;
  701. })
  702. }
  703. $scope.getIncident_result();
  704. $scope.incident_resultSave=function(){
  705. for(var i=0;i<$scope.incident_resultData.length;i++){
  706. api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
  707. })
  708. }
  709. SweetAlert.swal({
  710. title: "保存成功!",
  711. type: "success",
  712. confirmButtonColor: "#007AFF"
  713. });
  714. $timeout(function(){
  715. $scope.getIncident_result();
  716. },2000)
  717. }
  718. $scope.incident_resultReturn=function(){
  719. $scope.incident_resultData[0].name="全部解决";
  720. $scope.incident_resultData[1].name="部分解决";
  721. $scope.incident_resultData[2].name="未解决";
  722. $scope.incident_resultData[3].name="其它";
  723. for(var i=0;i<$scope.incident_resultData.length;i++){
  724. api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
  725. })
  726. }
  727. SweetAlert.swal({
  728. title: "恢复成功!",
  729. type: "success",
  730. confirmButtonColor: "#007AFF"
  731. });
  732. $timeout(function(){
  733. $scope.getIncident_result();
  734. },2000)
  735. }
  736. // 结果类型结束
  737. // 事件优先级开始
  738. $scope.incident_priorityData=[];
  739. $scope.getIncident_priority=function(){
  740. var data={
  741. "key":"incident_priority",
  742. "type":"list"
  743. }
  744. api_wechatfile.getDictionary(data).then(function(res){
  745. $scope.incident_priorityData=res;
  746. })
  747. }
  748. $scope.getIncident_priority();
  749. $scope.incident_prioritySave=function(){
  750. for(var i=0;i<$scope.incident_priorityData.length;i++){
  751. api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
  752. })
  753. }
  754. SweetAlert.swal({
  755. title: "保存成功!",
  756. type: "success",
  757. confirmButtonColor: "#007AFF"
  758. });
  759. $timeout(function(){
  760. $scope.getIncident_priority();
  761. },2000)
  762. }
  763. $scope.incident_priorityReturn=function(){
  764. $scope.incident_priorityData[0].name="重大";
  765. $scope.incident_priorityData[1].name="高";
  766. $scope.incident_priorityData[2].name="较高";
  767. $scope.incident_priorityData[3].name="普通";
  768. for(var i=0;i<$scope.incident_priorityData.length;i++){
  769. api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
  770. })
  771. }
  772. SweetAlert.swal({
  773. title: "恢复成功!",
  774. type: "success",
  775. confirmButtonColor: "#007AFF"
  776. });
  777. $timeout(function(){
  778. $scope.getIncident_priority();
  779. },2000)
  780. }
  781. // 事件优先级结束
  782. // 事件工单权重开始
  783. $scope.incident_complexityData=[];
  784. $scope.getIncident_complexity=function(){
  785. var data={
  786. "key":"incident_complexity",
  787. "type":"list"
  788. }
  789. api_wechatfile.getDictionary(data).then(function(res){
  790. $scope.incident_complexityData=res;
  791. })
  792. }
  793. $scope.getIncident_complexity();
  794. $scope.incident_complexitySave=function(){
  795. for(var i=0;i<$scope.incident_complexityData.length;i++){
  796. api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
  797. })
  798. }
  799. SweetAlert.swal({
  800. title: "保存成功!",
  801. type: "success",
  802. confirmButtonColor: "#007AFF"
  803. });
  804. $timeout(function(){
  805. $scope.getIncident_complexity();
  806. },2000)
  807. }
  808. // 没有恢复默认
  809. // $scope.incident_complexityReturn=function(){
  810. // $scope.incident_complexityData[0].name="重大";
  811. // $scope.incident_complexityData[1].name="高";
  812. // $scope.incident_complexityData[2].name="较高";
  813. // $scope.incident_complexityData[3].name="普通";
  814. // for(var i=0;i<$scope.incident_complexityData.length;i++){
  815. // api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
  816. // })
  817. // }
  818. // SweetAlert.swal({
  819. // title: "恢复成功!",
  820. // type: "success",
  821. // confirmButtonColor: "#007AFF"
  822. // });
  823. // $timeout(function(){
  824. // $scope.getIncident_complexity();
  825. // },2000)
  826. // }
  827. // 事件工单权重结束
  828. // 服务级别协议开始
  829. $scope.incident_SLA_Data=[];
  830. $scope.getIncident_SLA=function(){
  831. var data={
  832. "idx":0,
  833. "sum":10
  834. };
  835. jry_api_bpm.jry_getFetchDataList(data,"servicelevelagreement").then(function(res){
  836. $scope.incident_SLA_Data=res.list
  837. })
  838. };
  839. $scope.getIncident_SLA();
  840. $scope.incident_SLASave=function(){
  841. for(var i=0;i<$scope.incident_SLA_Data.length;i++){
  842. $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
  843. $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
  844. var data={
  845. "servicelevelagreement":$scope.incident_SLA_Data[i]
  846. }
  847. jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
  848. })
  849. SweetAlert.swal({
  850. title: "保存成功!",
  851. type: "success",
  852. confirmButtonColor: "#007AFF"
  853. });
  854. $timeout(function(){
  855. $scope.getIncident_SLA();
  856. },2000)
  857. }
  858. }
  859. $scope.incident_SLAReturn=function(){
  860. $scope.incident_SLA_Data[0].resolveTime=450;
  861. $scope.incident_SLA_Data[1].resolveTime=480;
  862. $scope.incident_SLA_Data[2].resolveTime=480;
  863. $scope.incident_SLA_Data[3].resolveTime=960;
  864. $scope.incident_SLA_Data[0].responseTime=30;
  865. $scope.incident_SLA_Data[1].responseTime=45;
  866. $scope.incident_SLA_Data[2].responseTime=60;
  867. $scope.incident_SLA_Data[3].responseTime=240;
  868. for(var i=0;i<$scope.incident_SLA_Data.length;i++){
  869. $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
  870. $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
  871. var data={
  872. "servicelevelagreement":$scope.incident_SLA_Data[i]
  873. }
  874. jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
  875. })
  876. SweetAlert.swal({
  877. title: "保存成功!",
  878. type: "success",
  879. confirmButtonColor: "#007AFF"
  880. });
  881. $timeout(function(){
  882. $scope.getIncident_SLA();
  883. },2000)
  884. }
  885. }
  886. // 服务级别协议结束
  887. // 事件来源开始
  888. $scope.incident_sourceData=[];
  889. $scope.getIncident_source=function(){
  890. var data={
  891. "key":"incident_source",
  892. "type":"list"
  893. }
  894. api_wechatfile.getDictionary(data).then(function(res){
  895. $scope.incident_sourceData=res;
  896. })
  897. }
  898. $scope.getIncident_source();
  899. $scope.incident_sourceSave=function(){
  900. for(var i=0;i<$scope.incident_sourceData.length;i++){
  901. api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
  902. })
  903. }
  904. SweetAlert.swal({
  905. title: "保存成功!",
  906. type: "success",
  907. confirmButtonColor: "#007AFF"
  908. });
  909. $timeout(function(){
  910. $scope.getIncident_source();
  911. },2000)
  912. }
  913. $scope.incident_sourceReturn=function(){
  914. $scope.incident_sourceData[0].name="电话";
  915. $scope.incident_sourceData[1].name="留言";
  916. $scope.incident_sourceData[2].name="微信/web";
  917. $scope.incident_sourceData[3].name="主动发现";
  918. $scope.incident_sourceData[4].name="领导指派";
  919. $scope.incident_sourceData[5].name="其他";
  920. $scope.incident_sourceData[0].value="phone";
  921. $scope.incident_sourceData[1].value="record";
  922. $scope.incident_sourceData[2].value="im";
  923. $scope.incident_sourceData[3].value="discover";
  924. $scope.incident_sourceData[4].value="leader";
  925. $scope.incident_sourceData[5].value="other";
  926. for(var i=0;i<$scope.incident_sourceData.length;i++){
  927. api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
  928. })
  929. }
  930. SweetAlert.swal({
  931. title: "恢复成功!",
  932. type: "success",
  933. confirmButtonColor: "#007AFF"
  934. });
  935. $timeout(function(){
  936. $scope.getIncident_source();
  937. },2000)
  938. }
  939. // 事件来源结束
  940. // 关闭代码开始
  941. $scope.incident_closecodeData=[];
  942. $scope.getIncident_closecode=function(){
  943. var data={
  944. "key":"incident_closecode",
  945. "type":"list"
  946. }
  947. api_wechatfile.getDictionary(data).then(function(res){
  948. $scope.incident_closecodeData=res;
  949. })
  950. }
  951. $scope.getIncident_closecode();
  952. $scope.incident_closecodeSave=function(){
  953. for(var i=0;i<$scope.incident_closecodeData.length;i++){
  954. api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
  955. })
  956. }
  957. SweetAlert.swal({
  958. title: "保存成功!",
  959. type: "success",
  960. confirmButtonColor: "#007AFF"
  961. });
  962. $timeout(function(){
  963. $scope.getIncident_closecode();
  964. },2000)
  965. }
  966. $scope.incident_closecodeReturn=function(){
  967. $scope.incident_closecodeData[0].value="060";
  968. $scope.incident_closecodeData[1].value="061";
  969. $scope.incident_closecodeData[2].value="062";
  970. $scope.incident_closecodeData[3].value="063";
  971. $scope.incident_closecodeData[4].value="064";
  972. $scope.incident_closecodeData[5].value="065";
  973. $scope.incident_closecodeData[0].desc="事件已经完全解决";
  974. $scope.incident_closecodeData[1].desc="事件未能完全解决";
  975. $scope.incident_closecodeData[2].desc="由服务提供商对事件进行处理";
  976. $scope.incident_closecodeData[3].desc="事件自行消失";
  977. $scope.incident_closecodeData[4].desc="事件请求不在服务范围内";
  978. $scope.incident_closecodeData[5].desc="通过问题或变更流程处理";
  979. $scope.incident_closecodeData[0].desc="完全解决";
  980. $scope.incident_closecodeData[1].desc="临时解决";
  981. $scope.incident_closecodeData[2].desc="供应商解决";
  982. $scope.incident_closecodeData[3].desc="事件消失";
  983. $scope.incident_closecodeData[4].desc="拒绝";
  984. $scope.incident_closecodeData[5].desc="进入其他流程处理";
  985. for(var i=0;i<$scope.incident_closecodeData.length;i++){
  986. api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
  987. })
  988. }
  989. SweetAlert.swal({
  990. title: "恢复成功!",
  991. type: "success",
  992. confirmButtonColor: "#007AFF"
  993. });
  994. $timeout(function(){
  995. $scope.getIncident_closecode();
  996. },2000)
  997. }
  998. // 关闭代码结束
  999. // 优先级规则开始
  1000. $scope.incident_prioritymatrixAdd=function(){
  1001. var modalInstance = $modal.open({
  1002. templateUrl: 'assets/views/system/tpl/systemprioritymatrix.html',
  1003. controller: function($scope, $modalInstance, api_bpm_data) {
  1004. $scope.prioritymatrixdata={};
  1005. var prioritymatrixInfluenceData={
  1006. "key":"incident_influence",
  1007. "type":"list"
  1008. }
  1009. $scope.prioritymatrixInfluenceData=[];
  1010. api_wechatfile.getDictionary(prioritymatrixInfluenceData).then(function(res){
  1011. $scope.prioritymatrixInfluenceData=res;
  1012. })
  1013. var prioritymatrixEmergencyData={
  1014. "key":"incident_emergency",
  1015. "type":"list"
  1016. }
  1017. $scope.prioritymatrixEmergencyData=[];
  1018. api_wechatfile.getDictionary(prioritymatrixEmergencyData).then(function(res){
  1019. $scope.prioritymatrixEmergencyData=res;
  1020. })
  1021. var prioritymatrixPriorityData={
  1022. "key":"incident_priority",
  1023. "type":"list"
  1024. }
  1025. $scope.prioritymatrixPriorityData=[];
  1026. api_wechatfile.getDictionary(prioritymatrixPriorityData).then(function(res){
  1027. $scope.prioritymatrixPriorityData=res;
  1028. })
  1029. $scope.cancel = function() {
  1030. $modalInstance.dismiss('cancel');
  1031. };
  1032. $scope.savercode = function(prioritymatrixdata) {
  1033. $modalInstance.close(prioritymatrixdata);
  1034. };
  1035. }
  1036. });
  1037. modalInstance.result.then(function(selectedItem) {
  1038. // console.log('selectedItem='+JSON.stringify(selectedItem));
  1039. if (selectedItem) {
  1040. console.log(selectedItem);
  1041. var fildata = { "prioritymatrix": { "priority": { "id": selectedItem.priority.id }, "emergency": { "id": selectedItem.emergency.id }, "influence": { "id": selectedItem.influence.id } } }
  1042. api_bpm_data.addData('prioritymatrix', fildata).then(function(response) {
  1043. if (response) {
  1044. if (response.status == 200) {
  1045. SweetAlert.swal({
  1046. title: "新增成功!",
  1047. type: "success"
  1048. }, function() {
  1049. $scope.getPrioritymatrix()
  1050. })
  1051. } else {
  1052. SweetAlert.swal({
  1053. title: "新增失败!",
  1054. text: "已有此类优先级规则!",
  1055. type: "error"
  1056. })
  1057. }
  1058. }
  1059. })
  1060. }
  1061. });
  1062. }
  1063. $scope.prioritymatrixData=[];
  1064. $scope.getPrioritymatrix=function(){
  1065. var data={
  1066. "idx":0,
  1067. "sum":999
  1068. }
  1069. api_statistic.tableData(data,"prioritymatrix").then(function(res){
  1070. $scope.prioritymatrixData=res.list
  1071. })
  1072. }
  1073. $scope.incident_prioritymatrixSave=function(){
  1074. SweetAlert.swal({
  1075. title: "修改成功!",
  1076. type: "success"
  1077. })
  1078. for(var i=0;i<$scope.prioritymatrixData.length;i++){
  1079. api_bpm.updData("prioritymatrix",{"prioritymatrix":$scope.prioritymatrixData[i]}).then(function(res){
  1080. if(res.status!=200){
  1081. SweetAlert.swal({
  1082. title: "修改失败!",
  1083. text: "已有此类优先级规则,或者规则不合理!",
  1084. type: "error"
  1085. })
  1086. }
  1087. })
  1088. }
  1089. $timeout(function(){
  1090. $scope.getPrioritymatrix()
  1091. },2000)
  1092. }
  1093. $scope.removePrioritymatrix=function(data){
  1094. SweetAlert.swal({
  1095. title: "确认删除?",
  1096. text: "删除的数据不可恢复,请确认继续操作!",
  1097. type: "warning",
  1098. showCancelButton: true,
  1099. confirmButtonColor: "#DD6B55",
  1100. confirmButtonText: "继续删除",
  1101. cancelButtonText: "取消操作",
  1102. closeOnConfirm: false,
  1103. closeOnCancel: false
  1104. }, function (isConfirm) {
  1105. if (isConfirm) {
  1106. api_bpm_data.rmvData("prioritymatrix",[data.id]).then(function(res){
  1107. console.log(res);
  1108. if(res.status==200){
  1109. SweetAlert.swal({
  1110. title: "删除成功!",
  1111. type: "success",
  1112. confirmButtonColor: "#007AFF"
  1113. }, function() {
  1114. $scope.getPrioritymatrix()
  1115. });
  1116. }else{
  1117. SweetAlert.swal({
  1118. title: "删除失败",
  1119. text: "系统错误,请稍后重试!",
  1120. type: "error",
  1121. confirmButtonColor: "#DD6B55"
  1122. });
  1123. }
  1124. })
  1125. } else {
  1126. SweetAlert.swal("操作取消", "数据安全", "error");
  1127. }
  1128. });
  1129. }
  1130. $scope.getPrioritymatrix()
  1131. // 优先级规则结束
  1132. // 获取组数据
  1133. $scope.getGroupList=function(){
  1134. var postData={
  1135. idx: 0,
  1136. sum: 1000,
  1137. group: {selectType: "nouser"}
  1138. }
  1139. api_user_data.fetchDataList('group',postData).then(res=>{
  1140. $scope.groupList=res.list;
  1141. })
  1142. }
  1143. $scope.getGroupList()
  1144. // 获取人数据
  1145. $scope.getUserList=function(){
  1146. var postData={
  1147. idx: 0,
  1148. sum: 1000,
  1149. user: {
  1150. name:'',
  1151. selectType: "pinyin_qs",
  1152. }
  1153. }
  1154. api_user_data.fetchDataList('user',postData).then(res=>{
  1155. $scope.userList=res.list;
  1156. })
  1157. }
  1158. $scope.getUserList()
  1159. // 获取事件分类人员
  1160. $scope.getUserList1=function(){
  1161. var postData={
  1162. idx: 0,
  1163. sum: 1000,
  1164. user: {
  1165. name:'',
  1166. selectType: "pinyin_qs",
  1167. roledata:{
  1168. rolecode:'incident-category-manager'
  1169. }
  1170. }
  1171. }
  1172. api_user_data.fetchDataList('user',postData).then(res=>{
  1173. $scope.userList1=res.list;
  1174. })
  1175. }
  1176. $scope.getUserList1()
  1177. }]);