| | |
| | | <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" @selection-change="selectionChange" |
| | | @search-change="searchChange" @search-reset="searchReset" |
| | | @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"> |
| | | <template #menu-left> |
| | | <el-button type="primary" plain @click="reassign">重新指派 |
| | | </el-button> |
| | | </template> |
| | | <!-- <template #source="{ row }"> |
| | | <div style="text-align: center"> |
| | | <i :class="row.source" /> |
| | | </div> |
| | | </template> --> |
| | | <template #menu="scope"> |
| | | <el-button type="primary" text size="default" v-if="permission.flow_model_update" |
| | | @click.stop="handleAction(scope.row, scope.index)">审批 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="审批" append-to-body v-model="approveBox" width="20%"> |
| | | <avue-form ref="form" :option="optionApprove" v-model="formApprove" @submit="handleSubmit" /> |
| | | <!-- <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="deployBox = false">取 消</el-button> |
| | | <el-button type="primary" @click="handleDoDeploy" :loading="deployLoading">确 定</el-button> |
| | | </span> |
| | | </template> --> |
| | | </el-dialog> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getLazyList, remove, update, add, getMenu } from '@/api/flow/todolist'; |
| | | import { getList, approve } from '@/api/flow/todolist'; |
| | | import { mapGetters } from 'vuex'; |
| | | import iconList from '@/config/iconList'; |
| | | import func from '@/utils/func'; |
| | | import { getMenuTree } from '@/api/system/menu'; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | row: {}, |
| | | approveBox: false, |
| | | formApprove: { |
| | | comment: '', |
| | | approve: 'Y', // 默认同意 |
| | | }, |
| | | optionApprove: { |
| | | labelWidth: 100, |
| | | column: [ |
| | | |
| | | { |
| | | label: '审批结果', |
| | | prop: 'approve', |
| | | type: 'radio', |
| | | span: 24, |
| | | dicData: [ |
| | | { label: '通过', value: 'Y' }, |
| | | { label: '驳回', value: 'N' }, |
| | | ], |
| | | rules: [{ required: true, message: '请选择审批结果', trigger: 'blur' }], |
| | | }, |
| | | { |
| | | label: '备注', |
| | | span: 24, |
| | | prop: 'comment', |
| | | type: 'textarea', |
| | | rules: [{ required: true, message: '请输入审批意见', trigger: 'blur' }], |
| | | }, |
| | | ], |
| | | }, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | |
| | | }, |
| | | option: { |
| | | addBtn: false, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | columnBtn: false, |
| | | tip: false, |
| | | // simplePage: true, |
| | |
| | | column: [ |
| | | { |
| | | label: '创建时间', |
| | | prop: 'time', |
| | | prop: 'createTime', |
| | | type: 'datetime', |
| | | format: 'YYYY-MM-DD', |
| | | valueFormat: 'YYYY-MM-DD', |
| | | search: true, |
| | | searchRange: true, |
| | | searchSpan: 8, |
| | |
| | | }, |
| | | { |
| | | label: '关键字', |
| | | prop: 'keyWord', |
| | | prop: 'keyword', |
| | | width: 300, |
| | | search: true, |
| | | searchType: 'input', |
| | |
| | | |
| | | { |
| | | label: '编号', |
| | | prop: 'name', |
| | | prop: 'taskId', |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: '任务名称', |
| | | prop: 'taskName', |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: '流程类型', |
| | | width: 100, |
| | | prop: 'path', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请输入路由地址', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | prop: 'processDefinitionName', |
| | | }, |
| | | { |
| | | label: '实例编号', |
| | | width: 100, |
| | | type: 'tree', |
| | | }, |
| | | { |
| | | label: '流程实例名', |
| | | width: 100, |
| | | type: 'tree', |
| | | type: 'processInstanceId', |
| | | }, |
| | | { |
| | | label: '机床', |
| | |
| | | { |
| | | label: '创建时间', |
| | | width: 100, |
| | | type: 'tree', |
| | | prop: 'createTime', |
| | | }, |
| | | { |
| | | label: '到达时间', |
| | | width: 100, |
| | | type: 'tree', |
| | | prop: '', |
| | | }, |
| | | { |
| | | label: '到达描述', |
| | | width: 100, |
| | | type: 'tree', |
| | | prop: 'comment', |
| | | }, |
| | | { |
| | | label: '文件', |
| | | width: 100, |
| | | type: 'tree', |
| | | prop: '', |
| | | }, |
| | | { |
| | | label: '到达时间', |
| | | width: 100, |
| | | type: 'tree', |
| | | prop: '', |
| | | }, |
| | | |
| | | ], |
| | |
| | | }; |
| | | }, |
| | | watch: { |
| | | 'form.category'() { |
| | | const category = func.toInt(this.form.category); |
| | | this.$refs.crud.option.column.filter(item => { |
| | | if (item.prop === 'path') { |
| | | item.rules[0].required = category === 1; |
| | | } |
| | | if (item.prop === 'isOpen') { |
| | | item.disabled = category === 2; |
| | | } |
| | | }); |
| | | }, |
| | | // 'form.category'() { |
| | | // const category = func.toInt(this.form.category); |
| | | // this.$refs.crud.option.column.filter(item => { |
| | | // if (item.prop === 'path') { |
| | | // item.rules[0].required = category === 1; |
| | | // } |
| | | // if (item.prop === 'isOpen') { |
| | | // item.disabled = category === 2; |
| | | // } |
| | | // }); |
| | | // }, |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['userInfo', 'permission']), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.validData(this.permission.menu_add, false), |
| | | viewBtn: this.validData(this.permission.menu_view, false), |
| | | delBtn: this.validData(this.permission.menu_delete, false), |
| | | editBtn: this.validData(this.permission.menu_edit, false), |
| | | }; |
| | | }, |
| | | // permissionList() { |
| | | // return { |
| | | // addBtn: this.validData(this.permission.menu_add, false), |
| | | // viewBtn: this.validData(this.permission.menu_view, false), |
| | | // delBtn: this.validData(this.permission.menu_delete, false), |
| | | // editBtn: this.validData(this.permission.menu_edit, false), |
| | | // }; |
| | | // }, |
| | | }, |
| | | methods: { |
| | | handleAction(row, index) { |
| | | this.approveBox = true; |
| | | this.row = row |
| | | console.log('handleAction', row, index); |
| | | }, |
| | | handleSubmit (form,done) { |
| | | approve({ |
| | | ...this.formApprove, |
| | | taskId: this.row.taskId, |
| | | processInstanceId: this.row.processInstanceId, |
| | | }).then(res => { |
| | | this.$message.success('审批成功'); |
| | | this.approveBox = false; |
| | | this.onLoad(this.page, this.query); |
| | | done(); |
| | | }).catch(err => { |
| | | console.error(err); |
| | | }); |
| | | }, |
| | | reassign() {// 重新指派 |
| | | |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | console.log('searchChange', params); |
| | | params.createTimeBegin = params.createTime[0] || ''; |
| | | params.createTimeEnd = params.createTime[1] || ''; |
| | | console.log(params); |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.parentId = ''; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | |
| | | onLoad(page, params = {}) { |
| | | const query = { |
| | | ...this.query, |
| | | category: params.category ? flowCategory(params.category) : null, |
| | | // category: params.category ? flowCategory(params.category) : null, |
| | | mode: this.mode, |
| | | }; |
| | | this.loading = true; |
| | | getLazyList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => { |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |