From f725d244231d916d59491a907acd812cc84408ad Mon Sep 17 00:00:00 2001
From: 13404089107 <puwei@sinata.cn>
Date: 星期二, 10 六月 2025 14:13:41 +0800
Subject: [PATCH] 调整菌种保存资料

---
 culture/src/views/strain-library/breeding-record/add.vue    |   63 ++++++++++++++++++-------------
 culture/src/views/strain-library/breeding-record/service.js |   15 +++++++
 2 files changed, 51 insertions(+), 27 deletions(-)

diff --git a/culture/src/views/strain-library/breeding-record/add.vue b/culture/src/views/strain-library/breeding-record/add.vue
index ea55051..2b08b25 100644
--- a/culture/src/views/strain-library/breeding-record/add.vue
+++ b/culture/src/views/strain-library/breeding-record/add.vue
@@ -188,12 +188,13 @@
             </template>
           </el-table-column>
           <el-table-column prop="preserveTime" label="入库保藏/废弃时间" />
-          <el-table-column label="操作" v-if="[1, 3].includes(roleType) && $route.query.isDetail || (!$route.query.isDetail &&  [4].includes(roleType))">
+          <el-table-column label="操作"
+            v-if="[1, 3].includes(roleType) && $route.query.isDetail&& !scope.row.preserveSignature || (!$route.query.isDetail && [4].includes(roleType))">
             <template slot-scope="scope">
               <el-button type="text" @click="handleEditInoculation(scope.row, scope.$index)"
                 v-if="!$route.query.isDetail && [1, 4].includes(roleType)">编辑</el-button>
               <el-button type="text" @click="handleConfirmStorageClick(scope.row, scope.$index)"
-                v-if="$route.query.isDetail && [3].includes(roleType)">确认入库</el-button>
+                v-if="$route.query.isDetail && [3].includes(roleType) && !scope.row.preserveSignature">确认入库</el-button>
               <el-button type="text" @click="handleDeleteInoculation(scope.$index)"
                 v-if="!$route.query.isDetail && !scope.row.preserveSignature && [1, 4].includes(roleType)">删除</el-button>
             </template>
@@ -229,12 +230,13 @@
             </template>
           </el-table-column>
           <el-table-column prop="preserveTime" label="保藏时间" />
-          <el-table-column label="操作" v-if="[1, 3].includes(roleType) && $route.query.isDetail || (!$route.query.isDetail &&  [4].includes(roleType))">
+          <el-table-column label="操作"
+            v-if="[1, 3].includes(roleType) && $route.query.isDetail&& !scope.row.preserveSignature || (!$route.query.isDetail && [4].includes(roleType))">
             <template slot-scope="scope">
               <el-button type="text" @click="handleEditPreserve(scope.row, scope.$index)"
                 v-if="!$route.query.isDetail && [1, 4].includes(roleType)">编辑</el-button>
               <el-button type="text" @click="handleConfirmPreserve(scope.row, scope.$index)"
-                v-if="$route.query.isDetail && [3].includes(roleType)">确认入库</el-button>
+                v-if="$route.query.isDetail && [3].includes(roleType) && !scope.row.preserveSignature">确认入库</el-button>
               <el-button type="text" @click="handleDeletePreserve(scope.$index)"
                 v-if="!$route.query.isDetail && !scope.row.preserveSignature && [1, 4].includes(roleType)">删除</el-button>
             </template>
@@ -253,7 +255,7 @@
           @confirm="handleConfirmStorage" />
         <ConfirmPreserveDialog :visible.sync="showConfirmPreserveDialog" :editData="editPreserveData"
           @confirm="handleConfirmPreserveSubmit" />
-        <div class="end-btn" style="margin-top: 20px;" v-if="!$route.query.isDetail&& [3, 4].includes(roleType)">
+        <div class="end-btn" style="margin-top: 20px;" v-if="!$route.query.isDetail && [3, 4].includes(roleType)">
           <el-button type="primary" @click="handleSubmit(1)">提交</el-button>
           <el-button type="primary" @click="handleSubmit(3)">同步给保藏人</el-button>
           <el-button type="default" @click="handleSubmit(2)">存草稿</el-button>
@@ -271,7 +273,7 @@
 import ConfirmStorageDialog from "./confirm-storage-dialog.vue";
 import ConfirmPreserveDialog from "./confirm-preserve-dialog.vue";
 
-import { add, detail, edit } from './service'
+import { add, detail, edit, vaccinationSlopesConfirm, culturePreservationsConfirm } from './service'
 export default {
   components: {
     AiEditor,
@@ -281,6 +283,7 @@
     PreserveStrainRecordDialog,
     ConfirmStorageDialog,
     ConfirmPreserveDialog,
+
   },
   name: "AddBreedingRecord",
   data() {
@@ -548,17 +551,20 @@
       this.showConfirmStorageDialog = true;
     },
     handleConfirmStorage(data) {
-      // 更新对应行的数据,保留原有数据并更新签名
-      if (this.editInoculationIndex !== null) {
-        this.$set(this.form.vaccinationSlopes, this.editInoculationIndex, {
-          ...this.form.vaccinationSlopes[this.editInoculationIndex],
-          preserveSignature: data.preserveSignature, // 更新签名数据
-          status: '保存' // 更新状态为保存
-        });
+      if (data.preserveSignature) {
+        vaccinationSlopesConfirm({ id: this.form.vaccinationSlopes[this.editInoculationIndex].id, preserveSignature: data.preserveSignature }).then(res => {
+          if (this.editInoculationIndex !== null) {
+            this.$set(this.form.vaccinationSlopes, this.editInoculationIndex, {
+              ...this.form.vaccinationSlopes[this.editInoculationIndex],
+              preserveSignature: data.preserveSignature, // 更新签名数据
+              status: '保存' // 更新状态为保存
+            });
+          }
+          this.showConfirmStorageDialog = false;
+          this.editInoculationIndex = null;
+          this.editInoculationData = null;
+        })
       }
-      this.showConfirmStorageDialog = false;
-      this.editInoculationIndex = null;
-      this.editInoculationData = null;
     },
     handleDeleteInoculation(index) {
       this.form.vaccinationSlopes.splice(index, 1);
@@ -595,18 +601,21 @@
       this.showConfirmPreserveDialog = true;
     },
     handleConfirmPreserveSubmit(data) {
-      console.log('确认保藏', data)
-      // 更新对应行的数据,保留原有数据并更新签名
-      if (this.editPreserveIndex !== null) {
-        this.$set(this.form.culturePreservations, this.editPreserveIndex, {
-          ...this.form.culturePreservations[this.editPreserveIndex],
-          preserveSignature: data.preserveSignature, // 更新签名数据
-          preserveTime: data.preserveTime,
-        });
+      if (data.preserveSignature) {
+        culturePreservationsConfirm({ id: this.form.culturePreservations[this.editPreserveIndex].id, preserveSignature: data.preserveSignature }).then(res => {
+          if (this.editPreserveIndex !== null) {
+            this.$set(this.form.culturePreservations, this.editPreserveIndex, {
+              ...this.form.culturePreservations[this.editPreserveIndex],
+              preserveSignature: data.preserveSignature, // 更新签名数据
+              preserveTime: data.preserveTime,
+            });
+          }
+          this.showConfirmPreserveDialog = false;
+          this.editPreserveIndex = null;
+          this.editPreserveData = null;
+        })
       }
-      this.showConfirmPreserveDialog = false;
-      this.editPreserveIndex = null;
-      this.editPreserveData = null;
+
     },
   },
 };
diff --git a/culture/src/views/strain-library/breeding-record/service.js b/culture/src/views/strain-library/breeding-record/service.js
index 22e7b33..20b34af 100644
--- a/culture/src/views/strain-library/breeding-record/service.js
+++ b/culture/src/views/strain-library/breeding-record/service.js
@@ -40,4 +40,19 @@
   return axios.get('/open/t-breeding-and-preservation/getDetailById', {
     params: data
   })
+}
+
+
+//接种斜面记录确认入库
+export const vaccinationSlopesConfirm = (data) => {
+  return axios.post('/api/t-breeding-and-preservation/vaccinationSlopesConfirm', {
+    ...data
+  })
+}
+
+//菌种保藏记录确认入库
+export const culturePreservationsConfirm = (data) => {
+  return axios.post('/api/t-breeding-and-preservation/culturePreservationsConfirm', {
+   ...data
+  })
 }
\ No newline at end of file

--
Gitblit v1.7.1