GuLiMmo
2024-01-23 2e80903f72d58a86cd13c2a24a8d3132d015073e
src/views/evaluate/components/firstRoundResult.vue
@@ -1,20 +1,47 @@
<template>
    <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">
        <template #menu="{ row }">
            <referrerPopover :params="{ userId: row.userId, evaluateTaskId: params.data.id }">
                <el-button type="success" icon="el-icon-view" text>推荐人预览</el-button>
            </referrerPopover>
        </template>
        <template #menu-left>
            <el-button type="success" plain icon="el-icon-download" @click="handleExport">导出当前数据</el-button>
        </template>
    </avue-crud>
    <div class="first-result">
        <el-button style="margin-bottom: 10px;" type="success" plain icon="el-icon-download"
            @click="handleExport">导出当前数据</el-button>
        <ul class="type-list">
            <li class="type-item">
                <div class="title">奖项</div>
                <div class="introduction">认定标准</div>
                <div class="number">名额</div>
                <div class="tool">操作</div>
            </li>
            <li class="type-item" v-for="(item, index) in data" :key="index">
                <div class="title">{{ item.category?.categoryName || '' }}</div>
                <el-tooltip effect="dark" placement="top">
                    <template #content>
                        <p style="max-width: 500px;">{{ item.category?.standard || '' }}</p>
                    </template>
                    <div class="introduction">
                        {{ item.category?.standard || '' }}
                    </div>
                </el-tooltip>
                <div class="number">{{ item.category?.peopleNum || 0 }}人</div>
                <div class="tool">
                    <el-button type="primary" text icon="el-icon-view" @click="view(item)">查看第一轮候选结果</el-button>
                </div>
            </li>
        </ul>
        <el-dialog v-model="visible" :title="`第一轮候选结果(${currentCategory.categoryName})`" width="60%" @open="dialogOpen">
            <avue-crud v-model:page="page" :option="option" :table-loading="loading" :data="dialogData"
                @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
                <template #menu="{ row }">
                    <referrerPopover :params="{ userId: row.userId, evaluateTaskId: params.data.id }">
                        <el-button type="success" icon="el-icon-view" text>推荐人预览</el-button>
                    </referrerPopover>
                </template>
            </avue-crud>
        </el-dialog>
    </div>
</template>
<script>
import referrerPopover from './referrerPopover.vue'
import { getCandidateResult } from '@/api/evaluate/evaluateTask'
import { getFinallyResult, getCandidateResult } from '@/api/evaluate/evaluateTask'
import { exportBlob } from "@/api/common";
import { downloadXls } from "@/utils/util";
import { dateNow } from "@/utils/date";
@@ -87,7 +114,10 @@
                    },
                ]
            },
            data: []
            data: [],
            dialogData: [],
            visible: false,
            currentCategory: {}
        }
    },
    methods: {
@@ -108,9 +138,11 @@
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
            this.getDialogDetails()
        },
        sizeChange(pageSize) {
            this.page.pageSize = pageSize;
            this.getDialogDetails()
        },
        refreshChange() {
            this.onLoad(this.page, this.query);
@@ -127,13 +159,30 @@
                ...this.query,
                ...params
            };
            getCandidateResult(page.currentPage, page.pageSize, id).then(res => {
            getFinallyResult(page.currentPage, page.pageSize, id).then(res => {
                const data = res.data.data;
                this.page.total = data.total;
                this.data = data.records;
                this.data = data || [];
                this.loading = false;
            });
        },
        view(item) {
            this.currentCategory = item.category
            this.visible = true
        },
        dialogOpen() {
            this.getDialogDetails()
        },
        getDialogDetails() {
            const { id, evaluateTaskId } = this.currentCategory
            const { currentPage, pageSize } = this.page
            getCandidateResult(currentPage, pageSize, evaluateTaskId, id).then(candidateRes => {
                const res = candidateRes.data
                if (res.code !== 200) return this.$message.error(res.msg)
                console.log(res);
                this.dialogData = res.data.records
                this.page.total = res.data.total
            })
        }
    },
    watch: {
        'params.data': {
@@ -146,4 +195,60 @@
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
$borderColor: var(--el-border-color);
.type-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
    width: 100%;
    border: 1px solid $borderColor;
    border-radius: var(--el-border-radius-base);
    box-sizing: border-box;
    .type-item {
        display: flex;
        height: 40px;
        line-height: 40px;
        text-align: center;
        div {
            border-bottom: 1px solid $borderColor;
            flex-shrink: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .title {
            flex: 2;
        }
        .introduction {
            flex: 5;
            flex-shrink: 0;
            border: {
                right: 1px solid $borderColor;
                left: 1px solid $borderColor;
            }
        }
        .number {
            flex: 1;
        }
        .tool {
            flex: 2;
            border-left: 1px solid $borderColor;
        }
        &:last-child {
            div {
                border-bottom: 0;
            }
        }
    }
}
</style>