incidentSetUpCtrl.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  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. ]
  31. $scope.leftListIdx=0;
  32. $scope.leftListName="事件分类";
  33. $scope.leftListCli=function(idx,data){
  34. $scope.leftListIdx=idx;
  35. $scope.leftListName=data.name
  36. }
  37. // 事件分类开始
  38. // $scope.langs=i18nService.getAllLangs();
  39. // $scope.lang = 'zh-cn';
  40. var loginUser = $rootScope.user;
  41. //组
  42. api_user_data.fetchDataList('group', { "idx": 0, "sum": 1000 }).then(function(data) {
  43. $scope.group = data.list;
  44. });
  45. //优先级
  46. // api_bpm_data.fetchDataList('priority', { "idx": 0, "sum": 10 }).then(function(data) {
  47. // $scope.priority = data.list;
  48. // });
  49. api_wechatfile.getDictionary({"key":"incident_priority","type":"list"}).then(function(data){
  50. $scope.priority=data
  51. })
  52. // 工单权重
  53. api_wechatfile.getDictionary({"key":"incident_complexity","type":"list"}).then(function(data){
  54. $scope.complexity=data
  55. })
  56. /* ----- tree----- */
  57. var apple_selected, tree, treedata_avm, treedata_geography;
  58. //$scope.selectedTreeNode = {};ssss
  59. var i = 0;
  60. $scope.out = [];
  61. $scope.outdata = [];
  62. var systemtype = [];
  63. $scope.subdata={};
  64. $scope.addcate = false;
  65. $scope.changecate = false;
  66. // $scope.refreshListData = function(){
  67. // var data ={"idx":0,"sum":1000};
  68. // api_bpm_data.fetchDataList('incidentcategory',data).then(function(response){
  69. // if(response){
  70. // if(response.status=200){
  71. // $scope.outdata = response.list;
  72. // }
  73. // }
  74. // })
  75. // }
  76. // $scope.refreshListData();
  77. var childdata = {};
  78. $scope.thisParent={};//当前点击节点的父节点
  79. $scope.userOrGroupType={};//当前节点运维组/运维人员
  80. $scope.my_tree_handler = function(branch) {
  81. $scope.changecate = true;
  82. $scope.addcate = false;
  83. filterData.treeIds = branch.id;
  84. $scope.selectedTreeNode = branch;
  85. $scope.output = branch;
  86. $scope.thisParent=branch.parent||null;
  87. if($scope.thisParent){
  88. $scope.thisParent.label=$scope.thisParent.category;
  89. $scope.thisParent.isExpanded=true;
  90. $scope.thisParent.selected=true;
  91. $scope.subdata['parent']=$scope.thisParent
  92. };
  93. // console.log($scope.thisParent,$scope.subdata)
  94. if(branch.hasPlace==1){
  95. $scope.subdata.hasPlace=true
  96. }else{
  97. $scope.subdata.hasPlace=false
  98. }
  99. convertchildToTree(branch);
  100. console.log(branch)
  101. if(branch.userOrGroupType){
  102. $scope.userOrGroupType['type']=branch.userOrGroupType;
  103. $scope.userGroupChecked['groupCheck']=branch.group||{};
  104. $scope.userGroupChecked['userCheck']=branch.handleUser||{};
  105. }else{
  106. $scope.userOrGroupType['type']=0;
  107. $scope.userGroupChecked={}
  108. }
  109. // $scope.subdata=branch;
  110. $scope.subdata.category=branch.label;
  111. var eqflag = false;
  112. angular.forEach($scope.outdata, function(item) {
  113. if (item.id == $scope.output.id) eqflag = true;
  114. });
  115. if (eqflag) {
  116. } else {
  117. $scope.outdata.push({
  118. 'name': $scope.output.label,
  119. 'id': $scope.output.id
  120. });
  121. var postData = {
  122. typeList: []
  123. };
  124. if ($scope.outdata.length > 0) {
  125. angular.forEach($scope.outdata, function(data) {
  126. postData.typeList.push({ id: data.id });
  127. })
  128. }
  129. // api_solution.findSolutionTypesUser(postData).then(function(response){
  130. // //Restangular.
  131. // $scope.userdata = response.data;
  132. // });
  133. }
  134. };
  135. $scope.addType = function(element) {
  136. $scope.addcate = true
  137. $scope.changecate = false
  138. // var modalInstance = $modal.open({
  139. // templateUrl: 'assets/views/system/tpl/systemclose.html',
  140. // controller: function($scope, $modalInstance, api_bpm_data){
  141. // // api_bpm_data.fetchDataList('closecode',filterData).then(function(data){
  142. // // var myData = Restangular.stripRestangular(data);
  143. // // }
  144. // }
  145. // });
  146. }
  147. /* -----start remove incidet category----- */
  148. $scope.remove = function(element) {
  149. var modalInstance = $modal.open({
  150. templateUrl: 'assets/views/delete.html',
  151. controller: function($scope, scope, $modalInstance, api_bpm_data) {
  152. // $scope.title = '优先级删除';
  153. // $scope.connect = '确定要删除此优先级?';
  154. $scope.title = "事件分类删除?";
  155. $scope.connect = "确定要删除此事件分类?";
  156. $scope.ok = function() {
  157. $modalInstance.close(element);
  158. };
  159. $scope.cancel = function() {
  160. $modalInstance.dismiss('cancel');
  161. };
  162. },
  163. size: 'sm',
  164. resolve: {
  165. scope: function() {
  166. return $scope;
  167. }
  168. }
  169. });
  170. modalInstance.result.then(function(selectedItem) {
  171. if (selectedItem) {
  172. var rmvList = [];
  173. rmvList.push(selectedItem.id);
  174. if (selectedItem.children.length > 0) {
  175. SweetAlert.swal({
  176. title: "删除失败!",
  177. text: "请先删除选中的分类的子级",
  178. type: "error"
  179. })
  180. } else {
  181. api_bpm_data.rmvData('incidentcategory', rmvList).then(function(response) {
  182. if (response.data) {
  183. SweetAlert.swal({
  184. title: "删除成功!",
  185. type: "success",
  186. confirmButtonColor: "#007AFF"
  187. }, function() {
  188. $scope.try_async_load();
  189. $scope.$apply($scope.my_data);
  190. });
  191. } else {
  192. SweetAlert.swal({
  193. title: "操作异常!",
  194. text: "系统异常,请稍后重试,或者联系管理员!",
  195. type: "error"
  196. });
  197. }
  198. })
  199. }
  200. }
  201. })
  202. }
  203. /* -----end remove incidet category----- */
  204. function convertchildToTree(datum) {
  205. $scope.subdata = {};
  206. if (datum.parent) {
  207. $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 }
  208. } else {
  209. $scope.subdata = { 'id': datum.id, 'category': datum.label, 'group': datum.group||{}, 'hasSimple': datum.hasSimple, 'hasPlace': datum.hasPlace, 'priority': datum.priority, 'complexity': datum.complexity }
  210. }
  211. }
  212. function convertListToTree(data, treeMap) {
  213. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  214. var root = null; //Initially set our loop to null
  215. //loop over data
  216. for (var i = 0; i < data.length; i++) {
  217. var datum = data[i];
  218. //each node will have children, so let's give it a "children" poperty
  219. datum.children = [];
  220. //add an entry for this node to the map so that any future children can
  221. //lookup the parent
  222. idToNodeMap[datum.id] = datum;
  223. //Does this node have a parent?
  224. // console.log("datum="+JSON.stringify(datum))
  225. if (typeof datum.parent === "undefined") {
  226. //Doesn't look like it, so this node is the root of the tree
  227. root = datum;
  228. treeMap[datum.id] = root;
  229. } else {
  230. //This node has a parent, so let's look it up using the id
  231. parentNode = idToNodeMap[datum.parent.id];
  232. //We don't need this property, so let's delete it.
  233. // delete datum.parent;
  234. //Let's add the current node as a child of the parent node.
  235. parentNode.children.push(datum);
  236. }
  237. }
  238. return root;
  239. }
  240. function convertParentToChildList(data) {
  241. var treeMap = {};
  242. var list = [];
  243. convertListToTree(data, treeMap);
  244. angular.forEach(treeMap, function(item) {
  245. list.push(item);
  246. });
  247. return list;
  248. }
  249. $scope.onFilterCallback = function(item){
  250. // $scope.addcategory.parent=item.label;
  251. $scope.selectedChangeCategory=item;
  252. console.log(item)
  253. }
  254. $scope.parentdata = {};
  255. $scope.try_async_load = function() {
  256. $scope.my_data = [];
  257. $scope.doing_async = true;
  258. var data = { "idx": 0, "sum": 1000 };
  259. api_bpm_data.fetchDataList('incidentcategory', data).then(function(response) {
  260. var data = response.list;
  261. var objects = [];
  262. $scope.parentdata = data;
  263. for (var i = 0; i < data.length; i++) {
  264. var object = {};
  265. object.id = data[i].id;
  266. if (angular.isDefined(data[i].parent)) {
  267. object.parent = data[i].parent;
  268. }
  269. if (angular.isDefined(data[i].hasPlace)) {
  270. object.hasPlace = data[i].hasPlace;
  271. }
  272. if (angular.isDefined(data[i].hasSimple)) {
  273. object.hasSimple = data[i].hasSimple;
  274. }
  275. if (angular.isDefined(data[i].group)) {
  276. object.group = data[i].group||{};
  277. }
  278. if (angular.isDefined(data[i].priority)) {
  279. object.priority = data[i].priority;
  280. }
  281. if (angular.isDefined(data[i].complexity)) {
  282. object.complexity = data[i].complexity;
  283. }
  284. if (angular.isDefined(data[i].handleUser)) {
  285. object.handleUser = data[i].handleUser||{};
  286. }
  287. if(angular.isDefined(data[i].userOrGroupType)){
  288. object.userOrGroupType=data[i].userOrGroupType;
  289. }
  290. object.label = data[i].category;
  291. // object.actions = data[i][3]; //权限部分
  292. // object.group = "1";
  293. // object.user = "2";
  294. object.state = {
  295. "opened": true
  296. };
  297. object.typeName = "type";
  298. // if()
  299. // if (object.actions.indexOf("2") >= 0) { //知识库类型 具有增加权限--系统管理员
  300. $scope.showAddSolutionType = true;
  301. // }
  302. // if (object.actions.indexOf("5") >= 0) { //知识库类型 具有授权权限--系统管理员
  303. $scope.showReviewKnowledgeType = true;
  304. // }
  305. objects.push(object);
  306. }
  307. $scope.my_data = convertParentToChildList(objects);
  308. $scope.tree_data = angular.copy($scope.my_data);
  309. if ($scope.my_data.length > 0) {
  310. $scope.doing_async = false;
  311. }
  312. });
  313. };
  314. $scope.closethis = function(formdata) {
  315. formdata.category = "";
  316. formdata.parent.category = "";
  317. };
  318. /* -----start submit incidet category----- */
  319. $scope.userGroupChecked={};//选中人/组数据
  320. $scope.submitchange = function(formdata) {
  321. // if (formdata.hasArea) {
  322. // formdata.hasArea = 1;
  323. // formdata.hasPlace = 1;
  324. // } else {
  325. // formdata.hasArea = 0;
  326. // formdata.hasPlace = 0;
  327. // }
  328. if (formdata.hasPlace==true) {
  329. formdata.hasPlace = 1;
  330. } else {
  331. formdata.hasPlace = 0;
  332. }
  333. // }
  334. if (formdata.hasSimple == true) {
  335. formdata.hasSimple = 1;
  336. } else {
  337. formdata.hasSimple = 0;
  338. }
  339. // if ($scope.selectedTreeNode.parent) {
  340. // formdata.parent = { "id": $scope.selectedTreeNode.parent.id };
  341. // }
  342. // console.log($scope.thisParent)
  343. if($scope.selectedChangeCategory){
  344. formdata['parentCategory'] ={'id':$scope.selectedChangeCategory.id};
  345. delete formdata.parent
  346. }else if($scope.thisParent){
  347. formdata['parentCategory'] ={'id':$scope.thisParent.id};
  348. delete formdata.parent
  349. }
  350. // console.log(formdata)
  351. if($scope.userOrGroupType.type){
  352. formdata.userOrGroupType=$scope.userOrGroupType.type
  353. }
  354. if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
  355. formdata.group={id:$scope.userGroupChecked.groupCheck.id};
  356. // delete formdata.handleUser;
  357. }
  358. if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
  359. formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
  360. // delete formdata.group;
  361. }
  362. if($scope.subdata.complexity){
  363. formdata.complexity=$scope.subdata.complexity
  364. }
  365. if($scope.subdata.priority){
  366. formdata.priority=$scope.subdata.priority
  367. }
  368. var filedata = { "incidentcategory": formdata }
  369. console.log(filedata);
  370. // return;
  371. api_bpm_data.updData('incidentcategory', filedata).then(function(response) {
  372. if (response) {
  373. if (response.status == 200) {
  374. $scope.try_async_load()
  375. SweetAlert.swal({
  376. title: "修改成功!",
  377. type: "success"
  378. }, function() {
  379. $scope.$apply($scope.my_data);
  380. })
  381. } else {
  382. SweetAlert.swal({
  383. title: "修改失败!",
  384. type: "error"
  385. })
  386. }
  387. }
  388. });
  389. };
  390. $scope.adddata = {};
  391. $scope.addparent = false;
  392. // 新增保存提交
  393. $scope.userGroupCheckedAdd={};//选中人/组数据
  394. $scope.userOrGroupTypeAdd={};//运维组/运维人员
  395. $scope.submitadd = function(formdata) {
  396. // var paret = {};
  397. // var filedata = {};
  398. // filedata = angular.copy(formdata);
  399. // delete filedata.addp
  400. // if (angular.isDefined(formdata.parent) && addparent) {
  401. // angular.forEach($scope.parentdata, function(data) {
  402. // if (formdata.parent.category.id == data.id) {
  403. // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": data.id } } }
  404. // }
  405. // })
  406. // } else {
  407. // filedata = { "incidentcategory": { "category": formdata.category } }
  408. // }
  409. // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": formdata.parentNode.id } } }
  410. // if (formdata.hasArea && formdata.hasArea == true) {
  411. // if (formdata.hasArea) {
  412. // formdata.hasArea = 1;
  413. // formdata.hasPlace = 1;
  414. // } else {
  415. // formdata.hasArea = 0;
  416. // formdata.hasPlace = 0;
  417. // }
  418. if (formdata.hasPlace == true) {
  419. formdata.hasPlace = 1;
  420. } else {
  421. formdata.hasPlace = 0;
  422. }
  423. if (formdata.hasSimple == true) {
  424. formdata.hasSimple = 1;
  425. } else {
  426. formdata.hasSimple = 0;
  427. }
  428. if (formdata.parent) {
  429. formdata['parentCategory'] = { "id": formdata.parent.id };
  430. delete formdata.parent
  431. }
  432. if($scope.userOrGroupTypeAdd.type){
  433. formdata.userOrGroupType=$scope.userOrGroupTypeAdd.type
  434. }
  435. if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.groupCheck){
  436. formdata.group={id:$scope.userGroupCheckedAdd.groupCheck.id};
  437. // delete formdata.handleUser;
  438. }
  439. if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.userCheck){
  440. formdata.handleUser={id:$scope.userGroupCheckedAdd.userCheck.id};
  441. // delete formdata.group;
  442. }
  443. var filedata = { "incidentcategory": formdata }
  444. console.log(filedata);
  445. // return;
  446. api_bpm_data.addData('incidentcategory', filedata).then(function(response) {
  447. if (response) {
  448. if (response.status == 200) {
  449. $scope.userdata = [];
  450. $scope.outdata = [];
  451. $scope.try_async_load();
  452. SweetAlert.swal({
  453. title: "增加成功!",
  454. type: "success"
  455. })
  456. } else if (response.status == 408) {
  457. SweetAlert.swal({
  458. title: "增加失败!",
  459. text: response.error,
  460. type: "error"
  461. })
  462. } else {
  463. SweetAlert.swal({
  464. title: "增加失败!",
  465. type: "error"
  466. })
  467. }
  468. }
  469. });
  470. };
  471. /* -----end submit incidet category----- */
  472. $scope.try_async_load();
  473. // $scope.ldloading={};
  474. var filterData = {
  475. key: 'null',
  476. status: 0,
  477. pageIndex: 0,
  478. pageSum: 10,
  479. //treeIds:'[]',
  480. userId: loginUser.id
  481. }
  482. // 事件分类结束
  483. // 事件紧急度开始
  484. $scope.incident_emergencyData=[];
  485. $scope.getIncident_emergency=function(){
  486. var data={
  487. "key":"incident_emergency",
  488. "type":"list"
  489. }
  490. api_wechatfile.getDictionary(data).then(function(res){
  491. $scope.incident_emergencyData=res;
  492. })
  493. }
  494. $scope.getIncident_emergency();
  495. $scope.incident_emergencySave=function(){
  496. for(var i=0;i<$scope.incident_emergencyData.length;i++){
  497. api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
  498. })
  499. }
  500. SweetAlert.swal({
  501. title: "保存成功!",
  502. type: "success",
  503. confirmButtonColor: "#007AFF"
  504. });
  505. $timeout(function(){
  506. $scope.getIncident_emergency();
  507. },2000)
  508. }
  509. $scope.incident_emergencyReturn=function(){
  510. $scope.incident_emergencyData[0].name="紧急";
  511. $scope.incident_emergencyData[1].name="高";
  512. $scope.incident_emergencyData[2].name="中";
  513. $scope.incident_emergencyData[3].name="低";
  514. for(var i=0;i<$scope.incident_emergencyData.length;i++){
  515. api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
  516. })
  517. }
  518. SweetAlert.swal({
  519. title: "恢复成功!",
  520. type: "success",
  521. confirmButtonColor: "#007AFF"
  522. });
  523. $timeout(function(){
  524. $scope.getIncident_emergency();
  525. },2000)
  526. }
  527. // 事件紧急度结束
  528. // 事件影响度开始
  529. $scope.incident_influenceData=[];
  530. $scope.getIncident_influence=function(){
  531. var data={
  532. "key":"incident_influence",
  533. "type":"list"
  534. }
  535. api_wechatfile.getDictionary(data).then(function(res){
  536. $scope.incident_influenceData=res;
  537. })
  538. }
  539. $scope.getIncident_influence();
  540. $scope.incident_influenceSave=function(){
  541. for(var i=0;i<$scope.incident_influenceData.length;i++){
  542. api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
  543. })
  544. }
  545. SweetAlert.swal({
  546. title: "保存成功!",
  547. type: "success",
  548. confirmButtonColor: "#007AFF"
  549. });
  550. $timeout(function(){
  551. $scope.getIncident_influence();
  552. },2000)
  553. }
  554. $scope.incident_influenceReturn=function(){
  555. $scope.incident_influenceData[0].name="高";
  556. $scope.incident_influenceData[1].name="中";
  557. $scope.incident_influenceData[2].name="低";
  558. for(var i=0;i<$scope.incident_influenceData.length;i++){
  559. api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
  560. })
  561. }
  562. SweetAlert.swal({
  563. title: "恢复成功!",
  564. type: "success",
  565. confirmButtonColor: "#007AFF"
  566. });
  567. $timeout(function(){
  568. $scope.getIncident_influence();
  569. },2000)
  570. }
  571. // 事件影响度结束
  572. // 事件状态开始
  573. $scope.incident_classificationData=[];
  574. $scope.getIncident_classification=function(){
  575. var data={
  576. "key":"incident_status",
  577. "type":"list"
  578. }
  579. api_wechatfile.getDictionary(data).then(function(res){
  580. $scope.incident_classificationData=res;
  581. })
  582. }
  583. $scope.getIncident_classification();
  584. $scope.incident_classificationSave=function(){
  585. for(var i=0;i<$scope.incident_classificationData.length;i++){
  586. api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
  587. })
  588. }
  589. SweetAlert.swal({
  590. title: "保存成功!",
  591. type: "success",
  592. confirmButtonColor: "#007AFF"
  593. });
  594. $timeout(function(){
  595. $scope.getIncident_classification();
  596. },2000)
  597. }
  598. $scope.incident_classificationReturn=function(){
  599. $scope.incident_classificationData[0].name="待接单";
  600. $scope.incident_classificationData[1].name="处理中";
  601. $scope.incident_classificationData[2].name="已解决";
  602. $scope.incident_classificationData[3].name="已关闭";
  603. $scope.incident_classificationData[4].name="暂存";
  604. $scope.incident_classificationData[5].name="重新指派";
  605. for(var i=0;i<$scope.incident_classificationData.length;i++){
  606. api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
  607. })
  608. }
  609. SweetAlert.swal({
  610. title: "恢复成功!",
  611. type: "success",
  612. confirmButtonColor: "#007AFF"
  613. });
  614. $timeout(function(){
  615. $scope.getIncident_classification();
  616. },2000)
  617. }
  618. // 事件状态结束
  619. // 满意度评价开始
  620. $scope.incident_evaluateData=[];
  621. $scope.getIncident_evaluate=function(){
  622. var data={
  623. "key":"incident_degree",
  624. "type":"list"
  625. }
  626. api_wechatfile.getDictionary(data).then(function(res){
  627. $scope.incident_evaluateData=res;
  628. })
  629. }
  630. $scope.getIncident_evaluate();
  631. $scope.incident_evaluateSave=function(){
  632. for(var i=0;i<$scope.incident_evaluateData.length;i++){
  633. api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
  634. })
  635. }
  636. SweetAlert.swal({
  637. title: "保存成功!",
  638. type: "success",
  639. confirmButtonColor: "#007AFF"
  640. });
  641. $timeout(function(){
  642. $scope.getIncident_evaluate();
  643. },2000)
  644. }
  645. $scope.incident_evaluateReturn=function(){
  646. $scope.incident_evaluateData[0].name="非常满意";
  647. $scope.incident_evaluateData[1].name="较满意";
  648. $scope.incident_evaluateData[2].name="满意";
  649. $scope.incident_evaluateData[3].name="一般";
  650. $scope.incident_evaluateData[4].name="不满意";
  651. for(var i=0;i<$scope.incident_evaluateData.length;i++){
  652. api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
  653. })
  654. }
  655. SweetAlert.swal({
  656. title: "恢复成功!",
  657. type: "success",
  658. confirmButtonColor: "#007AFF"
  659. });
  660. $timeout(function(){
  661. $scope.getIncident_evaluate();
  662. },2000)
  663. }
  664. // 满意度评价结束
  665. // 结果类型开始
  666. $scope.incident_resultData=[];
  667. $scope.getIncident_result=function(){
  668. var data={
  669. "key":"incident_handleresult",
  670. "type":"list"
  671. }
  672. api_wechatfile.getDictionary(data).then(function(res){
  673. $scope.incident_resultData=res;
  674. })
  675. }
  676. $scope.getIncident_result();
  677. $scope.incident_resultSave=function(){
  678. for(var i=0;i<$scope.incident_resultData.length;i++){
  679. api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
  680. })
  681. }
  682. SweetAlert.swal({
  683. title: "保存成功!",
  684. type: "success",
  685. confirmButtonColor: "#007AFF"
  686. });
  687. $timeout(function(){
  688. $scope.getIncident_result();
  689. },2000)
  690. }
  691. $scope.incident_resultReturn=function(){
  692. $scope.incident_resultData[0].name="全部解决";
  693. $scope.incident_resultData[1].name="部分解决";
  694. $scope.incident_resultData[2].name="未解决";
  695. $scope.incident_resultData[3].name="其它";
  696. for(var i=0;i<$scope.incident_resultData.length;i++){
  697. api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
  698. })
  699. }
  700. SweetAlert.swal({
  701. title: "恢复成功!",
  702. type: "success",
  703. confirmButtonColor: "#007AFF"
  704. });
  705. $timeout(function(){
  706. $scope.getIncident_result();
  707. },2000)
  708. }
  709. // 结果类型结束
  710. // 事件优先级开始
  711. $scope.incident_priorityData=[];
  712. $scope.getIncident_priority=function(){
  713. var data={
  714. "key":"incident_priority",
  715. "type":"list"
  716. }
  717. api_wechatfile.getDictionary(data).then(function(res){
  718. $scope.incident_priorityData=res;
  719. })
  720. }
  721. $scope.getIncident_priority();
  722. $scope.incident_prioritySave=function(){
  723. for(var i=0;i<$scope.incident_priorityData.length;i++){
  724. api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
  725. })
  726. }
  727. SweetAlert.swal({
  728. title: "保存成功!",
  729. type: "success",
  730. confirmButtonColor: "#007AFF"
  731. });
  732. $timeout(function(){
  733. $scope.getIncident_priority();
  734. },2000)
  735. }
  736. $scope.incident_priorityReturn=function(){
  737. $scope.incident_priorityData[0].name="重大";
  738. $scope.incident_priorityData[1].name="高";
  739. $scope.incident_priorityData[2].name="较高";
  740. $scope.incident_priorityData[3].name="普通";
  741. for(var i=0;i<$scope.incident_priorityData.length;i++){
  742. api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
  743. })
  744. }
  745. SweetAlert.swal({
  746. title: "恢复成功!",
  747. type: "success",
  748. confirmButtonColor: "#007AFF"
  749. });
  750. $timeout(function(){
  751. $scope.getIncident_priority();
  752. },2000)
  753. }
  754. // 事件优先级结束
  755. // 事件工单权重开始
  756. $scope.incident_complexityData=[];
  757. $scope.getIncident_complexity=function(){
  758. var data={
  759. "key":"incident_complexity",
  760. "type":"list"
  761. }
  762. api_wechatfile.getDictionary(data).then(function(res){
  763. $scope.incident_complexityData=res;
  764. })
  765. }
  766. $scope.getIncident_complexity();
  767. $scope.incident_complexitySave=function(){
  768. for(var i=0;i<$scope.incident_complexityData.length;i++){
  769. api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
  770. })
  771. }
  772. SweetAlert.swal({
  773. title: "保存成功!",
  774. type: "success",
  775. confirmButtonColor: "#007AFF"
  776. });
  777. $timeout(function(){
  778. $scope.getIncident_complexity();
  779. },2000)
  780. }
  781. // 没有恢复默认
  782. // $scope.incident_complexityReturn=function(){
  783. // $scope.incident_complexityData[0].name="重大";
  784. // $scope.incident_complexityData[1].name="高";
  785. // $scope.incident_complexityData[2].name="较高";
  786. // $scope.incident_complexityData[3].name="普通";
  787. // for(var i=0;i<$scope.incident_complexityData.length;i++){
  788. // api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
  789. // })
  790. // }
  791. // SweetAlert.swal({
  792. // title: "恢复成功!",
  793. // type: "success",
  794. // confirmButtonColor: "#007AFF"
  795. // });
  796. // $timeout(function(){
  797. // $scope.getIncident_complexity();
  798. // },2000)
  799. // }
  800. // 事件工单权重结束
  801. // 服务级别协议开始
  802. $scope.incident_SLA_Data=[];
  803. $scope.getIncident_SLA=function(){
  804. var data={
  805. "idx":0,
  806. "sum":10
  807. };
  808. jry_api_bpm.jry_getFetchDataList(data,"servicelevelagreement").then(function(res){
  809. $scope.incident_SLA_Data=res.list
  810. })
  811. };
  812. $scope.getIncident_SLA();
  813. $scope.incident_SLASave=function(){
  814. for(var i=0;i<$scope.incident_SLA_Data.length;i++){
  815. $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
  816. $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
  817. var data={
  818. "servicelevelagreement":$scope.incident_SLA_Data[i]
  819. }
  820. jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
  821. })
  822. SweetAlert.swal({
  823. title: "保存成功!",
  824. type: "success",
  825. confirmButtonColor: "#007AFF"
  826. });
  827. $timeout(function(){
  828. $scope.getIncident_SLA();
  829. },2000)
  830. }
  831. }
  832. $scope.incident_SLAReturn=function(){
  833. $scope.incident_SLA_Data[0].resolveTime=450;
  834. $scope.incident_SLA_Data[1].resolveTime=480;
  835. $scope.incident_SLA_Data[2].resolveTime=480;
  836. $scope.incident_SLA_Data[3].resolveTime=960;
  837. $scope.incident_SLA_Data[0].responseTime=30;
  838. $scope.incident_SLA_Data[1].responseTime=45;
  839. $scope.incident_SLA_Data[2].responseTime=60;
  840. $scope.incident_SLA_Data[3].responseTime=240;
  841. for(var i=0;i<$scope.incident_SLA_Data.length;i++){
  842. $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
  843. $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
  844. var data={
  845. "servicelevelagreement":$scope.incident_SLA_Data[i]
  846. }
  847. jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
  848. })
  849. SweetAlert.swal({
  850. title: "保存成功!",
  851. type: "success",
  852. confirmButtonColor: "#007AFF"
  853. });
  854. $timeout(function(){
  855. $scope.getIncident_SLA();
  856. },2000)
  857. }
  858. }
  859. // 服务级别协议结束
  860. // 事件来源开始
  861. $scope.incident_sourceData=[];
  862. $scope.getIncident_source=function(){
  863. var data={
  864. "key":"incident_source",
  865. "type":"list"
  866. }
  867. api_wechatfile.getDictionary(data).then(function(res){
  868. $scope.incident_sourceData=res;
  869. })
  870. }
  871. $scope.getIncident_source();
  872. $scope.incident_sourceSave=function(){
  873. for(var i=0;i<$scope.incident_sourceData.length;i++){
  874. api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
  875. })
  876. }
  877. SweetAlert.swal({
  878. title: "保存成功!",
  879. type: "success",
  880. confirmButtonColor: "#007AFF"
  881. });
  882. $timeout(function(){
  883. $scope.getIncident_source();
  884. },2000)
  885. }
  886. $scope.incident_sourceReturn=function(){
  887. $scope.incident_sourceData[0].name="电话";
  888. $scope.incident_sourceData[1].name="留言";
  889. $scope.incident_sourceData[2].name="微信/web";
  890. $scope.incident_sourceData[3].name="主动发现";
  891. $scope.incident_sourceData[4].name="领导指派";
  892. $scope.incident_sourceData[5].name="其他";
  893. $scope.incident_sourceData[0].value="phone";
  894. $scope.incident_sourceData[1].value="record";
  895. $scope.incident_sourceData[2].value="im";
  896. $scope.incident_sourceData[3].value="discover";
  897. $scope.incident_sourceData[4].value="leader";
  898. $scope.incident_sourceData[5].value="other";
  899. for(var i=0;i<$scope.incident_sourceData.length;i++){
  900. api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
  901. })
  902. }
  903. SweetAlert.swal({
  904. title: "恢复成功!",
  905. type: "success",
  906. confirmButtonColor: "#007AFF"
  907. });
  908. $timeout(function(){
  909. $scope.getIncident_source();
  910. },2000)
  911. }
  912. // 事件来源结束
  913. // 关闭代码开始
  914. $scope.incident_closecodeData=[];
  915. $scope.getIncident_closecode=function(){
  916. var data={
  917. "key":"incident_closecode",
  918. "type":"list"
  919. }
  920. api_wechatfile.getDictionary(data).then(function(res){
  921. $scope.incident_closecodeData=res;
  922. })
  923. }
  924. $scope.getIncident_closecode();
  925. $scope.incident_closecodeSave=function(){
  926. for(var i=0;i<$scope.incident_closecodeData.length;i++){
  927. api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
  928. })
  929. }
  930. SweetAlert.swal({
  931. title: "保存成功!",
  932. type: "success",
  933. confirmButtonColor: "#007AFF"
  934. });
  935. $timeout(function(){
  936. $scope.getIncident_closecode();
  937. },2000)
  938. }
  939. $scope.incident_closecodeReturn=function(){
  940. $scope.incident_closecodeData[0].value="060";
  941. $scope.incident_closecodeData[1].value="061";
  942. $scope.incident_closecodeData[2].value="062";
  943. $scope.incident_closecodeData[3].value="063";
  944. $scope.incident_closecodeData[4].value="064";
  945. $scope.incident_closecodeData[5].value="065";
  946. $scope.incident_closecodeData[0].desc="事件已经完全解决";
  947. $scope.incident_closecodeData[1].desc="事件未能完全解决";
  948. $scope.incident_closecodeData[2].desc="由服务提供商对事件进行处理";
  949. $scope.incident_closecodeData[3].desc="事件自行消失";
  950. $scope.incident_closecodeData[4].desc="事件请求不在服务范围内";
  951. $scope.incident_closecodeData[5].desc="通过问题或变更流程处理";
  952. $scope.incident_closecodeData[0].desc="完全解决";
  953. $scope.incident_closecodeData[1].desc="临时解决";
  954. $scope.incident_closecodeData[2].desc="供应商解决";
  955. $scope.incident_closecodeData[3].desc="事件消失";
  956. $scope.incident_closecodeData[4].desc="拒绝";
  957. $scope.incident_closecodeData[5].desc="进入其他流程处理";
  958. for(var i=0;i<$scope.incident_closecodeData.length;i++){
  959. api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
  960. })
  961. }
  962. SweetAlert.swal({
  963. title: "恢复成功!",
  964. type: "success",
  965. confirmButtonColor: "#007AFF"
  966. });
  967. $timeout(function(){
  968. $scope.getIncident_closecode();
  969. },2000)
  970. }
  971. // 关闭代码结束
  972. // 优先级规则开始
  973. $scope.incident_prioritymatrixAdd=function(){
  974. var modalInstance = $modal.open({
  975. templateUrl: 'assets/views/system/tpl/systemprioritymatrix.html',
  976. controller: function($scope, $modalInstance, api_bpm_data) {
  977. $scope.prioritymatrixdata={};
  978. var prioritymatrixInfluenceData={
  979. "key":"incident_influence",
  980. "type":"list"
  981. }
  982. $scope.prioritymatrixInfluenceData=[];
  983. api_wechatfile.getDictionary(prioritymatrixInfluenceData).then(function(res){
  984. $scope.prioritymatrixInfluenceData=res;
  985. })
  986. var prioritymatrixEmergencyData={
  987. "key":"incident_emergency",
  988. "type":"list"
  989. }
  990. $scope.prioritymatrixEmergencyData=[];
  991. api_wechatfile.getDictionary(prioritymatrixEmergencyData).then(function(res){
  992. $scope.prioritymatrixEmergencyData=res;
  993. })
  994. var prioritymatrixPriorityData={
  995. "key":"incident_priority",
  996. "type":"list"
  997. }
  998. $scope.prioritymatrixPriorityData=[];
  999. api_wechatfile.getDictionary(prioritymatrixPriorityData).then(function(res){
  1000. $scope.prioritymatrixPriorityData=res;
  1001. })
  1002. $scope.cancel = function() {
  1003. $modalInstance.dismiss('cancel');
  1004. };
  1005. $scope.savercode = function(prioritymatrixdata) {
  1006. $modalInstance.close(prioritymatrixdata);
  1007. };
  1008. }
  1009. });
  1010. modalInstance.result.then(function(selectedItem) {
  1011. // console.log('selectedItem='+JSON.stringify(selectedItem));
  1012. if (selectedItem) {
  1013. console.log(selectedItem);
  1014. var fildata = { "prioritymatrix": { "priority": { "id": selectedItem.priority.id }, "emergency": { "id": selectedItem.emergency.id }, "influence": { "id": selectedItem.influence.id } } }
  1015. api_bpm_data.addData('prioritymatrix', fildata).then(function(response) {
  1016. if (response) {
  1017. if (response.status == 200) {
  1018. SweetAlert.swal({
  1019. title: "新增成功!",
  1020. type: "success"
  1021. }, function() {
  1022. $scope.getPrioritymatrix()
  1023. })
  1024. } else {
  1025. SweetAlert.swal({
  1026. title: "新增失败!",
  1027. text: "已有此类优先级规则!",
  1028. type: "error"
  1029. })
  1030. }
  1031. }
  1032. })
  1033. }
  1034. });
  1035. }
  1036. $scope.prioritymatrixData=[];
  1037. $scope.getPrioritymatrix=function(){
  1038. var data={
  1039. "idx":0,
  1040. "sum":999
  1041. }
  1042. api_statistic.tableData(data,"prioritymatrix").then(function(res){
  1043. $scope.prioritymatrixData=res.list
  1044. })
  1045. }
  1046. $scope.incident_prioritymatrixSave=function(){
  1047. SweetAlert.swal({
  1048. title: "修改成功!",
  1049. type: "success"
  1050. })
  1051. for(var i=0;i<$scope.prioritymatrixData.length;i++){
  1052. api_bpm.updData("prioritymatrix",{"prioritymatrix":$scope.prioritymatrixData[i]}).then(function(res){
  1053. if(res.status!=200){
  1054. SweetAlert.swal({
  1055. title: "修改失败!",
  1056. text: "已有此类优先级规则,或者规则不合理!",
  1057. type: "error"
  1058. })
  1059. }
  1060. })
  1061. }
  1062. $timeout(function(){
  1063. $scope.getPrioritymatrix()
  1064. },2000)
  1065. }
  1066. $scope.removePrioritymatrix=function(data){
  1067. SweetAlert.swal({
  1068. title: "确认删除?",
  1069. text: "删除的数据不可恢复,请确认继续操作!",
  1070. type: "warning",
  1071. showCancelButton: true,
  1072. confirmButtonColor: "#DD6B55",
  1073. confirmButtonText: "继续删除",
  1074. cancelButtonText: "取消操作",
  1075. closeOnConfirm: false,
  1076. closeOnCancel: false
  1077. }, function (isConfirm) {
  1078. if (isConfirm) {
  1079. api_bpm_data.rmvData("prioritymatrix",[data.id]).then(function(res){
  1080. console.log(res);
  1081. if(res.status==200){
  1082. SweetAlert.swal({
  1083. title: "删除成功!",
  1084. type: "success",
  1085. confirmButtonColor: "#007AFF"
  1086. }, function() {
  1087. $scope.getPrioritymatrix()
  1088. });
  1089. }else{
  1090. SweetAlert.swal({
  1091. title: "删除失败",
  1092. text: "系统错误,请稍后重试!",
  1093. type: "error",
  1094. confirmButtonColor: "#DD6B55"
  1095. });
  1096. }
  1097. })
  1098. } else {
  1099. SweetAlert.swal("操作取消", "数据安全", "error");
  1100. }
  1101. });
  1102. }
  1103. $scope.getPrioritymatrix()
  1104. // 优先级规则结束
  1105. // 获取组数据
  1106. $scope.getGroupList=function(){
  1107. var postData={
  1108. idx: 0,
  1109. sum: 1000,
  1110. group: {selectType: "nouser"}
  1111. }
  1112. api_user_data.fetchDataList('group',postData).then(res=>{
  1113. $scope.groupList=res.list;
  1114. })
  1115. }
  1116. $scope.getGroupList()
  1117. // 获取人数据
  1118. $scope.getUserList=function(){
  1119. var postData={
  1120. idx: 0,
  1121. sum: 1000,
  1122. user: {
  1123. name:'',
  1124. selectType: "pinyin_qs",
  1125. }
  1126. }
  1127. api_user_data.fetchDataList('user',postData).then(res=>{
  1128. $scope.userList=res.list;
  1129. })
  1130. }
  1131. $scope.getUserList()
  1132. }]);