incidentSetUpCtrl.js 61 KB

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