workflowEntrance.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  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. let listss = {
  202. userId: _this.nextDealManLists, //人员id
  203. taskId: this.list.taskId, //表单标识
  204. loginstr: JSON.parse(window.sessionStorage.userInfo).loginNoStr,
  205. // taskName: this.clicknextName, //流程节点
  206. content: this.textarea, //意见内容
  207. };
  208. (obj.url = _this.$url.formList.getNewTransferTask + _this.list.taskId), //下一步工作流接口
  209. (obj.status = "form"),
  210. (obj.data = listss);
  211. }
  212. await _this.common.httpPost(obj, success);
  213. function success(data) {
  214. // let list = {
  215. // taskId: data.taskid,
  216. // id: _this.list.id,
  217. // // resourceId: _this.nodes.currentShape[0].resourceId,
  218. // // taskName: _this.nodes.nextShapes[0].properties.name,
  219. // };
  220. _this.$emit("beforeClose", true);
  221. }
  222. },
  223. //生成需求决策编号接口
  224. getDemand() {
  225. this.$http({
  226. url: "/market/waf/getBusi",
  227. method: "post",
  228. headers: {
  229. "Content-Type": "application/json",
  230. },
  231. data: {},
  232. }).then((res) => {
  233. console.log(res);
  234. this.demand = res.data;
  235. });
  236. },
  237. submitWork() {
  238. //生成需求决策编号
  239. if (this.clicknextName === "起草人发送") {
  240. this.getDemand();
  241. }
  242. if (!this.list.taskId) {
  243. this.$message.error("请先保存表单后处理");
  244. return false;
  245. }
  246. if (this.TransferStatus === true) {
  247. if (this.backThree.length > 0) {
  248. this.nextWork();
  249. } else {
  250. this.$message.error("请选择候选人");
  251. return false;
  252. }
  253. } else {
  254. let list = {
  255. userId: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员id
  256. taskId: this.list.taskId, //表单标识
  257. taskName: this.clicknextName, //流程节点
  258. userCode: JSON.parse(window.sessionStorage.userInfo).loginNo, //人员code
  259. content: this.textarea, //意见内容
  260. // resolution: this.nodes.currentShape[0].condition.resolution, //流程图线节点
  261. // nextDealMan: this.backThree[0].loginNoStr || '', //下一步处理人
  262. };
  263. if (this.treeCopyList.length) {
  264. //抄送
  265. list.copyman = this.treeCopyList[0].loginNoStrCopy;
  266. }
  267. if (this.nodes.currentShape) {
  268. list.resolution = this.nodes.currentShape[0].condition.resolution;
  269. list.approve = this.nodes.currentShape[0].condition.approve;
  270. }
  271. // if (this.clicknextName === "") {
  272. // this.$message.error("请选择流程节点");
  273. // return false;
  274. // }
  275. if (this.initialList.nextShapes[0].multi.multi === "true") {
  276. if (this.backThree.length > 0) {
  277. // list.nextDealManList = this.backThree[0].loginNoStr;
  278. list.nextDealManList = "qiuyu,fanyan";
  279. }
  280. } else {
  281. if (this.backThree.length > 0) {
  282. list.nextDealMan = this.backThree[0].loginNoStr;
  283. } else {
  284. if (this.clicknextName === "流程结束") {
  285. } else {
  286. this.$message.error("请选择候选人");
  287. return false;
  288. }
  289. }
  290. }
  291. // if (this.backThree.length > 0) {
  292. // list.nextDealMan = this.backThree[0].loginNoStr;
  293. // } else {
  294. // if (this.clicknextName === "流程结束") {
  295. // } else {
  296. // this.$message.error("请选择候选人");
  297. // return false;
  298. // }
  299. // }
  300. this.nextWork(list);
  301. }
  302. },
  303. async nextWork(list) {
  304. //e:yes||no,list:传入数组,title:结束标签,res:驳回标签,id:工单更新id
  305. let _this = this;
  306. let obj = {
  307. url: _this.$url.formList.nextWork, //下一步工作流接口
  308. data: list,
  309. status: "form",
  310. };
  311. if (_this.TransferStatus === true) {
  312. let lists = {
  313. userId: _this.backThree[0].loginNoStr,
  314. taskId: _this.list.taskId,
  315. content: _this.textarea,
  316. };
  317. obj.url = _this.$url.formList.transferTask + _this.list.taskId;
  318. obj.data = lists;
  319. }
  320. await this.common.httpPost(obj, success);
  321. function success(data) {
  322. if (data != null) {
  323. if (_this.TransferStatus === true) {
  324. let list = {
  325. taskId: data.taskid,
  326. id: _this.list.id,
  327. };
  328. _this.setUpdate(list);
  329. } else {
  330. let list = {
  331. taskId: data.taskid,
  332. id: _this.list.id,
  333. resourceId: _this.nodes.currentShape[0].resourceId,
  334. taskName: _this.nodes.nextShapes[0].properties.name,
  335. };
  336. if (data.copytaskid) {
  337. list.copytaskid = data.copytaskid;
  338. list.copyman = _this.treeCopyList[0].loginNoStrCopy;
  339. }
  340. if (_this.demand) {
  341. list.needNo = _this.demand;
  342. }
  343. _this.setUpdate(list);
  344. }
  345. } else {
  346. let list = {
  347. taskName: "结束",
  348. id: _this.list.id,
  349. };
  350. _this.setUpdate(list);
  351. }
  352. }
  353. },
  354. // qqq() {
  355. // this.$emit("beforeClose", true);
  356. // },
  357. //更新工作流接口
  358. setUpdate(e) {
  359. this.$http({
  360. url: "/market/waf/update",
  361. method: "post",
  362. headers: {
  363. "Content-Type": "application/json",
  364. },
  365. data: e,
  366. }).then((res) => {
  367. this.$emit("beforeClose", true);
  368. // this.fromList.taskId = res.data.body.taskId;
  369. // this.fromList.taskName = res.data.body.taskName;
  370. // if (res.data.body.taskName === "起草") {
  371. // this.isSync = res.data.body.isSync;
  372. // } else {
  373. // this.isSync = "1";
  374. // }
  375. // if (res.data.result === 0) {
  376. // this.$message.success("工作流更新成功");
  377. // }
  378. });
  379. },
  380. //查询路径接口
  381. getNextPath(e, status) {
  382. let list = {
  383. // fresourceId: "bf79721c-33f3-11ed-ba0b-00505687dcd3", //测试环境
  384. fresourceId: this.requestForm.fresourceId, // 本地环境
  385. processId: this.requestForm.processDefinitionKey,
  386. // fresourceId: "0d94de8a-0281-11ed-a302-4ae7da54db39", // 本地环境
  387. // processId: "request_form_process",
  388. // resourceId: e,
  389. };
  390. if (e) {
  391. // this.propsList = [];
  392. list.resourceId = e;
  393. }
  394. this.$http({
  395. url: "/market/waf/queryPath",
  396. method: "post",
  397. headers: {
  398. "Content-Type": "application/json",
  399. },
  400. data: list,
  401. }).then((res) => {
  402. if (status === 1) {
  403. //第一次进入取路径
  404. this.initialList = res.data.body;
  405. // console.log(this.initialList);
  406. // if (
  407. // this.initialList.nextShapes[0].multi?.multi &&
  408. // res.data.body.nextShapes[0].multi.multi === "true"
  409. // ) {
  410. // }
  411. }
  412. if (status === 2) {
  413. if (res.data.body.nextShapes[0].condition !== null) {
  414. this.node = res.data.body;
  415. } else {
  416. this.getNextPath(res.data.body.nextShapes[0].resourceId, 2);
  417. }
  418. }
  419. if (status === 3) {
  420. this.nodes = res.data.body;
  421. this.getTreeLists(res.data.body, 1);
  422. }
  423. });
  424. },
  425. //查询候选人接口
  426. getTreeLists(e, status) {
  427. if (e === 9) {
  428. this.close = ""
  429. this.active = this.active != "" ? '' : 'active'
  430. this.actives = ""
  431. this.MultipersonTransfer = true;
  432. } else {
  433. this.MultipersonTransfer = false;
  434. }
  435. let id = this.initialList.nextShapes[0].properties.documentation;
  436. // if (status === 2) {
  437. // id = "copy." + e;
  438. // } else {
  439. // id =
  440. // e.nextShapes[0].properties.documentation == "createId" ||
  441. // e.nextShapes[0].properties.documentation == "createId-copy"
  442. // ? this.list.createId
  443. // : e.nextShapes[0].properties.documentation;
  444. // }
  445. this.$http({
  446. url: "/market/api/user/info/queryNodePers?params=" + id,
  447. method: "post",
  448. headers: {
  449. "Content-Type": "application/json",
  450. },
  451. data: "",
  452. }).then((res) => {
  453. console.log(status);
  454. if (status === 2) {
  455. this.treeCopyList = res.data; //抄送
  456. console.log(this.treeCopyList);
  457. // this.$refs.defTrees.treeList = res.data;
  458. } else {
  459. this.treeList = res.data; //抄送
  460. // this.$refs.defTree.treeList = res.data;
  461. console.log(this.treeList);
  462. }
  463. });
  464. },
  465. //转派按钮方法
  466. a() {
  467. this.clickGetTree([], "");
  468. },
  469. clickTransfer(e) {
  470. if (e == 1) {
  471. // this.TransferStatus = true;
  472. } else if (e == 2) {
  473. this.CopyStatus = true;
  474. }
  475. this.getTreeLists(this.initialList, e);
  476. },
  477. //点击节点获取下一步的处理人字段
  478. clickGetTree(e, index) {
  479. // this.CopyStatus = false;
  480. this.TransferStatus = false;
  481. // this.clickTaskName = e.properties.name;
  482. this.clicknextName = e.properties.name;
  483. this.seleIndex = index;
  484. this.getNextPath(e.resourceId, 3); //1 为点击后获取线
  485. },
  486. //点击常用意见方法
  487. clickCommonly(e) {
  488. this.textarea = e.currentTarget.innerHTML;
  489. },
  490. //点击修改
  491. clickEdit() {
  492. console.log(123);
  493. this.editStatus = true;
  494. },
  495. //选择树的回调
  496. changeTree(e) {
  497. if (this.MultipersonTransfer) {
  498. // if (e.length > 1) {
  499. // this.$message.error("只能选择一个人");
  500. // return;
  501. // } else {
  502. this.backThree = e;
  503. let arr = [];
  504. this.backThree.map((item) => {
  505. arr.push(item.loginNoStr);
  506. });
  507. this.nextDealManLists = arr.toString();
  508. }
  509. // }
  510. },
  511. //获取字典表常用意见
  512. getMetirialType(e) {
  513. this.$http({
  514. url: "/market/cfgDataDict/queryList",
  515. method: "post",
  516. headers: {
  517. "Content-Type": "application/json",
  518. },
  519. data: {
  520. dictCodePks: "approval",
  521. },
  522. }).then((res) => {
  523. console.log(res);
  524. this.commonlyList = res.data;
  525. });
  526. },
  527. //添加字典表常用意见
  528. geaddctType(e) {
  529. this.$http({
  530. url: "/market/cfgDataDict/add",
  531. method: "post",
  532. headers: {
  533. "Content-Type": "application/json",
  534. },
  535. data: e,
  536. }).then((res) => {
  537. this.getMetirialType();
  538. });
  539. },
  540. //删除字典表常用意见
  541. geDelectType(e) {
  542. this.$http({
  543. url: "/market/cfgDataDicts/del",
  544. method: "post",
  545. headers: {
  546. "Content-Type": "application/json",
  547. },
  548. data: e,
  549. }).then((res) => {
  550. this.getMetirialType();
  551. });
  552. },
  553. //常用意见添加
  554. addStatus() {
  555. let newData = Date.parse(new Date());
  556. this.$prompt("请输入常用意见", "提示", {
  557. confirmButtonText: "确定",
  558. cancelButtonText: "取消",
  559. })
  560. .then(({ value }) => {
  561. let list = {
  562. dictCode: "approval",
  563. dataCode: newData,
  564. dataName: value,
  565. dictName: "审批意见",
  566. };
  567. this.geaddctType(list);
  568. this.$message({
  569. type: "success",
  570. message: "常用意见添加成功",
  571. });
  572. })
  573. .catch(() => {
  574. this.$message({
  575. type: "info",
  576. message: "取消输入",
  577. });
  578. });
  579. },
  580. //常用意见删除
  581. deleStatus(e) {
  582. this.$confirm("此操作将删除此常用意见, 是否继续?", "提示", {
  583. confirmButtonText: "确定",
  584. cancelButtonText: "取消",
  585. type: "warning",
  586. })
  587. .then(() => {
  588. let list = {
  589. dataCode: e.dataCode,
  590. dictCode: "approval",
  591. };
  592. this.geDelectType(list);
  593. this.$message({
  594. type: "success",
  595. message: "删除成功!",
  596. });
  597. })
  598. .catch(() => {
  599. this.$message({
  600. type: "info",
  601. message: "已取消删除",
  602. });
  603. });
  604. },
  605. //关闭修改
  606. editCloses() {
  607. this.editStatus = false;
  608. },
  609. },
  610. };
  611. </script>
  612. <style lang='scss' scoped>
  613. .active {
  614. background-color: #f3faff;
  615. }
  616. .actives {
  617. background-color: #f3faff;
  618. }
  619. .flex-header-text-tree {
  620. width: 50%;
  621. text-align: center;
  622. }
  623. .flex-icon {
  624. float: right;
  625. margin-right: 20px;
  626. color: #4277a1;
  627. }
  628. .flex-handle {
  629. width: 100%;
  630. padding: 30px;
  631. display: flex;
  632. .flex-right {
  633. width: 50%;
  634. border: 1px solid #e1e1e1;
  635. margin-left: 20px;
  636. }
  637. }
  638. .flex-left {
  639. width: 50%;
  640. display: flex;
  641. flex-direction: column;
  642. .flex-left-header {
  643. display: flex;
  644. justify-content: space-around;
  645. .flex-path {
  646. height: 280px;
  647. border: 1px solid #e1e1e1;
  648. width: 68%;
  649. }
  650. }
  651. }
  652. .flex-common {
  653. padding: 10px 5%;
  654. font-size: 18px;
  655. }
  656. .flex-left-header-text {
  657. height: 40px;
  658. line-height: 40px;
  659. color: black;
  660. padding-left: 10px;
  661. background-color: #cde4f6;
  662. font-size: 18px;
  663. font-weight: bold;
  664. }
  665. .flex-path-list {
  666. overflow-y: scroll;
  667. overflow-x: hidden;
  668. height: 14rem;
  669. }
  670. .flex-slide {
  671. overflow-y: scroll;
  672. overflow-x: hidden;
  673. }
  674. .active {
  675. background-color: #f3faff;
  676. }
  677. .flex-opinion {
  678. height: 280px;
  679. border: 1px solid #e1e1e1;
  680. width: 100%;
  681. margin-top: 20px;
  682. }
  683. .flex-right-text {
  684. margin-right: 20px;
  685. width: 50%;
  686. }
  687. .flex-commons {
  688. height: 280px;
  689. border: 1px solid #e1e1e1;
  690. width: 30%;
  691. }
  692. .flex-footer-botton {
  693. display: flex;
  694. justify-content: space-evenly;
  695. }
  696. .flex-button {
  697. margin-top: 10px;
  698. margin-bottom: 10px;
  699. ::v-deep .el-button--primary {
  700. width: 222px;
  701. }
  702. }
  703. </style>