incidentSetUpCtrl.js 62 KB

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