workflowEntrance.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. <template>
  2. <div>
  3. <div class="flex-handle">
  4. <!-- <button @click="qqq">123</button> -->
  5. <div class="flex-left">
  6. <div class="flex-left-header">
  7. <div class="flex-path">
  8. <div class="flex-left-header-text">
  9. 选择路径
  10. <div class="flex-path-list">
  11. <div :class="active" @click="getTreeLists(9)">转派</div>
  12. <div :class="actives" @click="getclose()">结束</div>
  13. <!-- <div
  14. v-for="(item, index) in node.nextShapes"
  15. :key="index"
  16. :class="seleIndex == index ? 'active' : ''"
  17. @click="clickGetTree(item, index)"
  18. >
  19. {{ item.properties.name }}
  20. </div> -->
  21. </div>
  22. </div>
  23. </div>
  24. <div class="flex-commons">
  25. <div class="flex-left-header-text">
  26. 常用意见
  27. <span @click="clickEdit" class="flex-icon"><i class="el-icon-edit"></i>修改</span>
  28. </div>
  29. <div class="flex-slide">
  30. <div v-for="(item, index) in commonlyList" :key="index" ref="common" class="flex-common"
  31. @click="clickCommonly($event)">
  32. {{ item.dataName }}
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="flex-opinion">
  38. <div class="flex-left-header-text">意见内容</div>
  39. <el-input type="textarea" autosize placeholder="请输入内容" v-model="textarea">
  40. </el-input>
  41. </div>
  42. </div>
  43. <!-- :class="{ copyClass: CopyStatus }" -->
  44. <!-- :class="{ 'flex-right-text': CopyStatus }" -->
  45. <div class="flex-right">
  46. <div class="flex-left-header-text">
  47. 本部门人员办理
  48. <div style="display: flex">
  49. <div class="flex-header-text-tree">
  50. 候选人
  51. <deptTree ref="defTree" class="flex-slide" :treeList="treeList" @changeTree="changeTree" />
  52. </div>
  53. <div class="flex-header-text-tree">
  54. 已选人员
  55. <div class="" v-for="(item, index) in backThree" :key="index">
  56. {{ item.loginNameStr }}
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <!-- <div v-if="CopyStatus" class="flex-left-header-text flex-right-text">
  62. 抄送人员
  63. <div style="display: flex">
  64. <div class="flex-header-text-tree">
  65. 抄送人
  66. <deptTree
  67. ref="defTrees"
  68. class="flex-slide"
  69. :treeList="treeCopyList"
  70. @changeTree="changeTreeCopy"
  71. />
  72. </div>
  73. <div class="flex-header-text-tree">
  74. 已选人员
  75. <div class="">{{ copyUser }}</div>
  76. </div>
  77. </div>
  78. </div> -->
  79. </div>
  80. </div>
  81. <div class="flex-footer-botton">
  82. <div class="flex-button">
  83. <el-button type="primary" @click="getnewtransfertask(1)">提交</el-button>
  84. </div>
  85. </div>
  86. <el-dialog title="修改常用意见" :visible.sync="editStatus" width="100%" :before-close="editCloses" :modal="false"
  87. :destroy-on-close="true">
  88. <div style="overflow-y: scroll; overflow-x: hidden; height: 240px">
  89. <div v-for="(item, index) in commonlyList" :key="index" ref="common" class="flex-common">
  90. {{
  91. item.dataName
  92. }}<i class="el-icon-circle-close" @click="deleStatus(item)"></i>
  93. </div>
  94. <div class="flex-common">
  95. <i class="el-icon-circle-plus-outline" @click="addStatus()"></i>
  96. </div>
  97. </div>
  98. </el-dialog>
  99. </div>
  100. </template>
  101. <script>
  102. import deptTree from "./workDeptThree.vue";
  103. export default {
  104. components: {
  105. deptTree,
  106. },
  107. name: "workflow",
  108. data() {
  109. return {
  110. active: '',
  111. actives: '',
  112. MultipersonTransfer: false,
  113. transferStatus: false, //转派按钮控制
  114. TransferStatus: false, //是否点击转派状态
  115. copyStatus: false, //抄送按钮控制
  116. CopyStatus: false, //是否点击抄送状态
  117. node: [], //路径列表
  118. seleIndex: "", //点击路径下标
  119. commonlyList: [], //常用意见数组
  120. textarea: "未填写意见", //意见内容字段
  121. copyUser: "", //抄送人员列表
  122. selectUser: "", //已选人员列表
  123. treeList: [], // 待选人员列表
  124. propsList: [],
  125. nodes: [],
  126. initialList: [], //第一次进入是加载节点
  127. clicknextName: "", //获取的流程节点
  128. backThree: [],
  129. editStatus: false, //修改控制显示字段
  130. treeCopyList: [],
  131. demand: "",
  132. close: "",
  133. nextDealManLists: []
  134. };
  135. },
  136. props: {
  137. // 表格数据和表格部分属性的对象
  138. // eslint-disable-next-line vue/require-default-prop
  139. list: {
  140. type: Object,
  141. },
  142. requestForm: {
  143. type: Object,
  144. },
  145. lastManList: {
  146. type: Object,
  147. },
  148. },
  149. created() {
  150. this.getNextPath(this.list.resourceId, 1);
  151. this.getMetirialType();
  152. },
  153. methods: {
  154. getclose() {
  155. this.backThree = [];
  156. this.treeList = [];
  157. this.close = "1";
  158. this.actives = this.actives != "" ? "" : 'actives'
  159. this.active = ""
  160. },
  161. // async getqueryMultiTaskId() {
  162. // let list = {
  163. // procinstid: this.list.processId,
  164. // userId: JSON.parse(window.sessionStorage.userInfo).loginNo,
  165. // // procinstid:this.fromList.processId
  166. // // taskId:e.taskId
  167. // };
  168. // let _this = this;
  169. // let obj = {
  170. // url: this.$url.formList.getQueryMultiTaskId, //流程追踪接口
  171. // data: list,
  172. // headers: {
  173. // "Content-Type": "application/json",
  174. // },
  175. // };
  176. // let res = await this.common.httpPost(obj, success);
  177. // function success(data) {
  178. // console.log(data);
  179. // _this.list.taskId = data.taskid;
  180. // }
  181. // },
  182. //新转派接口
  183. async getnewtransfertask() {
  184. let _this = this;
  185. let list = {
  186. userId: "",
  187. userId: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员id
  188. taskId: this.list.taskId, //表单标识
  189. procinstid: this.list.processId,
  190. // taskName: this.clicknextName, //流程节点
  191. userCode: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员code
  192. content: this.textarea, //意见内容
  193. resourceId: this.list.resourceId
  194. };
  195. let obj = {};
  196. if (this.close == "1") {
  197. (list.userId = JSON.parse(window.sessionStorage.userInfo).loginNo),
  198. (obj.url = _this.$url.formList.getComplateLastMan), //下一步工作流接口
  199. (obj.data = list);
  200. } else {
  201. console.log(this.nextDealManLists);
  202. if (this.nextDealManLists.length == 0) {
  203. this.$message.error("请选择人员");
  204. return false;
  205. }
  206. let listss = {
  207. userId: _this.nextDealManLists.toString(), //人员id
  208. taskId: this.list.taskId, //表单标识
  209. loginstr: JSON.parse(window.sessionStorage.userInfo).loginNoStr,
  210. // taskName: this.clicknextName, //流程节点
  211. content: this.textarea, //意见内容
  212. };
  213. (obj.url = _this.$url.formList.getNewTransferTask + _this.list.taskId), //下一步工作流接口
  214. (obj.status = "form"),
  215. (obj.data = listss);
  216. }
  217. await _this.common.httpPost(obj, success);
  218. function success(data) {
  219. // let list = {
  220. // taskId: data.taskid,
  221. // id: _this.list.id,
  222. // // resourceId: _this.nodes.currentShape[0].resourceId,
  223. // // taskName: _this.nodes.nextShapes[0].properties.name,
  224. // };
  225. _this.$emit("beforeClose", true);
  226. }
  227. },
  228. //生成需求决策编号接口
  229. getDemand() {
  230. this.$http({
  231. url: "/market/waf/getBusi",
  232. method: "post",
  233. headers: {
  234. "Content-Type": "application/json",
  235. },
  236. data: {},
  237. }).then((res) => {
  238. console.log(res);
  239. this.demand = res.data;
  240. });
  241. },
  242. submitWork() {
  243. //生成需求决策编号
  244. if (this.clicknextName === "起草人发送") {
  245. this.getDemand();
  246. }
  247. if (!this.list.taskId) {
  248. this.$message.error("请先保存表单后处理");
  249. return false;
  250. }
  251. if (this.TransferStatus === true) {
  252. if (this.backThree.length > 0) {
  253. this.nextWork();
  254. } else {
  255. this.$message.error("请选择候选人");
  256. return false;
  257. }
  258. } else {
  259. let list = {
  260. userId: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员id
  261. taskId: this.list.taskId, //表单标识
  262. taskName: this.clicknextName, //流程节点
  263. userCode: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员code
  264. content: this.textarea, //意见内容
  265. // resolution: this.nodes.currentShape[0].condition.resolution, //流程图线节点
  266. // nextDealMan: this.backThree[0].loginNoStr || '', //下一步处理人
  267. };
  268. if (this.treeCopyList.length) {
  269. //抄送
  270. list.copyman = this.treeCopyList[0].loginNoStrCopy;
  271. }
  272. if (this.nodes.currentShape) {
  273. list.resolution = this.nodes.currentShape[0].condition.resolution;
  274. list.approve = this.nodes.currentShape[0].condition.approve;
  275. }
  276. // if (this.clicknextName === "") {
  277. // this.$message.error("请选择流程节点");
  278. // return false;
  279. // }
  280. if (this.initialList.nextShapes[0].multi.multi === "true") {
  281. if (this.backThree.length > 0) {
  282. // list.nextDealManList = this.backThree[0].loginNoStr;
  283. list.nextDealManList = "qiuyu,fanyan";
  284. }
  285. } else {
  286. if (this.backThree.length > 0) {
  287. list.nextDealMan = this.backThree[0].loginNoStr;
  288. } else {
  289. if (this.clicknextName === "流程结束") {
  290. } else {
  291. this.$message.error("请选择候选人");
  292. return false;
  293. }
  294. }
  295. }
  296. // if (this.backThree.length > 0) {
  297. // list.nextDealMan = this.backThree[0].loginNoStr;
  298. // } else {
  299. // if (this.clicknextName === "流程结束") {
  300. // } else {
  301. // this.$message.error("请选择候选人");
  302. // return false;
  303. // }
  304. // }
  305. this.nextWork(list);
  306. }
  307. },
  308. async nextWork(list) {
  309. //e:yes||no,list:传入数组,title:结束标签,res:驳回标签,id:工单更新id
  310. let _this = this;
  311. let obj = {
  312. url: _this.$url.formList.nextWork, //下一步工作流接口
  313. data: list,
  314. status: "form",
  315. };
  316. if (_this.TransferStatus === true) {
  317. let lists = {
  318. userId: _this.backThree[0].loginNoStr,
  319. taskId: _this.list.taskId,
  320. content: _this.textarea,
  321. };
  322. obj.url = _this.$url.formList.transferTask + _this.list.taskId;
  323. obj.data = lists;
  324. }
  325. await this.common.httpPost(obj, success);
  326. function success(data) {
  327. if (data != null) {
  328. if (_this.TransferStatus === true) {
  329. let list = {
  330. taskId: data.taskid,
  331. id: _this.list.id,
  332. };
  333. _this.setUpdate(list);
  334. } else {
  335. let list = {
  336. taskId: data.taskid,
  337. id: _this.list.id,
  338. resourceId: _this.nodes.currentShape[0].resourceId,
  339. taskName: _this.nodes.nextShapes[0].properties.name,
  340. };
  341. if (data.copytaskid) {
  342. list.copytaskid = data.copytaskid;
  343. list.copyman = _this.treeCopyList[0].loginNoStrCopy;
  344. }
  345. if (_this.demand) {
  346. list.needNo = _this.demand;
  347. }
  348. _this.setUpdate(list);
  349. }
  350. } else {
  351. let list = {
  352. taskName: "结束",
  353. id: _this.list.id,
  354. };
  355. _this.setUpdate(list);
  356. }
  357. }
  358. },
  359. // qqq() {
  360. // this.$emit("beforeClose", true);
  361. // },
  362. //更新工作流接口
  363. setUpdate(e) {
  364. this.$http({
  365. url: "/market/waf/update",
  366. method: "post",
  367. headers: {
  368. "Content-Type": "application/json",
  369. },
  370. data: e,
  371. }).then((res) => {
  372. this.$emit("beforeClose", true);
  373. // this.fromList.taskId = res.data.body.taskId;
  374. // this.fromList.taskName = res.data.body.taskName;
  375. // if (res.data.body.taskName === "起草") {
  376. // this.isSync = res.data.body.isSync;
  377. // } else {
  378. // this.isSync = "1";
  379. // }
  380. // if (res.data.result === 0) {
  381. // this.$message.success("工作流更新成功");
  382. // }
  383. });
  384. },
  385. //查询路径接口
  386. getNextPath(e, status) {
  387. let list = {
  388. // fresourceId: "bf79721c-33f3-11ed-ba0b-00505687dcd3", //测试环境
  389. fresourceId: this.requestForm.fresourceId, // 本地环境
  390. processId: this.requestForm.processDefinitionKey,
  391. // fresourceId: "0d94de8a-0281-11ed-a302-4ae7da54db39", // 本地环境
  392. // processId: "request_form_process",
  393. // resourceId: e,
  394. };
  395. if (e) {
  396. // this.propsList = [];
  397. list.resourceId = e;
  398. }
  399. this.$http({
  400. url: "/market/waf/queryPath",
  401. method: "post",
  402. headers: {
  403. "Content-Type": "application/json",
  404. },
  405. data: list,
  406. }).then((res) => {
  407. if (status === 1) {
  408. //第一次进入取路径
  409. this.initialList = res.data.body;
  410. // console.log(this.initialList);
  411. // if (
  412. // this.initialList.nextShapes[0].multi?.multi &&
  413. // res.data.body.nextShapes[0].multi.multi === "true"
  414. // ) {
  415. // }
  416. }
  417. if (status === 2) {
  418. if (res.data.body.nextShapes[0].condition !== null) {
  419. this.node = res.data.body;
  420. } else {
  421. this.getNextPath(res.data.body.nextShapes[0].resourceId, 2);
  422. }
  423. }
  424. if (status === 3) {
  425. this.nodes = res.data.body;
  426. this.getTreeLists(res.data.body, 1);
  427. }
  428. });
  429. },
  430. //查询候选人接口
  431. getTreeLists(e, status) {
  432. if (e === 9) {
  433. this.close = ""
  434. this.active = this.active != "" ? '' : 'active'
  435. this.actives = ""
  436. this.MultipersonTransfer = true;
  437. } else {
  438. this.MultipersonTransfer = false;
  439. }
  440. let id = this.initialList.nextShapes[0].properties.documentation;
  441. // if (status === 2) {
  442. // id = "copy." + e;
  443. // } else {
  444. // id =
  445. // e.nextShapes[0].properties.documentation == "createId" ||
  446. // e.nextShapes[0].properties.documentation == "createId-copy"
  447. // ? this.list.createId
  448. // : e.nextShapes[0].properties.documentation;
  449. // }
  450. this.$http({
  451. url: "/market/api/user/info/queryNodePers?params=" + id,
  452. method: "post",
  453. headers: {
  454. "Content-Type": "application/json",
  455. },
  456. data: "",
  457. }).then((res) => {
  458. console.log(status);
  459. if (status === 2) {
  460. this.treeCopyList = res.data; //抄送
  461. console.log(this.treeCopyList);
  462. // this.$refs.defTrees.treeList = res.data;
  463. } else {
  464. this.treeList = res.data; //抄送
  465. // this.$refs.defTree.treeList = res.data;
  466. console.log(this.treeList);
  467. }
  468. });
  469. },
  470. //转派按钮方法
  471. a() {
  472. this.clickGetTree([], "");
  473. },
  474. clickTransfer(e) {
  475. if (e == 1) {
  476. // this.TransferStatus = true;
  477. } else if (e == 2) {
  478. this.CopyStatus = true;
  479. }
  480. this.getTreeLists(this.initialList, e);
  481. },
  482. //点击节点获取下一步的处理人字段
  483. clickGetTree(e, index) {
  484. // this.CopyStatus = false;
  485. this.TransferStatus = false;
  486. // this.clickTaskName = e.properties.name;
  487. this.clicknextName = e.properties.name;
  488. this.seleIndex = index;
  489. this.getNextPath(e.resourceId, 3); //1 为点击后获取线
  490. },
  491. //点击常用意见方法
  492. clickCommonly(e) {
  493. this.textarea = e.currentTarget.innerHTML;
  494. },
  495. //点击修改
  496. clickEdit() {
  497. console.log(123);
  498. this.editStatus = true;
  499. },
  500. //选择树的回调
  501. changeTree(e) {
  502. if (this.MultipersonTransfer) {
  503. // if (e.length > 1) {
  504. // this.$message.error("只能选择一个人");
  505. // return;
  506. // } else {
  507. this.backThree = e;
  508. let arr = [];
  509. this.backThree.map((item) => {
  510. arr.push(item.loginNoStr);
  511. });
  512. this.nextDealManLists = arr;
  513. }
  514. // }
  515. },
  516. //获取字典表常用意见
  517. getMetirialType(e) {
  518. this.$http({
  519. url: "/market/cfgDataDict/queryList",
  520. method: "post",
  521. headers: {
  522. "Content-Type": "application/json",
  523. },
  524. data: {
  525. dictCodePks: "approval",
  526. },
  527. }).then((res) => {
  528. console.log(res);
  529. this.commonlyList = res.data;
  530. });
  531. },
  532. //添加字典表常用意见
  533. geaddctType(e) {
  534. this.$http({
  535. url: "/market/cfgDataDict/add",
  536. method: "post",
  537. headers: {
  538. "Content-Type": "application/json",
  539. },
  540. data: e,
  541. }).then((res) => {
  542. this.getMetirialType();
  543. });
  544. },
  545. //删除字典表常用意见
  546. geDelectType(e) {
  547. this.$http({
  548. url: "/market/cfgDataDicts/del",
  549. method: "post",
  550. headers: {
  551. "Content-Type": "application/json",
  552. },
  553. data: e,
  554. }).then((res) => {
  555. this.getMetirialType();
  556. });
  557. },
  558. //常用意见添加
  559. addStatus() {
  560. let newData = Date.parse(new Date());
  561. this.$prompt("请输入常用意见", "提示", {
  562. confirmButtonText: "确定",
  563. cancelButtonText: "取消",
  564. })
  565. .then(({ value }) => {
  566. let list = {
  567. dictCode: "approval",
  568. dataCode: newData,
  569. dataName: value,
  570. dictName: "审批意见",
  571. };
  572. this.geaddctType(list);
  573. this.$message({
  574. type: "success",
  575. message: "常用意见添加成功",
  576. });
  577. })
  578. .catch(() => {
  579. this.$message({
  580. type: "info",
  581. message: "取消输入",
  582. });
  583. });
  584. },
  585. //常用意见删除
  586. deleStatus(e) {
  587. this.$confirm("此操作将删除此常用意见, 是否继续?", "提示", {
  588. confirmButtonText: "确定",
  589. cancelButtonText: "取消",
  590. type: "warning",
  591. })
  592. .then(() => {
  593. let list = {
  594. dataCode: e.dataCode,
  595. dictCode: "approval",
  596. };
  597. this.geDelectType(list);
  598. this.$message({
  599. type: "success",
  600. message: "删除成功!",
  601. });
  602. })
  603. .catch(() => {
  604. this.$message({
  605. type: "info",
  606. message: "已取消删除",
  607. });
  608. });
  609. },
  610. //关闭修改
  611. editCloses() {
  612. this.editStatus = false;
  613. },
  614. },
  615. };
  616. </script>
  617. <style lang='scss' scoped>
  618. .active {
  619. background-color: #f3faff;
  620. }
  621. .actives {
  622. background-color: #f3faff;
  623. }
  624. .flex-header-text-tree {
  625. width: 50%;
  626. text-align: center;
  627. }
  628. .flex-icon {
  629. float: right;
  630. margin-right: 20px;
  631. color: #4277a1;
  632. }
  633. .flex-handle {
  634. width: 100%;
  635. padding: 30px;
  636. display: flex;
  637. .flex-right {
  638. width: 50%;
  639. border: 1px solid #e1e1e1;
  640. margin-left: 20px;
  641. }
  642. }
  643. .flex-left {
  644. width: 50%;
  645. display: flex;
  646. flex-direction: column;
  647. .flex-left-header {
  648. display: flex;
  649. justify-content: space-around;
  650. .flex-path {
  651. height: 280px;
  652. border: 1px solid #e1e1e1;
  653. width: 68%;
  654. }
  655. }
  656. }
  657. .flex-common {
  658. padding: 10px 5%;
  659. font-size: 18px;
  660. }
  661. .flex-left-header-text {
  662. height: 40px;
  663. line-height: 40px;
  664. color: black;
  665. padding-left: 10px;
  666. background-color: #cde4f6;
  667. font-size: 18px;
  668. font-weight: bold;
  669. }
  670. .flex-path-list {
  671. overflow-y: scroll;
  672. overflow-x: hidden;
  673. height: 14rem;
  674. }
  675. .flex-slide {
  676. overflow-y: scroll;
  677. overflow-x: hidden;
  678. }
  679. .active {
  680. background-color: #f3faff;
  681. }
  682. .flex-opinion {
  683. height: 280px;
  684. border: 1px solid #e1e1e1;
  685. width: 100%;
  686. margin-top: 20px;
  687. }
  688. .flex-right-text {
  689. margin-right: 20px;
  690. width: 50%;
  691. }
  692. .flex-commons {
  693. height: 280px;
  694. border: 1px solid #e1e1e1;
  695. width: 30%;
  696. }
  697. .flex-footer-botton {
  698. display: flex;
  699. justify-content: space-evenly;
  700. }
  701. .flex-button {
  702. margin-top: 10px;
  703. margin-bottom: 10px;
  704. ::v-deep .el-button--primary {
  705. width: 222px;
  706. }
  707. }
  708. </style>