yangys
2025-08-14 9ff7d57765b1eb3704b9425819cdb9c5708e0ab1
src/views/flow/todolist.vue
@@ -10,9 +10,12 @@
                </el-button>
                <el-button type="primary" v-if="permission.auto_dispatch" plain @click="reassign(2)">自动派工
                </el-button>
                <el-button type="primary" v-if="permission.batch_approve" plain @click="reassign(3)">批量审批
                </el-button>
            </template>
            <template #menu="scope">
                <el-button type="primary" text size="default" @click.stop="handleAction(scope.row, scope.index)">审批
                <el-button type="primary" text size="default" @click.stop="handleAction(scope.row, scope.index)">
                    {{scope.row.taskDefinitionKey === 'teamLeaderTask' ? '派工' : '审批'}}
                </el-button>
            </template>
        </avue-crud>
@@ -26,7 +29,19 @@
                </div>
                <div class="right">
                    <TodolistRightTop :row="row" />
                    <avue-form ref="form" :option="optionApprove" v-model="formApprove" @submit="handleSubmit" />
                    <el-tabs
                        type="card"
                        class="demo-tabs"
                        v-model="activeName"
                    >
                        <el-tab-pane label="审批" name="approve">
                            <avue-form ref="form" :option="optionApprove" v-model="formApprove" @submit="handleSubmit" />
                        </el-tab-pane>
                        <el-tab-pane label="流程轨迹" name="log">
                            <processTrace :item="row" v-if="activeName==='log'"></processTrace>
                        </el-tab-pane>
                    </el-tabs>
                </div>
            </div>
        </el-drawer>
@@ -34,19 +49,21 @@
</template>
<script>
import { getList, approve, getAssignee,reassgin,manualDispatch,autoDispatch } from '@/api/flow/todolist';
import { getList, approve, getAssignee,reassgin,manualDispatch,autoDispatch,getPrevius,batchApprove } from '@/api/flow/todolist';
import { mapGetters } from 'vuex';
import dayjs from 'dayjs';
import TodolistLeft from './components/TodolistLeft.vue';
import TodolistRightTop from './components/TodolistRightTop.vue';
import processTrace from './components/process-trace.vue';
export default {
    components: {
        TodolistLeft,
        TodolistRightTop
        TodolistRightTop,
        processTrace
    },
    data() {
        return {
            activeName: 'approve',
            applist: [],
            assigneeData: [],
            row: {},
@@ -254,6 +271,18 @@
                emptyBtn: false,
                column: [
                    {
                        label: '审批结果',
                        prop: 'approve',
                        type: 'radio',
                        span: 24,
                        display: false,
                        dicData: [
                            { label: '通过', value: 'Y' },
                            { label: '驳回', value: 'N' },
                        ],
                        rules: [{ required: true, message: '请选择审批结果', trigger: 'blur' }],
                    },
                    {
                        label: '发送给',
                        prop: 'newAssigneeId',
                        type: 'select',
@@ -265,6 +294,7 @@
                        },
                        span: 24,
                        disabled: false,
                        display: true,
                        dicData: [
                        ],
@@ -275,7 +305,7 @@
                        span: 24,
                        prop: 'comment',
                        type: 'textarea',
                        rules: [{ required: true, message: '请输入审批意见', trigger: 'blur' }],
                        // rules: [{ required: true, message: '请输入审批意见', trigger: 'blur' }],
                    },
                ],
            },
@@ -303,6 +333,20 @@
            // }
            
        },
        'reassignForm.approve'(val) {
            if(this.reassignType ===3) {
                if(val === 'Y') {
                    this.reassignOption.column[1].disabled = true;
                    this.reassignOption.column[1].display = false;
                    this.reassignForm.newAssigneeId = '';
                } else {
                    this.reassignOption.column[1].display = false;
                    this.reassignOption.column[1].disabled = false;
                    this.reassignForm.newAssigneeId = '';
                }
            }
        }
    },
    computed: {
        ...mapGetters(['userInfo', 'permission']),
@@ -310,6 +354,7 @@
            return {
                manual_dispatch: this.validData(this.permission.manual_dispatch, false),
                auto_dispatch: this.validData(this.permission.auto_dispatch, false),
                batch_approve: this.validData(this.permission.batch_approve, true),
            };
        },
    },
@@ -317,7 +362,7 @@
        getAssignee().then(res => {
            this.assigneeData = res.data.data;
            this.optionApprove.column[1].dicData = this.assigneeData;
            this.reassignOption.column[0].dicData = this.assigneeData;
            this.reassignOption.column[1].dicData = this.assigneeData;
        })
        this.setApproveBtn()
    },
@@ -365,15 +410,22 @@
                    this.formApprove.assignee = row.variables.programmer
                } else if (row.taskDefinitionKey == "confirmIsUseableTask") {
                    this.formApprove.assignee = row.variables.checker
                } else if (["approveTask", 'seniorApproveTask'].includes(row.taskDefinitionKey)) {// 高师审核
                } else if (["approveTask", 'seniorApproveTask','replaceApprove'].includes(row.taskDefinitionKey)) {// 高师审核
                    this.optionApprove.column[1].disabled = true;
                    this.formApprove.assignee = ''; // 如果是通过,则默认指派给自己
                }
            } else if(approve === 'N'){
                this.formApprove.assignee = ''
                if (["approveTask", 'seniorApproveTask'].includes(row.taskDefinitionKey)) {// 高师审核
                if (["approveTask", 'seniorApproveTask','replaceApprove'].includes(row.taskDefinitionKey)) {// 高师审核
                    this.optionApprove.column[1].disabled = true;
                    this.formApprove.assignee = row.varables.assignee; // 如果是通过,则默认指派给自己
                    getPrevius({processInstanceId: row.processInstanceId}).then(res => {
                        console.log(res)
                        if(res.data.code === 200) {
                            this.formApprove.assignee = res.data.data // 如果是通过,则默认指派给自己
                        }
                    })
                }
            }
            
@@ -411,9 +463,27 @@
                    }).catch(err => {
                        this.$message.success('操作失败');
                    })
                }).catch(() => {
                    // this.$message.info('已取消操作');
                });
            } else {
                this.reassignBox = true;
                if(val === 3) {//批量审批时 显示通过驳回
                    this.reassignOption.column[0].display = true;
                    this.reassignOption.column[0].dicData[1].label = '不通过';
                    this.reassignForm.approve = 'Y';
                    this.reassignForm.newAssigneeId = '';
                    this.reassignOption.column[1].disabled = true;
                    this.reassignOption.column[1].display = true;
                } else {
                    this.reassignOption.column[0].display = false;
                    this.reassignForm.approve = '';
                }
                if(val ===1) {
                    this.reassignForm.newAssigneeId = this.transferTaskSelection[0].variables.programmer;
                }
            }
            
            
@@ -426,7 +496,8 @@
                    confirmButtonText: this.$t('submitText'),
                    cancelButtonText: this.$t('cancelText'),
                    type: 'warning',
                }).then(() => {
                }).then((res) => {
                    console.log(res,'>>>>>>')
                    reassgin({
                        ...form,
                        taskId: this.transferTaskSelection[0].taskId,
@@ -446,6 +517,10 @@
                        this.$message.error('操作失败');
                        done()
                    })
                }).catch(() => {
                    console.log('>>>>>>')
                    // this.$message.info('已取消操作');
                    done();
                });
                
            } else if (this.reassignType === 1) {
@@ -474,10 +549,44 @@
                        console.error(err);
                        done()
                    })
                }).catch(() => {
                    console.log('>>>>>>')
                    // this.$message.info('已取消操作');
                    done();
                });
            } else if (this.reassignType === 3) {
                this.$confirm('确认要进行批量审批吗?', '', {
                    confirmButtonText: this.$t('submitText'),
                    cancelButtonText: this.$t('cancelText'),
                    type: 'warning',
                }).then(() => {
                    batchApprove({
                        assignee: form.newAssigneeId,
                        comment: form.comment,
                        approve: form.approve,
                        taskIds: this.transferTaskSelection.map(v => v.taskId),
                        processInstanceIds: this.transferTaskSelection.map(v => v.processInstanceId),
                    }).then(res => {
                        if(res.data.code !== 200) {
                            this.$message.error(res.data.msg);
                            return;
                        }
                        this.$message.success('操作成功');
                        this.reassignBox = false;
                        this.$refs?.reassginform?.resetForm();
                        this.onLoad(this.page, this.query);
                        done()
                    }).catch(err => {
                        console.error(err);
                        done()
                    })
                }).catch(() => {
                    console.log('>>>>>>')
                    // this.$message.info('已取消操作');
                    done();
                });
            }
            done();
        },
        handleAction(row, index) {
            this.formApprove = {
@@ -593,6 +702,7 @@
    .right {
        flex: 1;
        padding: 0 10px;
    }
}
</style>