index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <template>
  2. <!-- 待办流程 -->
  3. <div class="TodoProcess">
  4. <div class="btnArea">
  5. <el-button type="primary" plain icon="el-icon-search" size="mini" @click="searchData.page = 1;queryLists()">查询</el-button>
  6. <el-button type="primary" icon="el-icon-refresh-left" size="mini" ghost @click="openModal(2)">转派</el-button>
  7. </div>
  8. <FormItemComponent
  9. class="form"
  10. :formItemLists="formLists"
  11. :buttonType="false"
  12. @formChange="formChange"
  13. ></FormItemComponent>
  14. <StandardTabletwo
  15. class="table tabgeu"
  16. :currentPage="searchData.page"
  17. :pageSize="searchData.pageSize"
  18. :total="total"
  19. :columns="columns"
  20. :data="data"
  21. :standardTableEvent="standardTableEvent"
  22. style="height: 400px;"
  23. ></StandardTabletwo>
  24. <Modal
  25. v-model="openControl"
  26. :title="modaltitle"
  27. :mask="true"
  28. :mask-closable="false"
  29. :width="852"
  30. @on-ok="ok"
  31. @on-cancel="cancel"
  32. >
  33. <div class="modalCotent">
  34. <mutipleSelectPop
  35. ref="dialogtest"
  36. :loading="loading"
  37. :resultData="resultData"
  38. :isUse="false"
  39. :isMutiple="false"
  40. :isCallInterface="openControl"
  41. @getResult="getResult"
  42. ></mutipleSelectPop>
  43. </div>
  44. </Modal>
  45. <!-- 详情弹框 -->
  46. <Modal
  47. v-model="modalShow"
  48. title="流程详情"
  49. :width="861"
  50. :closable="true"
  51. :mask="true"
  52. :footer-hide="true"
  53. :mask-closable="false"
  54. >
  55. <FlowChartShow v-if="modalShow" :instanceId="instanceId"></FlowChartShow>
  56. </Modal>
  57. </div>
  58. </template>
  59. <script>
  60. import FormItemComponent from "../FormItemComponent";
  61. import ItemComponent from "../ItemComponent";
  62. import StandardTabletwo from "../StandardTabletwo";
  63. import mutipleSelectPop from "../MutipleSelectPop/index.vue";
  64. import FlowChartShow from "../FlowChartShow";
  65. // import { mapState } from "vuex";
  66. // import { mapMutations } from "vuex";
  67. import {
  68. addGendefini,
  69. addGendefiniqur,
  70. addGendefinideal
  71. } from "@/api/activiti/definition";
  72. export default {
  73. name: "TodoProcess",
  74. components: {
  75. FormItemComponent,
  76. StandardTabletwo,
  77. mutipleSelectPop,
  78. FlowChartShow,
  79. },
  80. props: {
  81. tabalive: { type: String, default: "" }
  82. },
  83. data() {
  84. return {
  85. modaltype: 0,
  86. openControl: false, //弹框是否显示控制
  87. modaltitle: "", //弹框标题
  88. //待办-同意意见/驳回意见
  89. agree: "",
  90. //待办-驳回下拉数据
  91. ApprovalData: [],
  92. selectValue: "", //选中的数据
  93. //表单配置
  94. formLists: [
  95. {
  96. row: 1,
  97. col: 1,
  98. component: ItemComponent,
  99. item: {
  100. type: "input",
  101. title: "工作流编号",
  102. filed: "instanceId",
  103. props: {
  104. regx: /^[0-9]*$/
  105. },
  106. event:{
  107. 'keydown': (event) => {
  108. if(event.keyCode === 13){
  109. this.searchData.page = 1;
  110. this.queryLists()
  111. }
  112. }
  113. }
  114. }
  115. },
  116. {
  117. row: 1,
  118. col: 1,
  119. component: ItemComponent,
  120. item: {
  121. type: "input",
  122. title: "查询索引",
  123. filed: "businessNumber",
  124. event:{
  125. 'keydown': (event) => {
  126. if(event.keyCode === 13){
  127. this.searchData.page = 1;
  128. this.queryLists()
  129. }
  130. }
  131. }
  132. }
  133. },
  134. {
  135. row: 1,
  136. col: 1,
  137. component: ItemComponent,
  138. item: {
  139. type: "select",
  140. title: "单据类型",
  141. filed: "businessType",
  142. options: [
  143. { value: 0, label: "发送成功" },
  144. { value: 1, label: "发送失败(待发送)" },
  145. { value: 2, label: "消费成功" },
  146. { value: 3, label: "消费失败(待消费)" }
  147. ]
  148. }
  149. },
  150. {
  151. row: 1,
  152. col: 1,
  153. component: ItemComponent,
  154. item: {
  155. type: "DatePicker",
  156. title: "开始时间",
  157. filed: "createTime"
  158. }
  159. },
  160. {
  161. row: 1,
  162. col: 1,
  163. component: ItemComponent,
  164. item: {
  165. type: "input",
  166. title: "节点名称",
  167. filed: "nodeName",
  168. event:{
  169. 'keydown': (event) => {
  170. if(event.keyCode === 13){
  171. this.searchData.page = 1;
  172. this.queryLists()
  173. }
  174. }
  175. }
  176. }
  177. }
  178. ],
  179. //查询条件
  180. searchData: {
  181. page: 1,
  182. pageSize: 10,
  183. searchType: "0,1",
  184. excuStatus: 0,
  185. userId: null,
  186. createTime: []
  187. },
  188. //表格数据
  189. total: 0,
  190. columns: [
  191. {
  192. type: "selection",
  193. width: 60,
  194. align: "center"
  195. },
  196. {
  197. title: "工作流编号",
  198. key: "instanceId"
  199. },
  200. {
  201. title: "查询索引",
  202. key: "businessNumber"
  203. },
  204. {
  205. title: "单据类型",
  206. key: "businessName"
  207. },
  208. {
  209. title: "模板名称",
  210. key: "moduleName"
  211. },
  212. {
  213. title: "节点名称",
  214. key: "nodeName"
  215. },
  216. {
  217. title: "审批人",
  218. key: "approverValue",
  219. render: (h, params) => {
  220. return h(
  221. "p",
  222. {
  223. style: {
  224. maxWidth: "160px",
  225. overflow: "hidden",
  226. "text-overflow": "ellipsis",
  227. "white-space": "nowrap"
  228. }
  229. },
  230. params.row.approvers.join(",")
  231. );
  232. }
  233. },
  234. {
  235. title: "发起人",
  236. key: "initiatorName"
  237. },
  238. {
  239. title: "开始时间",
  240. key: "createTime"
  241. },
  242. {
  243. title: "消耗时长",
  244. key: "durationTime"
  245. },
  246. {
  247. title: "流程状态",
  248. key: "processStatusName"
  249. },
  250. {
  251. title: "详情",
  252. fixed: "right",
  253. render: (h, params) => {
  254. return h(
  255. "span",
  256. {
  257. style: {
  258. color: "rgba(16, 142, 233, 1)",
  259. cursor: "pointer"
  260. },
  261. on: {
  262. click: () => {
  263. console.log(params.row.instanceId)
  264. this.modalShow = true;
  265. this.instanceId = params.row.instanceId;
  266. }
  267. }
  268. },
  269. "流程进度"
  270. );
  271. }
  272. }
  273. ],
  274. data: [],
  275. standardTableEvent: {
  276. "on-change": page => {
  277. this.searchData.page = page;
  278. this.queryLists();
  279. },
  280. "on-page-size-change": pageSize => {
  281. this.searchData.page = 1;
  282. this.searchData.pageSize = pageSize;
  283. },
  284. "on-select": (selection, row) => {
  285. //表格行选中事件
  286. let self = this;
  287. self.data.map(item => {
  288. if (item.id === row.id) {
  289. item._check = true;
  290. }
  291. });
  292. },
  293. "on-select-cancel": (selection, row) => {
  294. //表格行取消事件
  295. let self = this;
  296. self.data.map(item => {
  297. if (item.id === row.id) {
  298. item._check = false;
  299. }
  300. });
  301. },
  302. "on-select-all": selection => {
  303. //表格行全部选中
  304. let self = this;
  305. self.data.map(item => {
  306. item._check = true;
  307. });
  308. },
  309. "on-select-all-cancel": selection => {
  310. //表格行全部取消
  311. let self = this;
  312. self.data.map(item => {
  313. item._check = false;
  314. });
  315. }
  316. },
  317. loading: false, // z最大loading
  318. resultData: {}, // 选中结果
  319. open: false, // 是否打开
  320. selectRow: {}, //选中的行
  321. obj: {}, //传给table的对象
  322. modalShow: false,
  323. instanceId: null
  324. };
  325. },
  326. computed: {
  327. // ...mapState(["userInfo"])
  328. },
  329. watch: {
  330. tabalive(newVal, oldVal) {
  331. if (newVal === "待办流程") {
  332. this.getselectOption();
  333. this.queryLists();
  334. }
  335. }
  336. },
  337. methods: {
  338. // ...mapMutations(["currentChange", "checkDetailsOpenWindow"]),
  339. //业务关系下拉数据
  340. getselectOption() {
  341. addGendefini().then(res => {
  342. if (res.resultCode === 0) {
  343. this.formLists.forEach(outer => {
  344. if (outer.item.filed === "businessType") {
  345. outer.item.options = res.data.relations.map(item => {
  346. item.value = item.businesskey;
  347. item.label = item.businessName;
  348. return item;
  349. });
  350. }
  351. });
  352. }
  353. });
  354. },
  355. ////查询
  356. queryLists() {
  357. var that = this
  358. if (
  359. this.searchData.createTime &&
  360. this.searchData.createTime[0] &&
  361. this.searchData.createTime[1]
  362. ) {
  363. this.searchData.startTime = new Date(
  364. this.searchData.createTime[0]
  365. ).format("yyyy-MM-dd hh:mm");
  366. this.searchData.endTime = new Date(
  367. this.searchData.createTime[1]
  368. ).format("yyyy-MM-dd hh:mm");
  369. } else {
  370. this.searchData.startTime = "";
  371. this.searchData.endTime = "";
  372. }
  373. let obj = Object.assign({}, this.searchData);
  374. delete obj.createTime;
  375. var that = this
  376. addGendefiniqur(obj).then(res => {
  377. console.log(res.resultCode)
  378. // that.data = res.data.records
  379. if (res.resultCode === 0) {
  380. console.log(1)
  381. // let data = res.data.data;
  382. this.total = res.total;
  383. this.data = res.data.records;
  384. console.log(res.data.records,23456)
  385. // console.log(this.data,2345)
  386. }
  387. console.log(this.data,2345)
  388. });
  389. },
  390. formChange(data) {
  391. //表单数据修改时,修改searchData数据
  392. this.searchData = Object.assign({}, this.searchData, data);
  393. if (
  394. Object.prototype.toString.call(this.searchData.businessType) ===
  395. "[object Array]" &&
  396. this.searchData.businessType.length === 0
  397. ) {
  398. delete this.searchData.businessType;
  399. }
  400. },
  401. //0同意/1驳回、2转派
  402. batchoperate() {
  403. let self = this;
  404. let sendData = {};
  405. sendData.ids = "";
  406. self.data.map(item => {
  407. if (item._check) {
  408. sendData.ids += item.id + ",";
  409. }
  410. });
  411. sendData.ids = sendData.ids.substring(0, sendData.ids.length - 1);
  412. if(this.resultData.list.length>0){
  413. sendData.delegateId = this.resultData.list[0].ID;
  414. }else{
  415. this.$message({
  416. message: "请选择转派人员",
  417. type: 'warning'
  418. });
  419. // this.$Message.warning("请选择转派人员");
  420. return
  421. }
  422. // sendData.userId = this.userInfo.userId;
  423. addGendefinideal(sendData).then(res => {
  424. let data = res;
  425. if (data.resultCode === 0) {
  426. this.queryLists();
  427. this.msgSuccess(data.resultMsg);
  428. // this.$Message.success();
  429. } else {
  430. this.$message({
  431. message: data.resultMsg,
  432. type: 'warning'
  433. });
  434. // this.$Message.warning(data.resultMsg);
  435. }
  436. });
  437. },
  438. getResult(data) {
  439. this.resultData = Object.assign({}, data);
  440. },
  441. ok() {
  442. this.batchoperate();
  443. // if (this.modaltype === 3) {
  444. // this.setAgent();
  445. // } else {
  446. // this.batchoperate();
  447. // }
  448. },
  449. cancel() {
  450. if(this.resultData.list){
  451. this.resultData.list=[];
  452. this.resultData.total=0;
  453. }
  454. this.openControl = false; //关闭弹框
  455. },
  456. openModal(type) {
  457. this.modaltype = type;
  458. type === 2 || type === 3
  459. ? (this.modaltitle = "选择转派人")
  460. : (this.modaltitle = "选择审批人");
  461. let tableSelectd = [];
  462. this.data.map(item => {
  463. if (item._check) {
  464. tableSelectd.push(item);
  465. }
  466. });
  467. if (tableSelectd.length > 0) {
  468. this.openControl = true;
  469. if(this.resultData.list){
  470. this.resultData.list=[];
  471. this.resultData.total=0;
  472. }
  473. } else {
  474. this.$message({
  475. message: '请选择单据',
  476. type: 'warning'
  477. });
  478. // this.$Message.warning("请选择单据");
  479. }
  480. },
  481. onRowClick(row, index, vm) {
  482. this.selectRow = Object.assign(this.selectRow, row);
  483. }
  484. },
  485. created() {
  486. this.getselectOption();
  487. this.queryLists();
  488. },
  489. mounted() {
  490. // this.getselectOption();
  491. // this.queryLists();
  492. console.log(this.searchData,8765)
  493. }
  494. };
  495. </script>
  496. <style lang="scss">
  497. .TodoProcess {
  498. width: 100%;
  499. display: flex;
  500. flex-direction: column;
  501. .btnArea {
  502. margin-bottom: 10px;
  503. .burgeon-btn {
  504. margin-right: 9px;
  505. &:last-child {
  506. margin-right: 0;
  507. }
  508. }
  509. }
  510. .form {
  511. margin-bottom: 16px;
  512. }
  513. .table {
  514. flex: 1;
  515. }
  516. .tabgeu{
  517. height: 400px !important;
  518. }
  519. }
  520. .modalCotent {
  521. .burgeon-tree {
  522. overflow-y: auto;
  523. }
  524. }
  525. </style>