incidentSetUpCtrl.js 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  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_bpm_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. type: "error"
  564. })
  565. }
  566. }
  567. });
  568. };
  569. $scope.submit1change = function(formdata) {
  570. console.log($scope.output)
  571. if($scope.selectedChangeCategory){
  572. formdata['parent'] ={'id':$scope.selectedChangeCategory.id};
  573. }else if($scope.thisParent){
  574. formdata['parent'] ={'id':$scope.thisParent.id};
  575. }
  576. if($scope.group_user.offlineGroup&&$scope.group_user.offlineGroup.id){
  577. formdata.group={id:$scope.group_user.offlineGroup.id};
  578. }
  579. if($scope.group_user.onlineUser&&$scope.group_user.onlineUser.id){
  580. formdata.user={id:$scope.group_user.onlineUser.id};
  581. }
  582. // if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
  583. // formdata.group={id:$scope.userGroupChecked.groupCheck.id};
  584. // }
  585. // if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
  586. // formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
  587. // }
  588. // if($scope.subdata.complexity){
  589. // formdata.complexity=$scope.subdata.complexity
  590. // }
  591. // if($scope.subdata.priority){
  592. // formdata.priority=$scope.subdata.priority
  593. // }
  594. // if($scope.subdata.managerUser){
  595. // formdata.managerUser=$scope.subdata.managerUser
  596. // }
  597. var filedata = { "inspectionType": formdata }
  598. console.log(filedata,$scope.group_user);
  599. // return;
  600. api_bpm_data.updData('inspectionType', filedata).then(function(response) {
  601. if (response) {
  602. if (response.status == 200) {
  603. $scope.try_async_1load()
  604. SweetAlert.swal({
  605. title: "修改成功!",
  606. type: "success"
  607. }, function() {
  608. $scope.$apply($scope.my_1data);
  609. })
  610. } else {
  611. SweetAlert.swal({
  612. title: "修改失败!",
  613. type: "error"
  614. })
  615. }
  616. }
  617. });
  618. };
  619. $scope.adddata = {};
  620. $scope.add1data = {};
  621. $scope.addparent = false;
  622. // 新增保存提交
  623. $scope.userGroupCheckedAdd={};//选中人/组数据
  624. $scope.group_user_Add={};//选中人/组数据
  625. $scope.userOrGroupTypeAdd={};//运维组/运维人员
  626. $scope.submitadd = function(formdata) {
  627. console.log(formdata)
  628. // var paret = {};
  629. // var filedata = {};
  630. // filedata = angular.copy(formdata);
  631. // delete filedata.addp
  632. // if (angular.isDefined(formdata.parent) && addparent) {
  633. // angular.forEach($scope.parentdata, function(data) {
  634. // if (formdata.parent.category.id == data.id) {
  635. // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": data.id } } }
  636. // }
  637. // })
  638. // } else {
  639. // filedata = { "incidentcategory": { "category": formdata.category } }
  640. // }
  641. // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": formdata.parentNode.id } } }
  642. // if (formdata.hasArea && formdata.hasArea == true) {
  643. // if (formdata.hasArea) {
  644. // formdata.hasArea = 1;
  645. // formdata.hasPlace = 1;
  646. // } else {
  647. // formdata.hasArea = 0;
  648. // formdata.hasPlace = 0;
  649. // }
  650. if (formdata.hasPlace == true) {
  651. formdata.hasPlace = 1;
  652. } else {
  653. formdata.hasPlace = 0;
  654. }
  655. if (formdata.hasSimple == true) {
  656. formdata.hasSimple = 1;
  657. } else {
  658. formdata.hasSimple = 0;
  659. }
  660. if (formdata.parent) {
  661. formdata['parentCategory'] = { "id": formdata.parent.id };
  662. delete formdata.parent
  663. }
  664. if($scope.userOrGroupTypeAdd.type){
  665. formdata.userOrGroupType=$scope.userOrGroupTypeAdd.type
  666. }
  667. if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.groupCheck){
  668. formdata.group={id:$scope.userGroupCheckedAdd.groupCheck.id};
  669. // delete formdata.handleUser;
  670. }
  671. if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.userCheck){
  672. formdata.handleUser={id:$scope.userGroupCheckedAdd.userCheck.id};
  673. // delete formdata.group;
  674. }
  675. var filedata = { "incidentcategory": formdata }
  676. console.log(filedata);
  677. // return;
  678. api_bpm_data.addData('incidentcategory', filedata).then(function(response) {
  679. if (response) {
  680. if (response.status == 200) {
  681. $scope.userdata = [];
  682. $scope.outdata = [];
  683. $scope.try_async_load();
  684. SweetAlert.swal({
  685. title: "增加成功!",
  686. type: "success"
  687. })
  688. } else if (response.status == 408) {
  689. SweetAlert.swal({
  690. title: "增加失败!",
  691. text: response.error,
  692. type: "error"
  693. })
  694. } else {
  695. SweetAlert.swal({
  696. title: "增加失败!",
  697. type: "error"
  698. })
  699. }
  700. }
  701. });
  702. };
  703. $scope.submit1add = function(formdata) {//lmm
  704. console.log(formdata)
  705. if($scope.group_user_Add&&$scope.group_user_Add.group&&$scope.group_user_Add.group.id){
  706. formdata.group={id:$scope.group_user_Add.group.id};
  707. }
  708. if($scope.group_user_Add&&$scope.group_user_Add.user&&$scope.group_user_Add.user.id){
  709. formdata.user={id:$scope.group_user_Add.user.id};
  710. }
  711. formdata.deleteFlag = 0;
  712. formdata.formUiName = 'inspection_LinHu_detail';
  713. formdata.formUiEdit = 'inspection_LinHu_confirm';
  714. formdata.processKey = 'bpm_inspection';
  715. var filedata = { "inspectionType": formdata }
  716. console.log(filedata);
  717. // return;
  718. api_bpm_data.addData('inspectionType', filedata).then(function(response) {
  719. if (response) {
  720. if (response.status == 200) {
  721. $scope.userdata = [];
  722. $scope.outdata = [];
  723. $scope.try_async_1load();
  724. SweetAlert.swal({
  725. title: "增加成功!",
  726. type: "success"
  727. })
  728. } else if (response.status == 408) {
  729. SweetAlert.swal({
  730. title: "增加失败!",
  731. text: response.error,
  732. type: "error"
  733. })
  734. } else {
  735. SweetAlert.swal({
  736. title: "增加失败!",
  737. type: "error"
  738. })
  739. }
  740. }
  741. });
  742. };
  743. /* -----end submit incidet category----- */
  744. $scope.try_async_load();
  745. $scope.try_async_1load();
  746. // $scope.ldloading={};
  747. var filterData = {
  748. key: 'null',
  749. status: 0,
  750. pageIndex: 0,
  751. pageSum: 10,
  752. //treeIds:'[]',
  753. userId: loginUser.id
  754. }
  755. // 事件分类结束
  756. // 事件紧急度开始
  757. $scope.incident_emergencyData=[];
  758. $scope.getIncident_emergency=function(){
  759. var data={
  760. "key":"incident_emergency",
  761. "type":"list"
  762. }
  763. api_wechatfile.getDictionary(data).then(function(res){
  764. $scope.incident_emergencyData=res;
  765. })
  766. }
  767. $scope.getIncident_emergency();
  768. $scope.incident_emergencySave=function(){
  769. for(var i=0;i<$scope.incident_emergencyData.length;i++){
  770. api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
  771. })
  772. }
  773. SweetAlert.swal({
  774. title: "保存成功!",
  775. type: "success",
  776. confirmButtonColor: "#007AFF"
  777. });
  778. $timeout(function(){
  779. $scope.getIncident_emergency();
  780. },2000)
  781. }
  782. $scope.incident_emergencyReturn=function(){
  783. $scope.incident_emergencyData[0].name="紧急";
  784. $scope.incident_emergencyData[1].name="高";
  785. $scope.incident_emergencyData[2].name="中";
  786. $scope.incident_emergencyData[3].name="低";
  787. for(var i=0;i<$scope.incident_emergencyData.length;i++){
  788. api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
  789. })
  790. }
  791. SweetAlert.swal({
  792. title: "恢复成功!",
  793. type: "success",
  794. confirmButtonColor: "#007AFF"
  795. });
  796. $timeout(function(){
  797. $scope.getIncident_emergency();
  798. },2000)
  799. }
  800. // 事件紧急度结束
  801. // 事件影响度开始
  802. $scope.incident_influenceData=[];
  803. $scope.getIncident_influence=function(){
  804. var data={
  805. "key":"incident_influence",
  806. "type":"list"
  807. }
  808. api_wechatfile.getDictionary(data).then(function(res){
  809. $scope.incident_influenceData=res;
  810. })
  811. }
  812. $scope.getIncident_influence();
  813. $scope.incident_influenceSave=function(){
  814. for(var i=0;i<$scope.incident_influenceData.length;i++){
  815. api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
  816. })
  817. }
  818. SweetAlert.swal({
  819. title: "保存成功!",
  820. type: "success",
  821. confirmButtonColor: "#007AFF"
  822. });
  823. $timeout(function(){
  824. $scope.getIncident_influence();
  825. },2000)
  826. }
  827. $scope.incident_influenceReturn=function(){
  828. $scope.incident_influenceData[0].name="高";
  829. $scope.incident_influenceData[1].name="中";
  830. $scope.incident_influenceData[2].name="低";
  831. for(var i=0;i<$scope.incident_influenceData.length;i++){
  832. api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
  833. })
  834. }
  835. SweetAlert.swal({
  836. title: "恢复成功!",
  837. type: "success",
  838. confirmButtonColor: "#007AFF"
  839. });
  840. $timeout(function(){
  841. $scope.getIncident_influence();
  842. },2000)
  843. }
  844. // 事件影响度结束
  845. // 事件状态开始
  846. $scope.incident_classificationData=[];
  847. $scope.getIncident_classification=function(){
  848. var data={
  849. "key":"incident_status",
  850. "type":"list"
  851. }
  852. api_wechatfile.getDictionary(data).then(function(res){
  853. $scope.incident_classificationData=res;
  854. })
  855. }
  856. $scope.getIncident_classification();
  857. $scope.incident_classificationSave=function(){
  858. for(var i=0;i<$scope.incident_classificationData.length;i++){
  859. api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
  860. })
  861. }
  862. SweetAlert.swal({
  863. title: "保存成功!",
  864. type: "success",
  865. confirmButtonColor: "#007AFF"
  866. });
  867. $timeout(function(){
  868. $scope.getIncident_classification();
  869. },2000)
  870. }
  871. $scope.incident_classificationReturn=function(){
  872. $scope.incident_classificationData[0].name="待接单";
  873. $scope.incident_classificationData[1].name="处理中";
  874. $scope.incident_classificationData[2].name="已解决";
  875. $scope.incident_classificationData[3].name="已关闭";
  876. $scope.incident_classificationData[4].name="暂存";
  877. $scope.incident_classificationData[5].name="重新指派";
  878. for(var i=0;i<$scope.incident_classificationData.length;i++){
  879. api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
  880. })
  881. }
  882. SweetAlert.swal({
  883. title: "恢复成功!",
  884. type: "success",
  885. confirmButtonColor: "#007AFF"
  886. });
  887. $timeout(function(){
  888. $scope.getIncident_classification();
  889. },2000)
  890. }
  891. // 事件状态结束
  892. // 满意度评价开始
  893. $scope.incident_evaluateData=[];
  894. $scope.getIncident_evaluate=function(){
  895. var data={
  896. "key":"incident_degree",
  897. "type":"list"
  898. }
  899. api_wechatfile.getDictionary(data).then(function(res){
  900. $scope.incident_evaluateData=res;
  901. })
  902. }
  903. $scope.getIncident_evaluate();
  904. $scope.incident_evaluateSave=function(){
  905. for(var i=0;i<$scope.incident_evaluateData.length;i++){
  906. api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
  907. })
  908. }
  909. SweetAlert.swal({
  910. title: "保存成功!",
  911. type: "success",
  912. confirmButtonColor: "#007AFF"
  913. });
  914. $timeout(function(){
  915. $scope.getIncident_evaluate();
  916. },2000)
  917. }
  918. $scope.incident_evaluateReturn=function(){
  919. $scope.incident_evaluateData[0].name="非常满意";
  920. $scope.incident_evaluateData[1].name="较满意";
  921. $scope.incident_evaluateData[2].name="满意";
  922. $scope.incident_evaluateData[3].name="一般";
  923. $scope.incident_evaluateData[4].name="不满意";
  924. for(var i=0;i<$scope.incident_evaluateData.length;i++){
  925. api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
  926. })
  927. }
  928. SweetAlert.swal({
  929. title: "恢复成功!",
  930. type: "success",
  931. confirmButtonColor: "#007AFF"
  932. });
  933. $timeout(function(){
  934. $scope.getIncident_evaluate();
  935. },2000)
  936. }
  937. // 满意度评价结束
  938. // 结果类型开始
  939. $scope.incident_resultData=[];
  940. $scope.getIncident_result=function(){
  941. var data={
  942. "key":"incident_handleresult",
  943. "type":"list"
  944. }
  945. api_wechatfile.getDictionary(data).then(function(res){
  946. $scope.incident_resultData=res;
  947. })
  948. }
  949. $scope.getIncident_result();
  950. $scope.incident_resultSave=function(){
  951. for(var i=0;i<$scope.incident_resultData.length;i++){
  952. api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
  953. })
  954. }
  955. SweetAlert.swal({
  956. title: "保存成功!",
  957. type: "success",
  958. confirmButtonColor: "#007AFF"
  959. });
  960. $timeout(function(){
  961. $scope.getIncident_result();
  962. },2000)
  963. }
  964. $scope.incident_resultReturn=function(){
  965. $scope.incident_resultData[0].name="全部解决";
  966. $scope.incident_resultData[1].name="部分解决";
  967. $scope.incident_resultData[2].name="未解决";
  968. $scope.incident_resultData[3].name="其它";
  969. for(var i=0;i<$scope.incident_resultData.length;i++){
  970. api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
  971. })
  972. }
  973. SweetAlert.swal({
  974. title: "恢复成功!",
  975. type: "success",
  976. confirmButtonColor: "#007AFF"
  977. });
  978. $timeout(function(){
  979. $scope.getIncident_result();
  980. },2000)
  981. }
  982. // 结果类型结束
  983. // 事件优先级开始
  984. $scope.incident_priorityData=[];
  985. $scope.getIncident_priority=function(){
  986. var data={
  987. "key":"incident_priority",
  988. "type":"list"
  989. }
  990. api_wechatfile.getDictionary(data).then(function(res){
  991. $scope.incident_priorityData=res;
  992. })
  993. }
  994. $scope.getIncident_priority();
  995. $scope.incident_prioritySave=function(){
  996. for(var i=0;i<$scope.incident_priorityData.length;i++){
  997. api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
  998. })
  999. }
  1000. SweetAlert.swal({
  1001. title: "保存成功!",
  1002. type: "success",
  1003. confirmButtonColor: "#007AFF"
  1004. });
  1005. $timeout(function(){
  1006. $scope.getIncident_priority();
  1007. },2000)
  1008. }
  1009. $scope.incident_priorityReturn=function(){
  1010. $scope.incident_priorityData[0].name="重大";
  1011. $scope.incident_priorityData[1].name="高";
  1012. $scope.incident_priorityData[2].name="较高";
  1013. $scope.incident_priorityData[3].name="普通";
  1014. for(var i=0;i<$scope.incident_priorityData.length;i++){
  1015. api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
  1016. })
  1017. }
  1018. SweetAlert.swal({
  1019. title: "恢复成功!",
  1020. type: "success",
  1021. confirmButtonColor: "#007AFF"
  1022. });
  1023. $timeout(function(){
  1024. $scope.getIncident_priority();
  1025. },2000)
  1026. }
  1027. // 事件优先级结束
  1028. // 事件工单权重开始
  1029. $scope.incident_complexityData=[];
  1030. $scope.getIncident_complexity=function(){
  1031. var data={
  1032. "key":"incident_complexity",
  1033. "type":"list"
  1034. }
  1035. api_wechatfile.getDictionary(data).then(function(res){
  1036. $scope.incident_complexityData=res;
  1037. })
  1038. }
  1039. $scope.getIncident_complexity();
  1040. $scope.incident_complexitySave=function(){
  1041. for(var i=0;i<$scope.incident_complexityData.length;i++){
  1042. api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
  1043. })
  1044. }
  1045. SweetAlert.swal({
  1046. title: "保存成功!",
  1047. type: "success",
  1048. confirmButtonColor: "#007AFF"
  1049. });
  1050. $timeout(function(){
  1051. $scope.getIncident_complexity();
  1052. },2000)
  1053. }
  1054. // 没有恢复默认
  1055. // $scope.incident_complexityReturn=function(){
  1056. // $scope.incident_complexityData[0].name="重大";
  1057. // $scope.incident_complexityData[1].name="高";
  1058. // $scope.incident_complexityData[2].name="较高";
  1059. // $scope.incident_complexityData[3].name="普通";
  1060. // for(var i=0;i<$scope.incident_complexityData.length;i++){
  1061. // api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
  1062. // })
  1063. // }
  1064. // SweetAlert.swal({
  1065. // title: "恢复成功!",
  1066. // type: "success",
  1067. // confirmButtonColor: "#007AFF"
  1068. // });
  1069. // $timeout(function(){
  1070. // $scope.getIncident_complexity();
  1071. // },2000)
  1072. // }
  1073. // 事件工单权重结束
  1074. // 服务级别协议开始
  1075. $scope.incident_SLA_Data=[];
  1076. $scope.getIncident_SLA=function(){
  1077. var data={
  1078. "idx":0,
  1079. "sum":10
  1080. };
  1081. jry_api_bpm.jry_getFetchDataList(data,"servicelevelagreement").then(function(res){
  1082. $scope.incident_SLA_Data=res.list
  1083. })
  1084. };
  1085. $scope.getIncident_SLA();
  1086. $scope.incident_SLASave=function(){
  1087. for(var i=0;i<$scope.incident_SLA_Data.length;i++){
  1088. $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
  1089. $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
  1090. var data={
  1091. "servicelevelagreement":$scope.incident_SLA_Data[i]
  1092. }
  1093. jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
  1094. })
  1095. SweetAlert.swal({
  1096. title: "保存成功!",
  1097. type: "success",
  1098. confirmButtonColor: "#007AFF"
  1099. });
  1100. $timeout(function(){
  1101. $scope.getIncident_SLA();
  1102. },2000)
  1103. }
  1104. }
  1105. $scope.incident_SLAReturn=function(){
  1106. $scope.incident_SLA_Data[0].resolveTime=450;
  1107. $scope.incident_SLA_Data[1].resolveTime=480;
  1108. $scope.incident_SLA_Data[2].resolveTime=480;
  1109. $scope.incident_SLA_Data[3].resolveTime=960;
  1110. $scope.incident_SLA_Data[0].responseTime=30;
  1111. $scope.incident_SLA_Data[1].responseTime=45;
  1112. $scope.incident_SLA_Data[2].responseTime=60;
  1113. $scope.incident_SLA_Data[3].responseTime=240;
  1114. for(var i=0;i<$scope.incident_SLA_Data.length;i++){
  1115. $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
  1116. $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
  1117. var data={
  1118. "servicelevelagreement":$scope.incident_SLA_Data[i]
  1119. }
  1120. jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
  1121. })
  1122. SweetAlert.swal({
  1123. title: "保存成功!",
  1124. type: "success",
  1125. confirmButtonColor: "#007AFF"
  1126. });
  1127. $timeout(function(){
  1128. $scope.getIncident_SLA();
  1129. },2000)
  1130. }
  1131. }
  1132. // 服务级别协议结束
  1133. // 事件来源开始
  1134. $scope.incident_sourceData=[];
  1135. $scope.getIncident_source=function(){
  1136. var data={
  1137. "key":"incident_source",
  1138. "type":"list"
  1139. }
  1140. api_wechatfile.getDictionary(data).then(function(res){
  1141. $scope.incident_sourceData=res;
  1142. })
  1143. }
  1144. $scope.getIncident_source();
  1145. $scope.incident_sourceSave=function(){
  1146. for(var i=0;i<$scope.incident_sourceData.length;i++){
  1147. api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
  1148. })
  1149. }
  1150. SweetAlert.swal({
  1151. title: "保存成功!",
  1152. type: "success",
  1153. confirmButtonColor: "#007AFF"
  1154. });
  1155. $timeout(function(){
  1156. $scope.getIncident_source();
  1157. },2000)
  1158. }
  1159. $scope.incident_sourceReturn=function(){
  1160. $scope.incident_sourceData[0].name="电话";
  1161. $scope.incident_sourceData[1].name="留言";
  1162. $scope.incident_sourceData[2].name="微信/web";
  1163. $scope.incident_sourceData[3].name="主动发现";
  1164. $scope.incident_sourceData[4].name="领导指派";
  1165. $scope.incident_sourceData[5].name="其他";
  1166. $scope.incident_sourceData[0].value="phone";
  1167. $scope.incident_sourceData[1].value="record";
  1168. $scope.incident_sourceData[2].value="im";
  1169. $scope.incident_sourceData[3].value="discover";
  1170. $scope.incident_sourceData[4].value="leader";
  1171. $scope.incident_sourceData[5].value="other";
  1172. for(var i=0;i<$scope.incident_sourceData.length;i++){
  1173. api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
  1174. })
  1175. }
  1176. SweetAlert.swal({
  1177. title: "恢复成功!",
  1178. type: "success",
  1179. confirmButtonColor: "#007AFF"
  1180. });
  1181. $timeout(function(){
  1182. $scope.getIncident_source();
  1183. },2000)
  1184. }
  1185. // 事件来源结束
  1186. // 关闭代码开始
  1187. $scope.incident_closecodeData=[];
  1188. $scope.getIncident_closecode=function(){
  1189. var data={
  1190. "key":"incident_closecode",
  1191. "type":"list"
  1192. }
  1193. api_wechatfile.getDictionary(data).then(function(res){
  1194. $scope.incident_closecodeData=res;
  1195. })
  1196. }
  1197. $scope.getIncident_closecode();
  1198. $scope.incident_closecodeSave=function(){
  1199. for(var i=0;i<$scope.incident_closecodeData.length;i++){
  1200. api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
  1201. })
  1202. }
  1203. SweetAlert.swal({
  1204. title: "保存成功!",
  1205. type: "success",
  1206. confirmButtonColor: "#007AFF"
  1207. });
  1208. $timeout(function(){
  1209. $scope.getIncident_closecode();
  1210. },2000)
  1211. }
  1212. $scope.incident_closecodeReturn=function(){
  1213. $scope.incident_closecodeData[0].value="060";
  1214. $scope.incident_closecodeData[1].value="061";
  1215. $scope.incident_closecodeData[2].value="062";
  1216. $scope.incident_closecodeData[3].value="063";
  1217. $scope.incident_closecodeData[4].value="064";
  1218. $scope.incident_closecodeData[5].value="065";
  1219. $scope.incident_closecodeData[0].desc="事件已经完全解决";
  1220. $scope.incident_closecodeData[1].desc="事件未能完全解决";
  1221. $scope.incident_closecodeData[2].desc="由服务提供商对事件进行处理";
  1222. $scope.incident_closecodeData[3].desc="事件自行消失";
  1223. $scope.incident_closecodeData[4].desc="事件请求不在服务范围内";
  1224. $scope.incident_closecodeData[5].desc="通过问题或变更流程处理";
  1225. $scope.incident_closecodeData[0].desc="完全解决";
  1226. $scope.incident_closecodeData[1].desc="临时解决";
  1227. $scope.incident_closecodeData[2].desc="供应商解决";
  1228. $scope.incident_closecodeData[3].desc="事件消失";
  1229. $scope.incident_closecodeData[4].desc="拒绝";
  1230. $scope.incident_closecodeData[5].desc="进入其他流程处理";
  1231. for(var i=0;i<$scope.incident_closecodeData.length;i++){
  1232. api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
  1233. })
  1234. }
  1235. SweetAlert.swal({
  1236. title: "恢复成功!",
  1237. type: "success",
  1238. confirmButtonColor: "#007AFF"
  1239. });
  1240. $timeout(function(){
  1241. $scope.getIncident_closecode();
  1242. },2000)
  1243. }
  1244. // 关闭代码结束
  1245. // 优先级规则开始
  1246. $scope.incident_prioritymatrixAdd=function(){
  1247. var modalInstance = $modal.open({
  1248. templateUrl: 'assets/views/system/tpl/systemprioritymatrix.html',
  1249. controller: function($scope, $modalInstance, api_bpm_data) {
  1250. $scope.prioritymatrixdata={};
  1251. var prioritymatrixInfluenceData={
  1252. "key":"incident_influence",
  1253. "type":"list"
  1254. }
  1255. $scope.prioritymatrixInfluenceData=[];
  1256. api_wechatfile.getDictionary(prioritymatrixInfluenceData).then(function(res){
  1257. $scope.prioritymatrixInfluenceData=res;
  1258. })
  1259. var prioritymatrixEmergencyData={
  1260. "key":"incident_emergency",
  1261. "type":"list"
  1262. }
  1263. $scope.prioritymatrixEmergencyData=[];
  1264. api_wechatfile.getDictionary(prioritymatrixEmergencyData).then(function(res){
  1265. $scope.prioritymatrixEmergencyData=res;
  1266. })
  1267. var prioritymatrixPriorityData={
  1268. "key":"incident_priority",
  1269. "type":"list"
  1270. }
  1271. $scope.prioritymatrixPriorityData=[];
  1272. api_wechatfile.getDictionary(prioritymatrixPriorityData).then(function(res){
  1273. $scope.prioritymatrixPriorityData=res;
  1274. })
  1275. $scope.cancel = function() {
  1276. $modalInstance.dismiss('cancel');
  1277. };
  1278. $scope.savercode = function(prioritymatrixdata) {
  1279. $modalInstance.close(prioritymatrixdata);
  1280. };
  1281. }
  1282. });
  1283. modalInstance.result.then(function(selectedItem) {
  1284. // console.log('selectedItem='+JSON.stringify(selectedItem));
  1285. if (selectedItem) {
  1286. console.log(selectedItem);
  1287. var fildata = { "prioritymatrix": { "priority": { "id": selectedItem.priority.id }, "emergency": { "id": selectedItem.emergency.id }, "influence": { "id": selectedItem.influence.id } } }
  1288. api_bpm_data.addData('prioritymatrix', fildata).then(function(response) {
  1289. if (response) {
  1290. if (response.status == 200) {
  1291. SweetAlert.swal({
  1292. title: "新增成功!",
  1293. type: "success"
  1294. }, function() {
  1295. $scope.getPrioritymatrix()
  1296. })
  1297. } else {
  1298. SweetAlert.swal({
  1299. title: "新增失败!",
  1300. text: "已有此类优先级规则!",
  1301. type: "error"
  1302. })
  1303. }
  1304. }
  1305. })
  1306. }
  1307. });
  1308. }
  1309. $scope.prioritymatrixData=[];
  1310. $scope.getPrioritymatrix=function(){
  1311. var data={
  1312. "idx":0,
  1313. "sum":999
  1314. }
  1315. api_statistic.tableData(data,"prioritymatrix").then(function(res){
  1316. $scope.prioritymatrixData=res.list
  1317. })
  1318. }
  1319. $scope.incident_prioritymatrixSave=function(){
  1320. SweetAlert.swal({
  1321. title: "修改成功!",
  1322. type: "success"
  1323. })
  1324. for(var i=0;i<$scope.prioritymatrixData.length;i++){
  1325. api_bpm.updData("prioritymatrix",{"prioritymatrix":$scope.prioritymatrixData[i]}).then(function(res){
  1326. if(res.status!=200){
  1327. SweetAlert.swal({
  1328. title: "修改失败!",
  1329. text: "已有此类优先级规则,或者规则不合理!",
  1330. type: "error"
  1331. })
  1332. }
  1333. })
  1334. }
  1335. $timeout(function(){
  1336. $scope.getPrioritymatrix()
  1337. },2000)
  1338. }
  1339. $scope.removePrioritymatrix=function(data){
  1340. SweetAlert.swal({
  1341. title: "确认删除?",
  1342. text: "删除的数据不可恢复,请确认继续操作!",
  1343. type: "warning",
  1344. showCancelButton: true,
  1345. confirmButtonColor: "#DD6B55",
  1346. confirmButtonText: "继续删除",
  1347. cancelButtonText: "取消操作",
  1348. closeOnConfirm: false,
  1349. closeOnCancel: false
  1350. }, function (isConfirm) {
  1351. if (isConfirm) {
  1352. api_bpm_data.rmvData("prioritymatrix",[data.id]).then(function(res){
  1353. console.log(res);
  1354. if(res.status==200){
  1355. SweetAlert.swal({
  1356. title: "删除成功!",
  1357. type: "success",
  1358. confirmButtonColor: "#007AFF"
  1359. }, function() {
  1360. $scope.getPrioritymatrix()
  1361. });
  1362. }else{
  1363. SweetAlert.swal({
  1364. title: "删除失败",
  1365. text: "系统错误,请稍后重试!",
  1366. type: "error",
  1367. confirmButtonColor: "#DD6B55"
  1368. });
  1369. }
  1370. })
  1371. } else {
  1372. SweetAlert.swal("操作取消", "数据安全", "error");
  1373. }
  1374. });
  1375. }
  1376. $scope.getPrioritymatrix()
  1377. // 优先级规则结束
  1378. // 获取组数据
  1379. $scope.getGroupList=function(){
  1380. var postData={
  1381. idx: 0,
  1382. sum: 1000,
  1383. group: {selectType: "nouser"}
  1384. }
  1385. api_user_data.fetchDataList('group',postData).then(res=>{
  1386. $scope.groupList=res.list;
  1387. })
  1388. }
  1389. $scope.getGroupList()
  1390. // 获取人数据
  1391. $scope.getUserList=function(){
  1392. var postData={
  1393. idx: 0,
  1394. sum: 1000,
  1395. user: {
  1396. name:'',
  1397. selectType: "pinyin_qs",
  1398. }
  1399. }
  1400. api_user_data.fetchDataList('user',postData).then(res=>{
  1401. $scope.userList=res.list;
  1402. })
  1403. }
  1404. $scope.getUserList()
  1405. // 获取事件分类人员
  1406. $scope.getUserList1=function(){
  1407. var postData={
  1408. idx: 0,
  1409. sum: 1000,
  1410. user: {
  1411. name:'',
  1412. selectType: "pinyin_qs",
  1413. roledata:{
  1414. rolecode:'incident-category-manager'
  1415. }
  1416. }
  1417. }
  1418. api_user_data.fetchDataList('user',postData).then(res=>{
  1419. $scope.userList1=res.list;
  1420. })
  1421. }
  1422. $scope.getUserList1()
  1423. }]);