incidentSetUpCtrl.js 60 KB

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