workflowBaseshoubu.vue 20 KB

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