incidentSetUpCtrl.js 61 KB

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