incidentSetUpCtrl.js 62 KB

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