incidentSetUpCtrl.js 44 KB

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