newOrderCtrl.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. 'use strict';
  2. app.controller('newOrderCtrl', ["$scope", "$http", "i18nService", "$rootScope", "$state", "$timeout", "moment", "$interval", "$modal", "$stateParams", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_domain", "api_text", "api_bpm_data", "api_user_data", "api_configure_data", '$parse', "$injector", "$aside", 'toaster', "api_configure_form", "api_cmdb", 'api_bpm', 'api_wechatfile', 'jry_api_bpm', 'api_zsk', function ($scope, $http, i18nService, $rootScope, $state, $timeout, moment, $interval, $modal, $stateParams, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_domain, api_text, api_bpm_data, api_user_data, api_configure_data, $parse, $injector, $aside, toaster, api_configure_form, api_cmdb, api_bpm, api_wechatfile, jry_api_bpm, api_zsk) {
  3. $scope.langs = i18nService.getAllLangs();
  4. $scope.lang = 'zh-cn';
  5. i18nService.setCurrentLang($scope.lang);
  6. var loginUser = $rootScope.user;
  7. console.log(loginUser);
  8. var loginuserGroup = "";
  9. for (var i = 0; i < $rootScope.user.group.length; i++) {
  10. if (i == 0) {
  11. loginuserGroup = $rootScope.user.group[i].id;
  12. } else {
  13. loginuserGroup = loginuserGroup + "," + $rootScope.user.group[i].id;
  14. }
  15. }
  16. $scope.transferTime = function (time) {
  17. return moment(time).format('YYYY-MM-DD HH:mm');
  18. }
  19. //事件列表数据存储
  20. $scope.incidentModel = {
  21. department: ''
  22. }
  23. // 报修科室
  24. $scope.getDept = function (key) {
  25. var postData = {
  26. "idx": 0,
  27. "sum": 10
  28. }
  29. if (key) {
  30. postData.department = {
  31. dept: key
  32. }
  33. }
  34. api_user_data.fetchDataList('department', postData).then(function (response) {
  35. if (response) {
  36. if (response.status = 200) {
  37. $scope.department = response.list;
  38. }
  39. }
  40. })
  41. }
  42. $scope.getDept();
  43. //报修科室过滤
  44. $scope.onChangeDept = function (key) {
  45. $scope.getDept(key)
  46. }
  47. // console.log(items);
  48. $scope.jry_modelRight = "";
  49. $scope.jry_modelLeft = "";
  50. $scope.jry_incidentDescription = "";
  51. $scope.left_searchData = [];
  52. $scope.openModels = false
  53. $scope.right_serch = function () {
  54. $scope.toGetData.incidentdescribe["describes"] = $scope.jry_modelRight;
  55. api_zsk.solutionData($scope.toGetData, 'solution').then(function (res1) {
  56. if (res1.status == 200) {
  57. $scope.jry_scricData = res1.list;
  58. for (var i = 0; i < $scope.jry_scricData.length; i++) {
  59. $scope.jry_scricData[i]["item"] = i + 1
  60. }
  61. }
  62. })
  63. }
  64. $scope.left_serch = function () {
  65. $scope.try_async_load($scope.jry_modelLeft)
  66. return
  67. $scope.indexBG = "";
  68. var fifdata = {
  69. "idx": 0,
  70. "sum": 1000,
  71. "incidentcategory": {
  72. "category": $scope.jry_modelLeft
  73. }
  74. }
  75. // $scope.toGetData.incidentdescribe["category"]=$scope.jry_modelLeft;
  76. jry_api_bpm.jry_getFetchDataList(fifdata, "incidentcategory").then(function (response) {
  77. if (response.status == 200) {
  78. $scope.left_searchData = response.list;
  79. console.log($scope.left_searchData)
  80. }
  81. })
  82. }
  83. $scope.indexBG = "";
  84. $scope.leftSearchGetData = function (index, data) {
  85. // console.log(data);
  86. $scope.indexBG = index;
  87. $scope.treeId = data.id;
  88. $scope.toGetData.incidentdescribe["categoryid"] = {
  89. id: $scope.treeId
  90. };
  91. api_zsk.solutionData($scope.toGetData, 'solution').then(function (res) {
  92. $scope.jry_scricData = res.list;
  93. for (var i = 0; i < $scope.jry_scricData.length; i++) {
  94. $scope.jry_scricData[i]["item"] = i + 1
  95. }
  96. })
  97. }
  98. $scope.toFormData = "";
  99. // 右侧选项点击
  100. $scope.getFormItem = function (res) {
  101. // console.log(res);
  102. $scope.toFormData = res;
  103. if ($scope.jry_incidentDescription) {
  104. var modalInstance = $modal.open({
  105. templateUrl: 'assets/views/delete.html',
  106. controller: function ($scope, scope, $modalInstance, api_bpm_data) {
  107. var rmvList = [];
  108. $scope.title = '追加故障描述';
  109. $scope.connect = '是否要追加故障描述?';
  110. $scope.ok = function () {
  111. scope.jry_incidentDescription = scope.jry_incidentDescription + scope.toFormData.describes;
  112. $modalInstance.dismiss('cancel');
  113. };
  114. $scope.cancel = function () {
  115. $modalInstance.dismiss('cancel');
  116. };
  117. },
  118. size: 'sm',
  119. resolve: {
  120. scope: function () {
  121. return $scope;
  122. }
  123. }
  124. });
  125. } else {
  126. $scope.jry_incidentDescription = $scope.toFormData.describes;
  127. }
  128. }
  129. //组
  130. api_user_data.fetchDataList('group', {
  131. "idx": 0,
  132. "sum": 1000
  133. }).then(function (data) {
  134. $scope.group = data.list;
  135. });
  136. /* ----- tree----- */
  137. var apple_selected, tree, treedata_avm, treedata_geography;
  138. //$scope.selectedTreeNode = {};ssss
  139. var i = 0;
  140. $scope.out = [];
  141. $scope.outdata = [];
  142. var systemtype = [];
  143. $scope.addcate = false;
  144. $scope.changecate = false;
  145. var childdata = {};
  146. $scope.jry_scricData = [];
  147. $scope.toGetData = {
  148. "idx": 0,
  149. "sum": 1000,
  150. "incidentdescribe": {}
  151. }
  152. $scope.treeId = "";
  153. $scope.my_tree_handler = function (branch) {
  154. $scope.treeId = branch.id;
  155. $scope.toGetData.incidentdescribe["categoryid"] = {
  156. id: $scope.treeId
  157. };
  158. api_zsk.solutionData($scope.toGetData, 'solution').then(function (res) {
  159. $scope.jry_scricData = res.list;
  160. for (var i = 0; i < $scope.jry_scricData.length; i++) {
  161. $scope.jry_scricData[i]["item"] = i + 1
  162. }
  163. })
  164. };
  165. function convertListToTree(data, treeMap) {
  166. var idToNodeMap = {};
  167. var root = null;
  168. var parentNode;
  169. for (var i = 0; i < data.length; i++) {
  170. var datum = data[i];
  171. datum.children = [];
  172. idToNodeMap[datum.id] = datum;
  173. if (typeof datum.parent === "undefined") {
  174. root = datum;
  175. treeMap[datum.id] = root;
  176. } else {
  177. parentNode = idToNodeMap[datum.parent.id];
  178. parentNode.children.push(datum);
  179. }
  180. }
  181. return root;
  182. }
  183. function convertParentToChildList(data) {
  184. var treeMap = {};
  185. var list = [];
  186. convertListToTree(data, treeMap);
  187. angular.forEach(treeMap, function (item) {
  188. list.push(item);
  189. });
  190. return list;
  191. }
  192. function transform(nodes) {
  193. var treeConverter = {
  194. result: null, //转化后的结果,是根节点,所有节点都是从根节点长出来的
  195. attributeName: 'id', //节点唯一标识符
  196. needFind: true, //是否查询节点在result中已经存在,为了优化效率
  197. transform: function (node) { //转化递归函数,参数:一个待插入节点
  198. if (node.parent != null) { //该节点有父节点
  199. var newNode = this.transform(node.parent); //递归进入,返回值为一个节点,用作父节点,该父节点必然存在于result中,这点由下面的算法可以控制
  200. if (this.needFind) {
  201. for (var i = 0; i < newNode.children.length; i++) { //查找要插入的node子节点是否在newNode这个父节点中存在
  202. if (newNode.children[i][this.attributeName] === node[this.attributeName]) {
  203. return newNode.children[i]; //存在的话直接返回newNode父节点内的该子节点,该子节点必然存在于result中,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  204. }
  205. }
  206. }
  207. this.needFind = false; //不存在的话,关闭之后递归的循环判断,因为待插入node节点不存在于result中,故而它的子节点一定不存在于result中,不用再循环判断
  208. delete node.parent; //删除该节点的parent属性,如果有的话
  209. node.children = []; //因为确定是要新插入的节点,没有children:[]属性,故给该节点增加children:[]属性
  210. node.state = {
  211. "opened": true
  212. };
  213. node.typeName = "type";
  214. node.label =node.category;
  215. newNode.children.push(node); //将该node节点push进newNode的子节点数组中
  216. return node; //return该新插入节点,作为递归返回值给上层,用作newNode父节点,node存在于result中故newNode存在于result中
  217. } else if (node.parent == null) { //该叶节点没有父节点,即为根节点
  218. delete node.parent; //删除该节点的parent属性,如果有的话
  219. if (this.result == null) { //根节点不存在
  220. node.children = []; //给该节点增加children:[]属性
  221. node.state = {
  222. "opened": true
  223. };
  224. node.typeName = "type";
  225. node.label =node.category;
  226. return this.result = node; //该节点赋给result,并return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  227. } else {
  228. node.children = [];
  229. node.state = {
  230. "opened": true
  231. };
  232. node.typeName = "type";
  233. node.label =node.category;
  234. // 顶级去重
  235. for (var i = 0; i < this.result.children.length; i++) {
  236. if (this.result.children[i][this.attributeName] === node[this.attributeName]) {
  237. return this.result.children[i];
  238. }
  239. }
  240. this.result.children.push(node)
  241. return node // 直接return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  242. }
  243. }
  244. },
  245. getWhole: function (nodes, attributeName) { //传入整个叶子节点数组,attributeName作为节点唯一标识符属性,返回整个转化结果
  246. var _node = {};
  247. _node.children = [];
  248. this.result = _node; //重置根节点
  249. this.attributeName = attributeName == null ? 'id' : attributeName; //唯一标识符默认为“id”
  250. nodes = JSON.parse(JSON.stringify(nodes)); //复制出一个新的节点对象作为参数,保证不改变原有数据
  251. nodes.forEach(item => { //循环调用转化方法
  252. this.needFind = true; //重置开启节点是否已存在判断,保证不插入重复节点
  253. this.transform(item);
  254. })
  255. return this.result; //返回根节点
  256. }
  257. }
  258. var result = treeConverter.getWhole(nodes); //调用
  259. return result;
  260. }
  261. $scope.try_async_load = function (key) {
  262. $scope.my_data = [];
  263. $scope.doing_async = true;
  264. var data = {
  265. "idx": 0,
  266. "sum": 1000
  267. };
  268. if (key) {
  269. data.incidentcategory = {
  270. category: key
  271. }
  272. }
  273. api_bpm_data.fetchDataList('incidentcategory', data).then(function (response) {
  274. var data = response.list;
  275. var objects = [];
  276. // for (var i = 0; i < data.length; i++) {
  277. // var object = {};
  278. // object.id = data[i].id;
  279. // if (angular.isDefined(data[i].parent)) {
  280. // object.parent = data[i].parent;
  281. // }
  282. // if (angular.isDefined(data[i].hasArea)) {
  283. // object.hasArea = data[i].hasArea;
  284. // }
  285. // if (angular.isDefined(data[i].hasSimple)) {
  286. // object.hasSimple = data[i].hasSimple;
  287. // }
  288. // if (angular.isDefined(data[i].group)) {
  289. // object.group = data[i].group;
  290. // }
  291. // object.label = data[i].category;
  292. // // object.actions = data[i][3]; //权限部分
  293. // // object.group = "1";
  294. // // object.user = "2";
  295. // object.state = {
  296. // "opened": true
  297. // };
  298. // object.typeName = "type";
  299. // // if()
  300. // // if (object.actions.indexOf("2") >= 0) { //知识库类型 具有增加权限--系统管理员
  301. // $scope.showAddSolutionType = true;
  302. // // }
  303. // // if (object.actions.indexOf("5") >= 0) { //知识库类型 具有授权权限--系统管理员
  304. // $scope.showReviewKnowledgeType = true;
  305. // // }
  306. // objects.push(object);
  307. // }
  308. // $scope.my_data = convertParentToChildList(objects);
  309. // $scope.tree_data = angular.copy($scope.my_data);
  310. var li = transform(response.list).children;
  311. console.log(li)
  312. $scope.my_data=li
  313. if ($scope.my_data.length > 0) {
  314. $scope.doing_async = false;
  315. }
  316. console.log($scope.my_data)
  317. });
  318. };
  319. $scope.adddata = {};
  320. $scope.addparent = false;
  321. /* -----end submit incidet category----- */
  322. $scope.try_async_load();
  323. // 获取故障描述
  324. // $scope.jry_incidentDescription = scope.$parent.$parent.$parent.model.incident.description;
  325. // if (scope.$parent.$parent.$parent.model.incident.dept.id) {
  326. // $scope.deptDatas.deptShow = scope.$parent.$parent.$parent.model.incident.dept.dept;
  327. // } else {
  328. // $scope.deptDatas.deptShow = "未知科室";
  329. // }
  330. $scope.jry_getUser = function () {
  331. var data = {
  332. "idx": 0,
  333. "sum": 1000,
  334. "user": {
  335. "selectType": "pinyin_qs",
  336. "user": ""
  337. }
  338. };
  339. api_user_data.fetchDataList("user", data).then(function (res) {
  340. $scope.jry_user = res.list
  341. })
  342. }
  343. $scope.jry_getUser();
  344. //报修科室
  345. var getDept = function () {
  346. var deptData = {
  347. "idx": 0,
  348. "sum": 999,
  349. "department": {
  350. "department": "",
  351. "selectType": "pinyin_qs"
  352. }
  353. };
  354. api_user_data.fetchDataList("department", deptData).then(function (data) {
  355. $scope.jry_deptData = data.list
  356. })
  357. }
  358. getDept()
  359. // 报修科室模糊搜索
  360. $scope.jry_deptSearch = function (key, item) {
  361. console.log(item)
  362. var deptData = {
  363. "idx": 0,
  364. "sum": 999,
  365. "department": {
  366. "department": key,
  367. "selectType": "pinyin_qs"
  368. }
  369. };
  370. api_user_data.fetchDataList("department", deptData).then(function (data) {
  371. $scope.jry_deptData = data.list
  372. })
  373. }
  374. // 直接处理
  375. $scope.handleNow = function () {
  376. }
  377. // 快速派单
  378. $scope.sendOrder = function () {
  379. console.log($scope.incidentModel);
  380. if (!$scope.incidentModel.department) {
  381. SweetAlert.swal({
  382. title: "操作失败",
  383. text: "请先填写报修科室!",
  384. type: "error"
  385. });
  386. } else if (!$scope.incidentModel.contactsInformation) {
  387. SweetAlert.swal({
  388. title: "操作失败",
  389. text: "请先填写联系电话!",
  390. type: "error"
  391. });
  392. } else if (!$scope.incidentModel.houseNumber) {
  393. SweetAlert.swal({
  394. title: "操作失败",
  395. text: "请先填写故障地点!",
  396. type: "error"
  397. });
  398. } else if (!$scope.incidentModel.description) {
  399. SweetAlert.swal({
  400. title: "操作失败",
  401. text: "请先填写故障描述!",
  402. type: "error"
  403. });
  404. }
  405. return
  406. if (!$scope.jry_incidentDescription) {
  407. SweetAlert.swal({
  408. title: "操作失败",
  409. text: "请先填写故障描述!",
  410. type: "error"
  411. });
  412. } else {
  413. if (scope.$parent.$parent.$parent.model.incident.formKey == "temporaryStorage") {
  414. api_bpm_domain.complete(scope.$parent.$parent.$parent.model.incident.taskId, $rootScope.user.id, scope.$parent.$parent.$parent.model).then(function (response) {
  415. if (response) {
  416. var resData = Restangular.stripRestangular(response);
  417. SweetAlert.swal({
  418. title: "提交成功!",
  419. type: "success",
  420. confirmButtonColor: "#007AFF"
  421. }, function () {
  422. $modalInstance.dismiss('cancel');
  423. $state.go('app.incident.list', {});
  424. $rootScope.jry_shixian();
  425. });
  426. } else {
  427. SweetAlert.swal({
  428. title: "系统错误",
  429. text: "系统错误,请稍后重试!",
  430. type: "error",
  431. confirmButtonColor: "#DD6B55"
  432. }, function () {
  433. $modalInstance.dismiss('cancel');
  434. $state.go('app.incident.list', {});
  435. });
  436. }
  437. $scope.ldloading[style.replace('-', '_')] = false;
  438. });
  439. } else {
  440. if (scope.$parent.$parent.$parent.model.openModel) {
  441. scope.$parent.$parent.$parent.model.incident.callcode = $scope.jry_myPhoneId
  442. }
  443. if (scope.$parent.$parent.$parent.model.incident.closecode) {
  444. delete scope.$parent.$parent.$parent.model.incident.closecode
  445. }
  446. if (scope.$parent.$parent.$parent.model.incident.degree) {
  447. delete scope.$parent.$parent.$parent.model.incident.degree
  448. }
  449. if (scope.$parent.$parent.$parent.model.incident.label) {
  450. delete scope.$parent.$parent.$parent.model.incident.label
  451. }
  452. if (scope.$parent.$parent.$parent.model.incident.handleDescription) {
  453. delete scope.$parent.$parent.$parent.model.incident.handleDescription
  454. }
  455. if (scope.$parent.$parent.$parent.model.incident.handlingPersonnelUser) {
  456. // delete scope.$parent.$parent.$parent.model.incident.handlingPersonnelUser
  457. }
  458. scope.$parent.$parent.$parent.model.directClose = false;
  459. scope.$parent.$parent.$parent.model.incident.isRelation = false;
  460. // scope.$parent.$parent.$parent.model.incident["handlingPersonnelUser"]=scope.$parent.$parent.$parent.model.incident.acceptUser;
  461. scope.$parent.$parent.$parent.model["start_code"] = "assignment";
  462. scope.$parent.$parent.$parent.model["initUser"] = $rootScope.user.id;
  463. scope.$parent.$parent.$parent.model.incident.description = $scope.jry_incidentDescription;
  464. scope.$parent.$parent.$parent.model.incident.priority.id = $scope.toFormData.priority.id;
  465. scope.$parent.$parent.$parent.model.incident.complexity.id = $scope.toFormData.weight.id;
  466. scope.$parent.$parent.$parent.model.incident.complexity.name = $scope.toFormData.weight.name;
  467. scope.$parent.$parent.$parent.model.incident.title = $scope.toFormData.categoryid.category;
  468. scope.$parent.$parent.$parent.model.incident.category = $scope.toFormData.categoryid;
  469. scope.$parent.$parent.$parent.model.incident["describes"] = {
  470. id: $scope.toFormData.id
  471. };
  472. if ($rootScope.ola_callAccept) {
  473. scope.$parent.$parent.$parent.model.incident["callID"] = $rootScope.ola_callAccept
  474. }
  475. if ($scope.deptDatas.deptShow) {
  476. if (scope.$parent.$parent.$parent.model.incident.dept.id) {
  477. } else if ($scope.deptDatas.deptShow.id) {
  478. scope.$parent.$parent.$parent.model.incident.dept = $scope.deptDatas.deptShow;
  479. scope.$parent.$parent.$parent.model.incident['faultLocation'] = $scope.deptDatas.deptShow.address
  480. } else {
  481. scope.$parent.$parent.$parent.model.incident.dept = $scope.DEP;
  482. scope.$parent.$parent.$parent.model.incident['faultLocation'] = $scope.DEP.address
  483. }
  484. }
  485. scope.$parent.$parent.$parent.model.incident['receviedCall'] = scope.$parent.$parent.$parent.model.incident.contactsInformation
  486. console.log(scope.$parent.$parent.$parent.model)
  487. api_bpm_domain.start("bpm_incident", scope.$parent.$parent.$parent.model).then(function (res) {
  488. if (res) {
  489. SweetAlert.swal({
  490. title: "保存成功!",
  491. type: "success",
  492. confirmButtonColor: "#007AFF"
  493. }, function () {
  494. $modalInstance.dismiss('cancel');
  495. $state.go('app.incident.list', {});
  496. $rootScope.jry_shixian();
  497. });
  498. } else {
  499. SweetAlert.swal({
  500. title: "系统错误",
  501. text: "系统错误,请稍后重试!",
  502. type: "error",
  503. confirmButtonColor: "#DD6B55"
  504. }, function () {
  505. $modalInstance.dismiss('cancel');
  506. $state.go('app.incident.list', {});
  507. });
  508. }
  509. })
  510. }
  511. }
  512. }
  513. // 暂存
  514. $scope.temporary = function () {
  515. // 暂存界面
  516. if (scope.$parent.$parent.$parent.model.incident.formKey == "temporaryStorage") {
  517. // 判断是否选择了故障现象
  518. if ($scope.toFormData) {
  519. scope.$parent.$parent.$parent.model.incident.priority.id = $scope.toFormData.priority.id;
  520. scope.$parent.$parent.$parent.model.incident.complexity.id = $scope.toFormData.weight.id;
  521. scope.$parent.$parent.$parent.model.incident.complexity.name = $scope.toFormData.weight.name;
  522. scope.$parent.$parent.$parent.model.incident.title = $scope.toFormData.categoryid.category;
  523. scope.$parent.$parent.$parent.model.incident.category = $scope.toFormData.categoryid;
  524. scope.$parent.$parent.$parent.model.incident["describes"] = {
  525. id: $scope.toFormData.id
  526. };
  527. }
  528. // 判断是否填写了故障描述
  529. if ($scope.jry_incidentDescription) {
  530. scope.$parent.$parent.$parent.model.incident.description = $scope.jry_incidentDescription;
  531. }
  532. var data = {
  533. incident: scope.$parent.$parent.$parent.model.incident
  534. }
  535. api_user_data.jry_updData("incident", data).then(function (response) {
  536. if (response.status == 200) {
  537. SweetAlert.swal({
  538. title: "提交成功!",
  539. type: "success",
  540. confirmButtonColor: "#007AFF"
  541. }, function () {
  542. $modalInstance.dismiss('cancel');
  543. $state.go('app.incident.list');
  544. });
  545. } else {
  546. SweetAlert.swal({
  547. title: "系统错误",
  548. text: "系统错误,请稍后重试!",
  549. type: "error",
  550. confirmButtonColor: "#DD6B55"
  551. });
  552. }
  553. })
  554. // 新建事件
  555. } else {
  556. // 判断是否选择了故障现象
  557. if ($scope.toFormData) {
  558. scope.$parent.$parent.$parent.model.incident.priority.id = $scope.toFormData.priority.id;
  559. scope.$parent.$parent.$parent.model.incident.complexity.id = $scope.toFormData.weight.id;
  560. scope.$parent.$parent.$parent.model.incident.complexity.name = $scope.toFormData.weight.name;
  561. scope.$parent.$parent.$parent.model.incident.title = $scope.toFormData.categoryid.category;
  562. scope.$parent.$parent.$parent.model.incident.category = $scope.toFormData.categoryid;
  563. scope.$parent.$parent.$parent.model.incident["describes"] = {
  564. id: $scope.toFormData.id
  565. };
  566. }
  567. // 判断是否填写了故障描述
  568. if ($scope.jry_incidentDescription) {
  569. scope.$parent.$parent.$parent.model.incident.description = $scope.jry_incidentDescription;
  570. }
  571. scope.$parent.$parent.$parent.model["initUser"] = $rootScope.user.id;
  572. scope.$parent.$parent.$parent.model.start_code = "temporary";
  573. api_bpm_domain.start('bpm_incident', scope.$parent.$parent.$parent.model).then(function (response) {
  574. SweetAlert.swal({
  575. title: "保存成功!",
  576. confirmButtonColor: "#007AFF"
  577. }, function () {
  578. $modalInstance.dismiss('cancel');
  579. $state.go("app.incident.list");
  580. });
  581. });
  582. }
  583. }
  584. // 取消
  585. $scope.cancel = function () {
  586. }
  587. // $scope.ldloading={};
  588. // var filterData = {
  589. // key: 'null',
  590. // status: 0,
  591. // pageIndex: 0,
  592. // pageSum: 10,
  593. // //treeIds:'[]',
  594. // userId: loginUser.id
  595. // }
  596. $scope.$on('$destroy', function () {
  597. $interval.cancel($scope.timer)
  598. });
  599. }]);