xieb
2025-01-21 d13cebe7fbadd396e91a989af331df8a8e7b40f8
src/views/evaluate/components/secondRoundResult.vue
@@ -1,46 +1,57 @@
<template>
    <template v-if="!type()">
        <div class="export_xlsx">
            <el-button type="success" plain @click="handleExport">导出当前数据</el-button>
        </div>
        <ul class="type-list">
            <li class="type-item">
                <div class="title">类别</div>
                <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>
                <div class="title">{{ item.category?.categoryName || '' }}</div>
                <el-tooltip effect="dark" placement="top">
                    <template #content>
                        <p style="max-width: 500px;">{{ item.category.standard }}</p>
                        <p style="max-width: 500px;">{{ item.category?.standard || '' }}</p>
                    </template>
                    <div class="introduction">
                        {{ item.category.standard }}
                        {{ item.category?.standard || '' }}
                    </div>
                </el-tooltip>
                <div class="number">{{ item.category.peopleNum }}人</div>
                <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="dialogParams.visible" :title="dialogParams.title">
        <el-dialog v-model="dialogParams.visible" :title="dialogParams.title" destroy-on-close>
            <avue-crud :option="dialogOption" :table-loading="dialogLoading" :data="dialogParams.data" @on-load="onLoad">
        </avue-crud>
                <template #menu-row>
                    <el-button type="success" plain @click="handleExport">导出当前数据</el-button>
                </template>
            </avue-crud>
        </el-dialog>
    </template>
    <template v-else>
        <div class="export_xlsx">
            <el-button type="success" plain @click="handleExport">导出当前数据</el-button>
        </div>
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template #menu-left>
                <el-button type="success" plain icon="el-icon-download" @click="handleExport">导出</el-button>
            </template>
        </avue-crud>
    </template>
</template>
<script>
import { getFinallyResult } from '@/api/evaluate/evaluateTask'
import { getFinallyResult, getFinallyTypeResult } from '@/api/evaluate/evaluateTask'
import { exportBlob } from "@/api/common";
import { downloadXls } from "@/utils/util";
import { dateNow } from "@/utils/date";
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
export default {
    inject: ['type'],
@@ -84,7 +95,7 @@
                column: [
                    {
                        label: '部门',
                        prop: 'user_name',
                        prop: 'dept_name',
                        type: 'input'
                    },
                    {
@@ -119,7 +130,7 @@
                    },
                    {
                        label: '部门',
                        prop: 'user_name',
                        prop: 'post_name',
                        type: 'input'
                    },
                    {
@@ -164,9 +175,15 @@
                ...this.query,
                ...params
            };
            getFinallyResult(page.currentPage, page.pageSize, id).then(res => {
            !this.type() && getFinallyResult(page.currentPage, page.pageSize, id).then(res => {
                const data = res.data.data;
                this.data = data || [];
                this.loading = false;
            });
            this.type() && getFinallyTypeResult(page.currentPage, page.pageSize, { evaluateTaskId: id }).then(res => {
                const data = res.data.data;
                this.data = data.records || [];
                this.page.total = data.total
                this.loading = false;
            });
        },
@@ -174,10 +191,28 @@
            const { category, resultList } = result
            this.dialogParams = {
                visible: true,
                title: `最终结果(${category.categoryName })`,
                title: `最终结果(${category.categoryName})`,
                data: resultList
            }
            this.dialogLoading = false
        },
        handleExport() {
            const { id } = this.params.data
            const downloadUrl = `/evaluate/evaluateCandidateResult/exportEmp/${id}`;
            const sectionDownloadUrl = `/evaluate/evaluateCandidateResult/exportDept/${id}`;
            this.$confirm("是否导出数据?", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                NProgress.start();
                const url = this.type() ? sectionDownloadUrl : downloadUrl;
                const typeName = this.type() ? '部门' : '个人'
                exportBlob(url, {}).then(res => {
                    downloadXls(res.data, `${typeName}最终评优结果(${dateNow()}).xlsx`);
                    NProgress.done();
                })
            });
        }
    },
    watch: {
@@ -194,6 +229,10 @@
<style lang="scss" scoped>
$borderColor: var(--el-border-color);
.export_xlsx {
    margin-bottom: 10px;
}
.type-list {
    margin: 0;
    padding: 0;