workflow.vue 20 KB

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