incidentSetUpCtrl.js 54 KB

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