董国庆
3 天以前 fe6509e66e6852f6b5d740385bdae4fd0a11da77
laboratory/src/views/chemistQa/projectTesting/components/approval/index.vue
@@ -1,12 +1,19 @@
<template>
    <el-dialog :title="dialogTitle" :visible.sync="visible" width="90%" top="5vh" @open="open"
        :close-on-click-modal="false" @close="handleClose">
  <el-dialog
    :title="dialogTitle"
    :visible.sync="visible"
    width="90%"
    top="5vh"
    @open="open"
    :close-on-click-modal="false"
    @close="handleClose"
  >
        <div class="approval-dialog">
            <!-- 左侧审批内容 -->
            <div class="approval-content">
                <Card class="approval-content-card">
                    <template style="position: relative">
                        <div class="header-title" style="width: 100%;">
            <div class="header-title" style="width: 100%">
                            <div class="header-title-left">
                                <img src="@/assets/public/headercard.png" />
                                <div>所属检测项</div>
@@ -23,12 +30,21 @@
                            </template>
                        </Table>
                        <el-form ref="form" :model="form" :rules="rules" inline label-position="top"
                            style="margin-top: 18px">
            <el-form
              ref="form"
              :model="form"
              :rules="rules"
              inline
              label-position="top"
              style="margin-top: 18px"
            >
                            <el-form-item prop="name" label="报告内容">
                                <el-select v-model="form.reportContent" style="width: 100%;" disabled
                                    placeholder="请选择报告内容">
                <el-select
                  v-model="form.reportContent"
                  style="width: 100%"
                  disabled
                  placeholder="请选择报告内容"
                >
                                    <el-option label="国家标准" :value="1" />
                                    <el-option label="分析方法开发" :value="2" />
                                    <el-option label="方法验证报告" :value="3" />
@@ -38,29 +54,35 @@
                                </el-select>
                            </el-form-item>
                            <div class="header-title" style="width: 100%;">
              <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="name" style="margin-top: 18px">
                                <ai-editor :value="form.reportText" :readOnly="true" style="width: 100%;"
                                    placeholder="请输入报告编号" />
                <ai-editor
                  :value="form.reportText"
                  :readOnly="true"
                  style="width: 100%"
                  placeholder="请输入报告编号"
                />
                            </el-form-item>
                            <div class="header-title" style="width: 100%;">
              <div class="header-title" style="width: 100%">
                                <div class="header-title-left">
                                    <img src="@/assets/public/headercard.png" />
                                    <span>附件</span>
                                </div>
                            </div>
                            <el-form-item prop="name" style="margin-top: 18px">
                                <el-upload action="https://jsonplaceholder.typicode.com/posts/" :file-list="fileList"
                                    :on-preview="handlePreview">
                <el-upload
                  action="https://jsonplaceholder.typicode.com/posts/"
                  :file-list="fileList"
                  :on-preview="handlePreview"
                >
                                    <!-- <el-button size="small" type="primary">点击上传</el-button> -->
                                </el-upload>
                            </el-form-item>
                        </el-form>
                    </template>
                    <!-- <SelectMember ref="selectMember" /> -->
@@ -79,10 +101,18 @@
                    <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 == '1' && 'activeStatus'"
                @click.stop="status = 1"
              >
                                通过
                            </div>
                            <div class="reject" :class="status == '2' && 'activeStatus'" @click.stop="status = 2">
              <div
                class="reject"
                :class="status == '2' && 'activeStatus'"
                @click.stop="status = 2"
              >
                                驳回
                            </div>
                        </div>
@@ -91,32 +121,36 @@
                <el-col :span="12">
                    <div class="remark">
                        <div class="remark-title">审批意见</div>
                        <el-input type="textarea" v-model="remark" placeholder="请输入审批意见" />
            <el-input
              type="textarea"
              v-model="remark"
              placeholder="请输入审批意见"
            />
                    </div>
                </el-col>
            </el-row>
        </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 type="primary" @click="handleApprove" v-if="type == 'approve'"
        >确认</el-button
      >
        </div>
    </el-dialog>
</template>
<script>
import ApprovalProcess from '@/components/approvalProcess'
import AiEditor from '@/components/AiEditor'
import { getDetailInfo, getDetail, detailAuditReport } from '../../service'
import { getFullUrl, getAllocateIp } from '@/utils/utils'
import apiConfig from '@/utils/baseurl';
import ApprovalProcess from "@/components/approvalProcess";
import AiEditor from "@/components/AiEditor";
import { getDetailInfo, getDetail, detailAuditReport } from "../../service";
import { getFullUrl, getAllocateIp, downloadFileByUrl, isImageFile } from "@/utils/utils";
import apiConfig from "@/utils/baseurl";
export default {
    name: "ApprovalDialog",
    components: {
        ApprovalProcess,
        AiEditor
    AiEditor,
    },
    props: {
        visible: {
@@ -154,17 +188,19 @@
    },
    computed: {
        dialogTitle() {
            return this.type == "approve" ? "审核项目检测项、检验包" : "项目检测项、检验包详情";
      return this.type == "approve"
        ? "审核项目检测项、检验包"
        : "项目检测项、检验包详情";
        },
    },
    watch: {
        visible: {
            handler(val) {
                if (val && this.data.id) {
                    this.getDetailInfo()
          this.getDetailInfo();
                }
                if (val && this.data.itemId) {
                    this.getDetail()
          this.getDetail();
                }
            },
            immediate: true,
@@ -173,34 +209,48 @@
    methods: {
        getFullUrl,
        handlePreview(file) {
            console.log('url', file)
            if (file && file.url) {
        // 判断是否为图片文件
        const isImage = isImageFile(file.url);
        if (isImage) {
          // 图片文件:使用 window.open 预览
                if (file.url && file.url.startsWith(getAllocateIp())) {
                    window.open(file.url, '_blank');
            console.log("图片链接", file.url);
            window.open(file.url, "_blank");
                } else {
                    let newUrl = getAllocateIp() + file.url;
                    window.open(newUrl, '_blank');
            console.log("图片链接", newUrl);
            window.open(newUrl, "_blank");
          }
        } else {
          // 非图片文件:使用下载方式
          downloadFileByUrl(file.url, file.name);
                }
            }
        },
        open() {
            this.status = 1;
            this.remark = ''
      this.remark = "";
        },
        getDetailInfo() {
            getDetailInfo({ id: this.data.id }).then(res => {
      getDetailInfo({ id: this.data.id }).then((res) => {
                if (res) {
                    this.form = { ...res, reportContent: Number(res.reportContent), processData: [] }
          this.form = {
            ...res,
            reportContent: Number(res.reportContent),
            processData: [],
          };
                    if (res.qaReportFileList && res.qaReportFileList.length > 0) {
                        this.fileList = res.qaReportFileList.map(file => ({
            this.fileList = res.qaReportFileList.map((file) => ({
                            name: file.fileName,
                            url: getFullUrl(file.fileUrl),
                            uid: file.id
                        }))
                        this.form.qaReportFileList = res.fileList
              uid: file.id,
            }));
            this.form.qaReportFileList = res.fileList;
                    } else {
                        this.fileList = []
                        this.form.qaReportFileList = []
            this.fileList = [];
            this.form.qaReportFileList = [];
                    }
                    // 组装流程数据
                    let processData = [];
@@ -241,25 +291,23 @@
                        processData.push({
                            type: "warning",
                            mode: "list",
                            fields: [
                                { label: "等待审核" },
                            ],
              fields: [{ label: "等待审核" }],
                        });
                    }
                    // 如有卡片模式,按前述结构 push
                    this.$nextTick(() => {
                        this.form.processData = processData;
                    })
          });
                }
            })
      });
        },
        getDetail() {
            getDetail(this.data.itemId).then(res => {
      getDetail(this.data.itemId).then((res) => {
                if (res) {
                    this.tableData = [{ ...res, teamName: res.projectTeamVO.teamName }]
          this.tableData = [{ ...res, teamName: res.projectTeamVO.teamName }];
                }
            })
      });
        },
        handleClose() {
            this.$emit("close");
@@ -267,21 +315,23 @@
            this.form.approvalComment = "";
        },
        handleApprove() {
            if (!this.remark && this.status == '2') {
      if (!this.remark && this.status == "2") {
                this.$message.warning("请输入审批意见");
                return;
            }
            const params = {
                id: this.data.id,
                auditRemark: this.remark,
                auditStatus: this.status == '1' ? 2 : 3
        auditStatus: this.status == "1" ? 2 : 3,
            };
            detailAuditReport(params).then(res => {
      detailAuditReport(params)
        .then((res) => {
                if (res) {
                    this.$message.success('审核成功');
            this.$message.success("审核成功");
                    this.$emit("close");
                }
            }).catch(err => {
        })
        .catch((err) => {
                // this.$message.error(err.message || '审核失败');
            });
        },
@@ -461,7 +511,7 @@
            line-height: 32px;
            display: flex;
            align-items: center;
            justify-content: center
      justify-content: center;
        }
        .reject {
@@ -475,7 +525,7 @@
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center
      justify-content: center;
        }
        .activeStatus {