董国庆
2025-12-17 10638dc89f1cd2a20c4035383a66192da5dfbccd
culture/src/views/strainReportLibrary/reportLibraryOneThree/add.vue
@@ -160,7 +160,7 @@
import { Card } from 'element-ui';
import AiEditor from '@/components/AiEditor'
import ChooseProject from '@/components/chooseProject/index.vue'
import { customUploadRequest, getFullUrl } from "@/utils/utils";
import { customUploadRequest, getFullUrl, downloadFileByUrl, getAllocateIp, isImageFile } from "@/utils/utils";
import SelectMember from '@/components/SelectMember'
import { add, getDetail, update } from './service'
@@ -280,10 +280,24 @@
    },
    methods: {
        handlePreview(file) {
            if (file.url) {
                window.open(file.url, '_blank');
            } else {
                this.$message.warning('无可预览地址');
            if (file && file.url) {
                // 判断是否为图片文件
                const isImage = isImageFile(file.url);
                if (isImage) {
                    // 图片文件:使用 window.open 预览
                    if (file.url && file.url.startsWith(getAllocateIp())) {
                        console.log('图片链接', file.url)
                        window.open(file.url, '_blank');
                    } else {
                        let newUrl = getAllocateIp() + file.url;
                        console.log('图片链接', newUrl)
                        window.open(newUrl, '_blank');
                    }
                } else {
                    // 非图片文件:使用下载方式
                    downloadFileByUrl(file.url, file.name);
                }
            }
        },
        // 上传前校验
@@ -357,11 +371,11 @@
                    this.sendLoading = false;
                    return;
                }
                    // if (!this.selectedMember || !this.selectedMember[0]) {
                    //     this.$message.warning('请选择菌种实验员');
                    //     this.sendLoading = false;
                    //     return;
                    // }
                // if (!this.selectedMember || !this.selectedMember[0]) {
                //     this.$message.warning('请选择菌种实验员');
                //     this.sendLoading = false;
                //     return;
                // }
                const params = {
                    isDraft: 0,
                    projectId: this.projectData[0].id,
@@ -431,7 +445,7 @@
                })
                try {
                    const params = {
                        isDraft: 1,
                        projectId: this.projectData[0].id,