newOrderCtrl.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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. engineer: 1,
  338. }
  339. };
  340. api_user_data.fetchDataList("user", data).then(function (res) {
  341. $scope.jry_user = res.list
  342. })
  343. }
  344. $scope.jry_getUser();
  345. //报修科室
  346. var getDept = function () {
  347. var deptData = {
  348. "idx": 0,
  349. "sum": 999,
  350. "department": {
  351. "department": "",
  352. "selectType": "pinyin_qs"
  353. }
  354. };
  355. api_user_data.fetchDataList("department", deptData).then(function (data) {
  356. $scope.jry_deptData = data.list
  357. })
  358. }
  359. getDept()
  360. // 报修科室模糊搜索
  361. $scope.jry_deptSearch = function (key, item) {
  362. console.log(item)
  363. var deptData = {
  364. "idx": 0,
  365. "sum": 999,
  366. "department": {
  367. "department": key,
  368. "selectType": "pinyin_qs"
  369. }
  370. };
  371. api_user_data.fetchDataList("department", deptData).then(function (data) {
  372. $scope.jry_deptData = data.list
  373. })
  374. }
  375. // 直接处理
  376. $scope.handleNow = function () {
  377. }
  378. // 快速派单
  379. $scope.sendOrder = function () {
  380. console.log($scope.incidentModel);
  381. if (!$scope.incidentModel.department) {
  382. SweetAlert.swal({
  383. title: "操作失败",
  384. text: "请先填写报修科室!",
  385. type: "error"
  386. });
  387. } else if (!$scope.incidentModel.contactsInformation) {
  388. SweetAlert.swal({
  389. title: "操作失败",
  390. text: "请先填写联系电话!",
  391. type: "error"
  392. });
  393. } else if (!$scope.incidentModel.houseNumber) {
  394. SweetAlert.swal({
  395. title: "操作失败",
  396. text: "请先填写故障地点!",
  397. type: "error"
  398. });
  399. } else if (!$scope.incidentModel.description) {
  400. SweetAlert.swal({
  401. title: "操作失败",
  402. text: "请先填写故障描述!",
  403. type: "error"
  404. });
  405. }
  406. return
  407. if (!$scope.jry_incidentDescription) {
  408. SweetAlert.swal({
  409. title: "操作失败",
  410. text: "请先填写故障描述!",
  411. type: "error"
  412. });
  413. } else {
  414. if (scope.$parent.$parent.$parent.model.incident.formKey == "temporaryStorage") {
  415. api_bpm_domain.complete(scope.$parent.$parent.$parent.model.incident.taskId, $rootScope.user.id, scope.$parent.$parent.$parent.model).then(function (response) {
  416. if (response) {
  417. var resData = Restangular.stripRestangular(response);
  418. SweetAlert.swal({
  419. title: "提交成功!",
  420. type: "success",
  421. confirmButtonColor: "#007AFF"
  422. }, function () {
  423. $modalInstance.dismiss('cancel');
  424. $state.go('app.incident.list', {});
  425. $rootScope.jry_shixian();
  426. });
  427. } else {
  428. SweetAlert.swal({
  429. title: "系统错误",
  430. text: "系统错误,请稍后重试!",
  431. type: "error",
  432. confirmButtonColor: "#DD6B55"
  433. }, function () {
  434. $modalInstance.dismiss('cancel');
  435. $state.go('app.incident.list', {});
  436. });
  437. }
  438. $scope.ldloading[style.replace('-', '_')] = false;
  439. });
  440. } else {
  441. if (scope.$parent.$parent.$parent.model.openModel) {
  442. scope.$parent.$parent.$parent.model.incident.callcode = $scope.jry_myPhoneId
  443. }
  444. if (scope.$parent.$parent.$parent.model.incident.closecode) {
  445. delete scope.$parent.$parent.$parent.model.incident.closecode
  446. }
  447. if (scope.$parent.$parent.$parent.model.incident.degree) {
  448. delete scope.$parent.$parent.$parent.model.incident.degree
  449. }
  450. if (scope.$parent.$parent.$parent.model.incident.label) {
  451. delete scope.$parent.$parent.$parent.model.incident.label
  452. }
  453. if (scope.$parent.$parent.$parent.model.incident.handleDescription) {
  454. delete scope.$parent.$parent.$parent.model.incident.handleDescription
  455. }
  456. if (scope.$parent.$parent.$parent.model.incident.handlingPersonnelUser) {
  457. // delete scope.$parent.$parent.$parent.model.incident.handlingPersonnelUser
  458. }
  459. scope.$parent.$parent.$parent.model.directClose = false;
  460. scope.$parent.$parent.$parent.model.incident.isRelation = false;
  461. // scope.$parent.$parent.$parent.model.incident["handlingPersonnelUser"]=scope.$parent.$parent.$parent.model.incident.acceptUser;
  462. scope.$parent.$parent.$parent.model["start_code"] = "assignment";
  463. scope.$parent.$parent.$parent.model["initUser"] = $rootScope.user.id;
  464. scope.$parent.$parent.$parent.model.incident.description = $scope.jry_incidentDescription;
  465. scope.$parent.$parent.$parent.model.incident.priority.id = $scope.toFormData.priority.id;
  466. scope.$parent.$parent.$parent.model.incident.complexity.id = $scope.toFormData.weight.id;
  467. scope.$parent.$parent.$parent.model.incident.complexity.name = $scope.toFormData.weight.name;
  468. scope.$parent.$parent.$parent.model.incident.title = $scope.toFormData.categoryid.category;
  469. scope.$parent.$parent.$parent.model.incident.category = $scope.toFormData.categoryid;
  470. scope.$parent.$parent.$parent.model.incident["describes"] = {
  471. id: $scope.toFormData.id
  472. };
  473. if ($rootScope.ola_callAccept) {
  474. scope.$parent.$parent.$parent.model.incident["callID"] = $rootScope.ola_callAccept
  475. }
  476. if ($scope.deptDatas.deptShow) {
  477. if (scope.$parent.$parent.$parent.model.incident.dept.id) {
  478. } else if ($scope.deptDatas.deptShow.id) {
  479. scope.$parent.$parent.$parent.model.incident.dept = $scope.deptDatas.deptShow;
  480. scope.$parent.$parent.$parent.model.incident['faultLocation'] = $scope.deptDatas.deptShow.address
  481. } else {
  482. scope.$parent.$parent.$parent.model.incident.dept = $scope.DEP;
  483. scope.$parent.$parent.$parent.model.incident['faultLocation'] = $scope.DEP.address
  484. }
  485. }
  486. scope.$parent.$parent.$parent.model.incident['receviedCall'] = scope.$parent.$parent.$parent.model.incident.contactsInformation
  487. console.log(scope.$parent.$parent.$parent.model)
  488. api_bpm_domain.start("bpm_incident", scope.$parent.$parent.$parent.model).then(function (res) {
  489. if (res) {
  490. SweetAlert.swal({
  491. title: "保存成功!",
  492. type: "success",
  493. confirmButtonColor: "#007AFF"
  494. }, function () {
  495. $modalInstance.dismiss('cancel');
  496. $state.go('app.incident.list', {});
  497. $rootScope.jry_shixian();
  498. });
  499. } else {
  500. SweetAlert.swal({
  501. title: "系统错误",
  502. text: "系统错误,请稍后重试!",
  503. type: "error",
  504. confirmButtonColor: "#DD6B55"
  505. }, function () {
  506. $modalInstance.dismiss('cancel');
  507. $state.go('app.incident.list', {});
  508. });
  509. }
  510. })
  511. }
  512. }
  513. }
  514. // 暂存
  515. $scope.temporary = function () {
  516. // 暂存界面
  517. if (scope.$parent.$parent.$parent.model.incident.formKey == "temporaryStorage") {
  518. // 判断是否选择了故障现象
  519. if ($scope.toFormData) {
  520. scope.$parent.$parent.$parent.model.incident.priority.id = $scope.toFormData.priority.id;
  521. scope.$parent.$parent.$parent.model.incident.complexity.id = $scope.toFormData.weight.id;
  522. scope.$parent.$parent.$parent.model.incident.complexity.name = $scope.toFormData.weight.name;
  523. scope.$parent.$parent.$parent.model.incident.title = $scope.toFormData.categoryid.category;
  524. scope.$parent.$parent.$parent.model.incident.category = $scope.toFormData.categoryid;
  525. scope.$parent.$parent.$parent.model.incident["describes"] = {
  526. id: $scope.toFormData.id
  527. };
  528. }
  529. // 判断是否填写了故障描述
  530. if ($scope.jry_incidentDescription) {
  531. scope.$parent.$parent.$parent.model.incident.description = $scope.jry_incidentDescription;
  532. }
  533. var data = {
  534. incident: scope.$parent.$parent.$parent.model.incident
  535. }
  536. api_user_data.jry_updData("incident", data).then(function (response) {
  537. if (response.status == 200) {
  538. SweetAlert.swal({
  539. title: "提交成功!",
  540. type: "success",
  541. confirmButtonColor: "#007AFF"
  542. }, function () {
  543. $modalInstance.dismiss('cancel');
  544. $state.go('app.incident.list');
  545. });
  546. } else {
  547. SweetAlert.swal({
  548. title: "系统错误",
  549. text: "系统错误,请稍后重试!",
  550. type: "error",
  551. confirmButtonColor: "#DD6B55"
  552. });
  553. }
  554. })
  555. // 新建事件
  556. } else {
  557. // 判断是否选择了故障现象
  558. if ($scope.toFormData) {
  559. scope.$parent.$parent.$parent.model.incident.priority.id = $scope.toFormData.priority.id;
  560. scope.$parent.$parent.$parent.model.incident.complexity.id = $scope.toFormData.weight.id;
  561. scope.$parent.$parent.$parent.model.incident.complexity.name = $scope.toFormData.weight.name;
  562. scope.$parent.$parent.$parent.model.incident.title = $scope.toFormData.categoryid.category;
  563. scope.$parent.$parent.$parent.model.incident.category = $scope.toFormData.categoryid;
  564. scope.$parent.$parent.$parent.model.incident["describes"] = {
  565. id: $scope.toFormData.id
  566. };
  567. }
  568. // 判断是否填写了故障描述
  569. if ($scope.jry_incidentDescription) {
  570. scope.$parent.$parent.$parent.model.incident.description = $scope.jry_incidentDescription;
  571. }
  572. scope.$parent.$parent.$parent.model["initUser"] = $rootScope.user.id;
  573. scope.$parent.$parent.$parent.model.start_code = "temporary";
  574. api_bpm_domain.start('bpm_incident', scope.$parent.$parent.$parent.model).then(function (response) {
  575. SweetAlert.swal({
  576. title: "保存成功!",
  577. confirmButtonColor: "#007AFF"
  578. }, function () {
  579. $modalInstance.dismiss('cancel');
  580. $state.go("app.incident.list");
  581. });
  582. });
  583. }
  584. }
  585. // 取消
  586. $scope.cancel = function () {
  587. }
  588. // $scope.ldloading={};
  589. // var filterData = {
  590. // key: 'null',
  591. // status: 0,
  592. // pageIndex: 0,
  593. // pageSum: 10,
  594. // //treeIds:'[]',
  595. // userId: loginUser.id
  596. // }
  597. $scope.$on('$destroy', function () {
  598. $interval.cancel($scope.timer)
  599. });
  600. }]);