faultSymptomsCtrl.js 65 KB

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