incidentSetUpCtrl.js 60 KB

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