workflowEntrance.vue 21 KB

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