GuLiMmo
2024-01-15 98a5aa3ae4aba7302837986f5b3963966d39ddb4
src/views/evaluate/components/candidateResult.vue
@@ -1,9 +1,16 @@
<template>
    <el-dialog v-model="params.visible" title="第一轮评优结果">
    <el-dialog v-model="params.visible" title="第一轮评优结果" @open="dialogOpen">
        <avue-crud v-model:page="page" :option="option" :table-loading="loading" :data="data"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange">
            <!-- @on-load="onLoad" -->
            <template #isAddCandidate="{ row }">
                <el-tag :type="row.isAddCandidate ? 'success' : 'warning'">{{ row.isAddCandidate ? '已加入' : '未加入' }}</el-tag>
            </template>
            <template #menu="{ row }">
                <el-button type="primary" icon="el-icon-plus" text @click="addEvaluateTypeHandler(row)">添加至第二轮</el-button>
                <el-button :type="row.isAddCandidate ? 'success' : 'primary'"
                    :icon="row.isAddCandidate ? 'el-icon-edit' : 'el-icon-plus'" text @click="addEvaluateTypeHandler(row)">
                    {{ row.isAddCandidate ? '修改评优类别' : '添加至第二轮' }}
                </el-button>
            </template>
        </avue-crud>
        <el-dialog v-model="addEvaluateTypeVisible" width="400px" title="请选择添加至评优类别" append-to-body
@@ -62,17 +69,17 @@
                column: [
                    {
                        label: '姓名',
                        prop: 'user_name',
                        prop: 'userName',
                        type: 'input'
                    },
                    {
                        label: '部门',
                        prop: 'dept_name',
                        prop: 'deptName',
                        type: 'input'
                    },
                    {
                        label: '职位',
                        prop: 'post_name',
                        prop: 'postName',
                        type: 'input'
                    },
                    {
@@ -83,6 +90,12 @@
                            return value + '票'
                        }
                    },
                    {
                        label: '是否已加入第二轮评优',
                        prop: 'isAddCandidate',
                        type: 'input',
                        slot: true
                    }
                ]
            },
            data: [],
@@ -93,6 +106,9 @@
        }
    },
    methods: {
        dialogOpen() {
            this.onLoad(this.page)
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
        },
@@ -138,19 +154,20 @@
        },
        addSecondRoundHandler() {
            if (!this.selectEvaluateType) return this.$message.warning('请选择当前候选人要填至的评优类别')
            const { user_id, user_name, dept_id, dept_name, post_name } = this.currentRow
            const { userId, userName, deptId, deptName, postName } = this.currentRow
            const requestParams = {
                evaluateTaskCategoryId: this.selectEvaluateType,
                userId: user_id,
                userName: user_name,
                deptId: dept_id,
                deptName: dept_name,
                postName: post_name,
                userId: userId,
                userName: userName,
                deptId: deptId,
                deptName: deptName,
                postName: postName,
            }
            addEtaskCc(requestParams).then(res => {
                this.$message.success('添加成功')
                this.addEvaluateTypeVisible = false
                this.selectEvaluateType = ''
                this.currentRow.isAddCandidate = true
            }, error => {
                this.$message.error(error)
            })