董国庆
2025-09-12 527efb36f35b471710e445972673abff45bacdac
laboratory/src/views/reportLibrary/verificationRelease/components/approval/index.vue
@@ -1,7 +1,7 @@
<template>
    <el-dialog :title="dialogTitle"  :visible.sync="visible" width="80%" po :close-on-click-modal="false"
        @close="handleClose">
        <div class="approval-dialog">
    <el-dialog :title="dialogTitle" :visible.sync="visible" width="90%" top="5vh" @open="open" po
        :close-on-click-modal="false" @close="handleClose">
        <div class="approval-dialog" :style="{ height: obj.isDetail ? '80vh' : '60vh' }">
            <!-- 左侧审批内容 -->
            <div class="approval-content">
                <Card class="approval-content-card">
@@ -12,13 +12,12 @@
                                <div>所属项目组</div>
                            </div>
                        </div>
                        <Table :height="null" :queryForm="queryForm" :total="0" @currentChange="handleCurrentChange"
                            @sizeChange="handleSizeChange">
                        <Table :height="null" :total="0" :data="tableData">
                            <template>
                                <el-table-column prop="name" label="项目组名称" />
                                <el-table-column prop="age" label="项目负责人" />
                                <el-table-column prop="age" label="项目组成员" />
                                <el-table-column prop="age" label="创建时间" />
                                <el-table-column prop="teamName" label="项目组名称" />
                                <el-table-column prop="personCharge" label="项目负责人" />
                                <el-table-column prop="staffName" label="项目组成员" />
                                <el-table-column prop="createTime" label="创建时间" />
                            </template>
                        </Table>
@@ -31,9 +30,10 @@
                                    <div>报告编号</div>
                                </div>
                            </div>
                            <form-item prop="name" style="margin-top: 38px">
                                <el-input v-model="form.name" style="width: 100%;" placeholder="请输入报告编号" />
                            </form-item>
                            <el-form-item prop="reportCode" style="margin-top: 18px">
                                <el-input disabled v-model="form.reportCode" style="width: 100%;"
                                    placeholder="请输入报告编号" />
                            </el-form-item>
                            <div class="header-title" style="width: 100%;">
                                <div class="header-title-left">
@@ -41,9 +41,10 @@
                                    <div>报告名称</div>
                                </div>
                            </div>
                            <form-item prop="name" style="margin-top: 38px">
                                <el-input v-model="form.name" style="width: 100%;" placeholder="请输入报告编号" />
                            </form-item>
                            <el-form-item prop="reportName" style="margin-top: 18px">
                                <el-input disabled v-model="form.reportName" style="width: 100%;"
                                    placeholder="请输入报告名称" />
                            </el-form-item>
                            <div class="header-title" style="width: 100%;">
                                <div class="header-title-left">
@@ -51,9 +52,19 @@
                                    <div>报告正文</div>
                                </div>
                            </div>
                            <form-item prop="name" style="margin-top: 38px">
                                <ai-editor v-model="form.name" style="width: 100%;" placeholder="请输入报告编号" />
                            </form-item>
                            <el-form-item prop="reportText" style="margin-top: 18px">
                                <ai-editor :readOnly="true" :value="form.reportText" style="width: 100%;"
                                    placeholder="请输入报告正文" />
                            </el-form-item>
                            <div class="header-title" style="width: 100%;">
                                <div class="header-title-left">
                                    <img src="@/assets/public/headercard.png" />
                                    <div>附件</div>
                                </div>
                            </div>
                            <el-form-item prop="feasibilityReportFiles" style="margin-top: -18px">
                                <el-upload disabled :on-preview="handlePreview" :file-list="fileList" />
                            </el-form-item>
                        </el-form>
                    </template>
@@ -63,21 +74,20 @@
            <!-- 右侧审批流程 -->
            <div class="approval-flow">
                <div class="flow-content">
                    <approval-process :status="form.status" :submit-time="form.createTime" :approver="form.approver"
                        :approve-time="form.approveTime" />
                    <approval-process :processData="form.processData" />
                </div>
            </div>
        </div>
        <div class="approval-dialog-approve">
        <div class="approval-dialog-approve" v-if="!obj.isDetail">
            <el-row :span="24">
                <el-col :span="12">
                    <div class="status">
                        <div class="status-title">审批结果</div>
                        <div class="status-content">
                            <div class="resolve" :class="status == '1' && 'activeStatus'" @click.stop="status = 1">
                            <div class="resolve" :class="status == '2' && 'activeStatus'" @click.stop="status = 2">
                                通过
                            </div>
                            <div class="reject" :class="status == '2' && 'activeStatus'" @click.stop="status = 2">
                            <div class="reject" :class="status == '4' && 'activeStatus'" @click.stop="status = 4">
                                驳回
                            </div>
                        </div>
@@ -94,8 +104,8 @@
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button @click="handleClose" >取 消</el-button>
            <el-button type="primary" @click="handleApprove" v-if="type === 'approve'">通过</el-button>
            <el-button @click="handleClose">{{ obj.isDetail ? '关闭' : '取 消' }}</el-button>
            <el-button type="primary" @click="handleApprove" v-if="!obj.isDetail">确定</el-button>
        </div>
    </el-dialog>
</template>
@@ -103,6 +113,10 @@
<script>
import ApprovalProcess from '@/components/approvalProcess'
import AiEditor from '@/components/AiEditor'
import { getDetail } from '../../service';
import { customUploadRequest, getFullUrl, getAllocateIp } from "@/utils/utils";
import apiConfig from '@/utils/baseurl';
export default {
    name: "ApprovalDialog",
@@ -119,27 +133,35 @@
            type: String,
            default: "approve", // approve-审批,view-查看
        },
        data: {
        obj: {
            type: Object,
            default: () => ({}),
            default: () => { },
        },
    },
    data() {
        return {
            form: {
                planName: "",
                planCode: "",
                stage: "",
                creator: "",
                reportCode: "",
                reportName: "",
                reportText: "",
                teamName: "",
                createBy: "",
                createTime: "",
                status: "",
                approvalComment: "",
                status: "pending",
                approver: "",
                approveTime: ""
                approveTime: "",
                processData: [],
                updateBy: "",
                auditRemark: "",
                auditPersonName: "",
                feasibilityReportFiles: [],
                auditTime: ""
            },
            radio1: 1,
            fileList: [],
            tableData: [],
            rules: {},
            status: "1",
            status: "2",
            remark: "",
        };
    },
@@ -148,40 +170,135 @@
            return this.type === "approve" ? "审批" : "审批详情";
        },
    },
    watch: {
        data: {
            handler(val) {
                if (val) {
                    this.form = { ...val };
                }
            },
            immediate: true,
        },
    },
    methods: {
        getFullUrl,
        handlePreview(file) {
            console.log('url', file)
            if (file && file.url) {
                if (file.url && file.url.startsWith(getAllocateIp())) {
                    window.open(file.url, '_blank');
                } else {
                    let newUrl = getAllocateIp() + file.url;
                    window.open(newUrl, '_blank');
                }
            }
        },
        open() {
            if (!this.obj.id) {
                this.$message.error('缺少必要参数');
                return;
            }
            getDetail(this.obj.id).then(res => {
                const data = res.data || res;
                this.form = {
                    ...this.form,
                    ...data,
                    // feasibilityReportFiles:data.feasibilityReportFiles.map(item => ({
                    //     name: item.fileName,
                    //     url: item.fileUrl
                    // })) || [],
                    processData: []
                };
                if (
                    data.feasibilityReportFiles &&
                    data.feasibilityReportFiles.length > 0
                ) {
                    this.fileList =
                        data.feasibilityReportFiles.map((file) => {
                            return {
                                name: file.fileName,
                                url: getFullUrl(file.fileUrl),
                                uid: file.id,
                            };
                        });
                    this.form.feasibilityReportFiles = data.feasibilityReportFiles
                } else {
                    this.fileList = [];
                    this.form.feasibilityReportFiles = [];
                }
                this.tableData = data.projectTeam ?
                    [{ ...data.projectTeam, staffName: data.staffNames || '' }] :
                    [];
                let processData = [];
                // 提交节点
                processData.push({
                    type: "primary",
                    mode: "list",
                    fields: [
                        { label: "提交人:", value: data.updateBy || "" },
                        { label: "提交时间:", value: data.createTime || "" },
                    ]
                });
                if (data.status == 2 || data.status == 4 || data.status == 3) {
                    processData.push({
                        type: "primary",
                        mode: "list",
                        fields: [
                            { label: "审核结果:", value: data.status == 4 ? '驳回' : "通过" || "" },
                            { label: "审批意见:", value: data.auditRemark || "" },
                            { label: "审核人:", value: data.auditPersonName || "" },
                            { label: "审核时间:", value: data.auditTime || "" },
                        ]
                    });
                } else {
                    processData.push({
                        type: "warning",
                        mode: "list",
                        fields: [
                            { label: "等待审核" },
                        ],
                    });
                }
                if (data.status == 2) {
                    processData.push({
                        type: "warning",
                        mode: "list",
                        fields: [{ label: "等待评定" }],
                    });
                }
                if (data.status == 3) {
                    processData.push({
                        type: "success",
                        mode: "list",
                        fields: [
                            { label: "评定状态:已评定" },
                            { label: "评定人:", value: data.evaluatePersonName || "" },
                            { label: "评定时间:", value: data.evaluateTime || "" }
                        ],
                    });
                }
                this.form.processData = processData;
            }).catch(err => {
                this.$message.error('获取详情失败');
            });
        },
        handleClose() {
            this.$emit("close");
            this.form.approvalComment = "";
        },
        handleApprove() {
            if (!this.form.approvalComment) {
                this.$message.warning("请输入审批意见");
                return;
            }
            this.$emit("approve", {
                ...this.form,
                status: "approved",
                statuss: this.status,
                remark: this.remark
            });
        },
        handleReject() {
            if (!this.form.approvalComment) {
                this.$message.warning("请输入审批意见");
                return;
            }
            this.$emit("reject", {
                ...this.form,
                status: "rejected",
            });
        handleCurrentChange(page) {
            this.form.pageNum = page
            this.getList()
        },
        handleSizeChange(size) {
            this.form.pageSize = size
            this.getList()
        },
    },
};
@@ -194,7 +311,9 @@
.approval-dialog {
    display: flex;
    height: 40vh;
    // height: 40vh;
    min-height: 60vh;
    max-height: 80vh;
    .approval-content {
        flex: 3;
@@ -205,13 +324,13 @@
    }
    .approval-flow {
        padding: 40px 20px;
        // width: 405px;
        flex: 2;
        padding: 20px 10px;
        width: 305px;
        // flex: 2;
        background: #ffffff;
        box-shadow: 0px 4px 12px 4px rgba(0, 0, 0, 0.08);
        border-radius: 10px;
        .flow-title {
            font-size: 16px;
            font-weight: bold;
@@ -231,7 +350,7 @@
}
.approval-content-card {
    height: calc(100% - 100px) !important;
    height: calc(100% - 10px) !important;
    box-shadow: none !important;
}
@@ -239,14 +358,14 @@
    // display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    margin-bottom: 10px;
    gap: 13px;
    .header-title-left {
        display: flex;
        align-items: center;
        gap: 13px;
        margin-top: 38px;
        margin-top: 18px;
        img {
            width: 12px;
@@ -310,7 +429,7 @@
}
.approval-dialog-approve {
    padding: 38px 20px;
    padding: 18px 10px;
    // display: flex;
    align-content: center;