| | |
| | | <!-- |
| | | * @Date: 2025-06-18 09:17:09 |
| | | * @Date: 2025-08-10 14:14:58 |
| | | * @LastEditors: gaoshp |
| | | * @LastEditTime: 2025-07-23 22:20:42 |
| | | * @LastEditTime: 2025-08-17 08:40:49 |
| | | * @FilePath: /mdmweb/src/views/flowmgr/processQuery.vue |
| | | --> |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" v-model="form" ref="crud" |
| | | @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange" |
| | | @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" |
| | | @selection-change="selectionChange"> |
| | | <template #menu-left> |
| | | <!-- <el-button type="primary" plain @click="exportWebSite">导出回传涉密网</el-button> --> |
| | | <!-- <el-button type="primary" plain @click="reassign">挂载车床程序库</el-button> --> |
| | | <!-- <el-button type="primary" plain @click="exportExcel">导出到EXCEL</el-button> --> |
| | | <el-button type="primary" plain @click="reassign">重新指派 |
| | | </el-button> |
| | | </template> |
| | | <template #menu="scope"> |
| | | <el-button type="primary" text size="default" v-if="scope.row.processDefinitionKey === 'dispatch'" |
| | | @click.stop="handleAction(scope.row, scope.index, 1)">审批表打印 |
| | | </el-button> |
| | | <el-button type="danger" text size="default" @click.stop="handleAction(scope.row, scope.index, 0)">删除 |
| | | </el-button> |
| | | |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="指派" append-to-body v-model="reassignBox" width="30%"> |
| | | <avue-form ref="reassginform" :option="reassignOption" v-model="reassignForm" |
| | | @submit="toPerson"></avue-form> |
| | | </el-dialog> |
| | | <el-tabs |
| | | v-model="activeName" |
| | | type="card" |
| | | class="demo-tabs" |
| | | > |
| | | <el-tab-pane label="进行中" name="todo"> |
| | | <processQuery1 v-if="activeName==='todo'"></processQuery1> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="已结束" name="done"> |
| | | <processQuery2 v-if="activeName==='done'"> </processQuery2> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getList, deleteRow, printRow } from '@/api/flowmgr/processQuery.js'; |
| | | import { getAssignee, reassgin } from '@/api/flow/todolist'; |
| | | import { exportBlobPost } from '@/api/common'; |
| | | import NProgress from 'nprogress'; |
| | | import { downloadFile } from '@/utils/util'; |
| | | import 'nprogress/nprogress.css'; |
| | | |
| | | import processQuery1 from './processQuery1.vue'; |
| | | import processQuery2 from './processQuery2.vue'; |
| | | export default { |
| | | name: 'MachineReturnFileOp', |
| | | components: { |
| | | processQuery2, |
| | | processQuery1 |
| | | }, |
| | | data() { |
| | | return { |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }, |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | data: [], |
| | | option: { |
| | | addBtn: false, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | viewBtn: true, |
| | | columnBtn: false, |
| | | tip: false, |
| | | // simplePage: true, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | dialogWidth: '60%', |
| | | // tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | |
| | | menuWidth: 200, |
| | | // menu: false, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: '流程类型', |
| | | prop: 'processDefinitionKey', |
| | | search: true, |
| | | searchType: 'select', |
| | | hide: true, |
| | | dicUrl: `/blade-mdm/system/dict/dictionary?code=flow`, |
| | | props: { |
| | | label: 'dictValue', |
| | | value: 'remark', |
| | | }, |
| | | }, |
| | | { |
| | | label: '创建时间', |
| | | prop: 'createTime', |
| | | type: 'datetime', |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | search: true, |
| | | searchRange: true, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: '关键字', |
| | | prop: 'keyword', |
| | | search: true, |
| | | searchType: 'input', |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: '流程名称', |
| | | prop: 'processDefinitionName', |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: '机床', |
| | | prop: '', |
| | | render: ({ row }) => { |
| | | return h('p', |
| | | { |
| | | attrs: {}, |
| | | class: {}, |
| | | style: {}, |
| | | }, row?.variables?.machineCode) |
| | | } |
| | | }, |
| | | { |
| | | label: '创建人', |
| | | prop: 'startUserName', |
| | | }, |
| | | { |
| | | label: '工序名称', |
| | | prop: '', |
| | | render: ({ row }) => { |
| | | return h('p', |
| | | { |
| | | attrs: {}, |
| | | class: {}, |
| | | style: {}, |
| | | }, row?.variables?.processName) |
| | | } |
| | | }, |
| | | { |
| | | label: '创建时间', |
| | | prop: 'processCreateTime', |
| | | }, |
| | | { |
| | | label: '当前节点', |
| | | prop: 'taskName', |
| | | }, |
| | | ], |
| | | |
| | | }, |
| | | selectedList: [], |
| | | reassignBox: false, |
| | | reassignForm: {}, |
| | | reassignOption: { |
| | | submitBtn: true, |
| | | emptyBtn: false, |
| | | column: [ |
| | | { |
| | | label: '发送给', |
| | | prop: 'newAssigneeId', |
| | | type: 'select', |
| | | // dicUrl: `/blade-mdm/flow/flow-user-list?deptId=0`, |
| | | // dicFlag: true, |
| | | props: { |
| | | label: 'name', |
| | | value: 'id', |
| | | }, |
| | | span: 24, |
| | | disabled: false, |
| | | dicData: [ |
| | | |
| | | ], |
| | | rules: [{ required: true, message: '请输入选择', trigger: 'blur' }], |
| | | }, |
| | | { |
| | | label: '备注', |
| | | span: 24, |
| | | prop: 'comment', |
| | | type: 'textarea', |
| | | rules: [{ required: true, message: '请输入审批意见', trigger: 'blur' }], |
| | | }, |
| | | ], |
| | | }, |
| | | } |
| | | }, |
| | | mounted() { |
| | | getAssignee().then(res => { |
| | | this.reassignOption.column[0].dicData = res.data.data; |
| | | }) |
| | | activeName: 'todo', |
| | | }; |
| | | }, |
| | | methods: { |
| | | reassign() {// 重新指派 |
| | | console.log(this.selectedList.length) |
| | | if (this.selectedList.length === 0) { |
| | | this.$message.warning('请选择需要重新指派的任务'); |
| | | return; |
| | | } |
| | | if (this.selectedList.length > 1) { |
| | | this.$message.warning('请选择一条'); |
| | | return; |
| | | } |
| | | this.reassignBox = true; |
| | | handleTabClick(tab, event) { |
| | | console.log(tab, event); |
| | | }, |
| | | toPerson(form, done) { |
| | | this.$confirm('请确认是否指派', '', { |
| | | confirmButtonText: this.$t('submitText'), |
| | | cancelButtonText: this.$t('cancelText'), |
| | | type: 'warning', |
| | | }).then(() => { |
| | | console.log('toPerson', form); |
| | | reassgin({ |
| | | ...form, |
| | | taskId: this.selectedList[0].taskId, |
| | | processInstanceId: this.selectedList[0].processInstanceId, |
| | | }).then(res => { |
| | | this.$message.success('指派成功'); |
| | | this.reassignBox = false; |
| | | this.$refs?.reassginform?.resetForm(); |
| | | this.onLoad(this.page, this.query); |
| | | |
| | | }).catch(err => { |
| | | console.error(err); |
| | | }) |
| | | }); |
| | | done(); |
| | | }, |
| | | handleAction(row, index, flag) { |
| | | if (flag === 0) { |
| | | // 处理接受或拒绝操作 |
| | | let ids = [row.id].toString(); |
| | | this.$confirm('确定将选择数据删除?', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | deleteRow({ processInstanceId: row.processInstanceId,id:row.processInstanceId }).then(res => { |
| | | this.onLoad(this.page, this.query); |
| | | }) |
| | | }) |
| | | } else if (flag === 1) { |
| | | printRow({ processInstanceId: row.processInstanceId }) |
| | | this.$confirm('是否导出?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | console.log(this.selection) |
| | | NProgress.start(); |
| | | exportBlobPost( |
| | | `/blade-mdm/flow/mgr/export-approve-table`, |
| | | { processInstanceId: row.processInstanceId }, |
| | | { processInstanceId: row.processInstanceId }, |
| | | ).then(res => { |
| | | let name = res.headers['content-disposition'].split('filename=')[1] |
| | | console.log(res.headers['content-disposition'].split('filename=')[1]); |
| | | downloadFile(res.data, `审批打印-${name}`); |
| | | NProgress.done(); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | selectionChange(list) { |
| | | console.log('selectionChange', list); |
| | | this.selectedList = list; |
| | | }, |
| | | // exportWebSite() { |
| | | // if (this.selectedList.length === 0) { |
| | | // this.$message.warning('请先选择需要导出的数据'); |
| | | // return; |
| | | // } |
| | | // this.$confirm('是否导出?', '提示', { |
| | | // confirmButtonText: '确定', |
| | | // cancelButtonText: '取消', |
| | | // type: 'warning', |
| | | // }).then(() => { |
| | | // NProgress.start(); |
| | | // exportBlob( |
| | | // `/blade-mdm/machineback/filehandle/export-to-inner`, |
| | | // { |
| | | // ids: this.selectedList.map(item => item.id).join(','), |
| | | // } |
| | | // ).then(res => { |
| | | // downloadXls(res.data, `导出回传涉密网${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`); |
| | | // NProgress.done(); |
| | | // }); |
| | | // }); |
| | | // }, |
| | | // exportExcel() { |
| | | // if (this.selectedList.length === 0) { |
| | | // this.$message.warning('请先选择需要导出的数据'); |
| | | // return; |
| | | // } |
| | | // this.$confirm('是否导出?', '提示', { |
| | | // confirmButtonText: '确定', |
| | | // cancelButtonText: '取消', |
| | | // type: 'warning', |
| | | // }).then(() => { |
| | | // NProgress.start(); |
| | | // exportBlob( |
| | | // `/blade-mdm/machineback/filehandle/export-excel?${this.website.tokenHeader}=${getToken()}` |
| | | // ).then(res => { |
| | | // downloadXls(res.data, `导出机床回传程序${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`); |
| | | // NProgress.done(); |
| | | // }); |
| | | // }); |
| | | // }, |
| | | searchChange(params, done) { |
| | | let data = {} |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | console.log('searchChange', params); |
| | | params.createTimeBegin = params?.createTime?.[0] || ''; |
| | | params.createTimeEnd = params?.createTime?.[1] || ''; |
| | | console.log(params); |
| | | // data = { |
| | | // createTimeBegin: dayjs(params.createTimeBegin).isValid() ? dayjs(params.createTimeBegin).format('YYYY-MM-DD') : '', |
| | | // createTimeEnd: dayjs(params.createTimeEnd).isValid() ? dayjs(params.createTimeEnd).format('YYYY-MM-DD') : '', |
| | | // keyword: params.keyword || '' |
| | | // } |
| | | data = { |
| | | createTimeBegin: params.createTimeBegin || undefined, |
| | | createTimeEnd: params.createTimeEnd || undefined, |
| | | keyword: params.keyword || undefined, |
| | | processDefinitionKey: params.processDefinitionKey || undefined |
| | | } |
| | | this.query = data |
| | | this.onLoad(this.page, data); |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | let data = {} |
| | | this.query = data; |
| | | this.page.currentPage = 1; |
| | | data = { |
| | | createTimeBegin: params.createTimeBegin, |
| | | createTimeEnd: params.createTimeEnd, |
| | | keyword: params.keyword || '', |
| | | processDefinitionKey: params.processDefinitionKey || '' |
| | | } |
| | | this.onLoad(this.page, data); |
| | | done(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | // this.onLoad(); |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | /** * 页面加载时获取数据 |
| | | */ |
| | | onLoad(page, params = {}) { |
| | | console.log('onLoad', page, params); |
| | | const data = { |
| | | ...this.query, |
| | | createTimeBegin: params.createTimeBegin, |
| | | createTimeEnd: params.createTimeEnd, |
| | | keyword: params.keyword || '', |
| | | processDefinitionKey: params.processDefinitionKey || '' |
| | | }; |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, Object.assign(data, params)).then(res => { |
| | | const data = res.data.data |
| | | this.page.total = data.total; |
| | | this.data = data.records.map(v=> { |
| | | return { |
| | | ...v, |
| | | id: v.processInstanceId, |
| | | } |
| | | }); |
| | | this.loading = false; |
| | | }, () => { |
| | | this.data = []; |
| | | this.loading = false; |
| | | }).catch(err => { |
| | | this.data = []; |
| | | this.loading = false; |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped></style> |
| | | }, |
| | | } |
| | | </script> |