From 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 08 十月 2026 11:20:56 +0800
Subject: [PATCH] 提交最新代码

---
 culture/src/views/strain-library/validation/chief-cell/add.vue |  101 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 73 insertions(+), 28 deletions(-)

diff --git a/culture/src/views/strain-library/validation/chief-cell/add.vue b/culture/src/views/strain-library/validation/chief-cell/add.vue
index c8e09be..4df9dad 100644
--- a/culture/src/views/strain-library/validation/chief-cell/add.vue
+++ b/culture/src/views/strain-library/validation/chief-cell/add.vue
@@ -6,10 +6,28 @@
                 <div>新增母代菌种库验证资料</div>
             </div>
         </div> -->
+      <div class="header-title" style="width: 100%;">
+        <div class="header-title-left">
+          <img src="@/assets/public/headercard.png" />
+          <div>所属项目组</div>
+        </div>
+        <div class="header-title-right">
+          <el-button @click="showChoose = true" class="el-icon-circle-plus-outline" type="primary">
+            选择项目组</el-button>
+        </div>
+      </div>
+      <Table :height="null" :queryForm="queryForm" :total="0" :data="projectData" style="margin-bottom: 20px">
+        <template>
+          <el-table-column prop="teamName" label="项目组名称" />
+          <el-table-column prop="personCharge" label="项目负责人" />
+          <el-table-column prop="staff" label="项目组成员" />
+          <el-table-column prop="createTime" label="创建时间" />
+        </template>
+      </Table>
         <el-form :model="form" :rules="rules" ref="strainForm" label-position="top" class="strain-form">
             <div class="form-row">
-                <el-form-item label="菌种来源" prop="strainSource">
-                    <el-input type="textarea" style="width:790px;" v-model="form.strainSource" placeholder="请输入" :rows="3"></el-input>
+                <el-form-item label="菌种来源" prop="strainSource" class="full-width">
+                    <el-input type="textarea" v-model="form.strainSource" placeholder="请输入" :rows="3"></el-input>
                 </el-form-item>
             </div>
             <div class="form-row three-columns">
@@ -26,12 +44,12 @@
                     <el-input v-model="form.validationExperimentCode" placeholder="请输入"></el-input>
                 </el-form-item>
                 <el-form-item label="实验时间" prop="experimentTime">
-                    <el-date-picker :prefix-icon="' '" style="width: 290px;" v-model="form.experimentTime" type="date"
+                    <el-date-picker :prefix-icon="' '" style="width: 100%;" v-model="form.experimentTime" type="date"
                         placeholder="请选择实验时间"></el-date-picker>
                 </el-form-item>
                 <div class="form-item-placeholder"></div>
             </div>
-            <div class="end-btn" style="margin-top: 400px">
+            <div class="end-btn form-actions">
                 <el-button type="primary" @click="handleSubmit">提交</el-button>
                 <el-button @click="handleDraft" v-if="roleType != 1">存草稿</el-button>
             </div>
@@ -39,7 +57,8 @@
 
         <!-- 签字确认组件 -->
         <ConfirmStorageDialog :visible.sync="signatureVisible" :handleSignature="form.handleSignature"
-            @confirm="handleSignatureConfirm" name="操作人签字" text="是否确认提交该项主细胞库资料信息?" />
+            @confirm="handleSignatureConfirm" name="操作人签字" text="是否确认提交该项母代菌种库验证资料的信息?" />
+      <chooseProject @submit="getProjectData" :show="showChoose" @close="showChoose = false"></chooseProject>
     </Card>
 </template>
 
@@ -47,10 +66,12 @@
 import ConfirmStorageDialog from '@/components/confirm-storage-dialog/index.vue'
 import { add, edit, detail } from './service'
 import moment from 'moment'
+import ChooseProject from "@/components/chooseProject/index.vue";
 
 export default {
-    name: 'AddprimitiveCell',
+    name: 'ChiefCellAdd',
     components: {
+      ChooseProject,
         ConfirmStorageDialog
     },
     data() {
@@ -61,6 +82,7 @@
                 count: ''
             },
             roleType: JSON.parse(sessionStorage.getItem('userInfo')).roleType * 1,
+          cacheForm: null,
             form: {
                 strainSource: '',         // 菌种来源
                 identifyingStrainCode: '',      // 鉴别菌株编号
@@ -69,6 +91,9 @@
                 experimentTime: '', // 实验时间
                 handleSignature: '', // 签名图片url
             },
+          showChoose: false,
+          projectData: [], // 存储选中的项目组数据
+          queryForm: {},
             rules: {
                 strainSource: [{ required: true, message: '请输入菌种来源', trigger: 'blur' }],
                 identifyingStrainCode: [{ required: true, message: '请输入鉴别菌株编号', trigger: 'blur' }],
@@ -78,17 +103,25 @@
             }
         }
     },
-    mounted() {
-        if (this.$route.query.id) {
-            detail({ id: this.$route.query.id }).then(res => {
-                if (res) {
-                    // 这里根据实际接口返回字段做适配
-                    this.form = res
-                }
-            })
-        }
+    activated() {
+      if (this.cacheForm) {
+        this.form = this.cacheForm;
+        return;
+      }
+
+      if (this.$route.query.id) {
+        this.loadDetailData();
+      }
     },
+  deactivated() {
+    this.cacheForm = JSON.parse(JSON.stringify(this.form));
+  },
     methods: {
+      getProjectData(data) {
+        this.projectData = [data]; // 将选中的项目组数据存储到数组中
+        this.showChoose = false;
+        this.form.projectId = this.projectData[0].id;
+      },
         handleSubmit() {
             this.$refs.strainForm.validate((valid) => {
                 if (valid) {
@@ -110,31 +143,39 @@
                 if (id) {
                     // 编辑
                     edit({ ...submitData, id }).then(() => {
-                        this.$router.back();
+                      this.cacheForm = null
+                        this.$closeCurrentView('/strain/validation/chief-cell');
                     });
                 } else {
                     // 新增
                     add(submitData).then(() => {
-                        this.$router.back();
+                      this.cacheForm = null
+                        this.$closeCurrentView('/strain/validation/chief-cell');
                     });
                 }
             } else {
                 // 存草稿
                 add(submitData).then(() => {
-                    this.$router.back();
+                  this.cacheForm = null
+                    this.$closeCurrentView('/strain/validation/chief-cell');
                 });
             }
         },
-        mounted() {
+        async loadDetailData() {
             const id = this.$route.query.id || this.$route.params.id;
-            if (id) {
-                // 编辑或详情回显
-                detail({ id }).then(res => {
-                    if (res && res.data) {
-                        // 这里根据实际接口返回字段做适配
-                        Object.assign(this.form, res.data);
-                    }
-                });
+            try {
+                const res = await detail({ id });
+                if (!res || !res.id) {
+                    throw new Error('未获取到验证资料详情');
+                }
+                this.form = { ...this.form, ...res };
+                this.projectData = Array.isArray(res.tprojectTeamList) ? res.tprojectTeamList : [];
+            } catch (error) {
+                console.error('获取母代菌种库验证资料失败:', error);
+                const message = error instanceof Error && error.message
+                    ? error.message
+                    : '获取编辑数据失败,请返回列表后重试';
+                this.$message.error(message);
             }
         }
     }
@@ -182,10 +223,14 @@
     button {
         width: 180px;
         height: 36px;
-        // background: #409EFF; 
+        // background: #409EFF;
     }
 }
 
+.form-actions {
+    margin-top: 48px;
+}
+
 .strain-form {
     padding: 0 40px;
 

--
Gitblit v1.7.1