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/primitive-cell/index.vue |  138 ++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 115 insertions(+), 23 deletions(-)

diff --git a/culture/src/views/strain-library/validation/primitive-cell/index.vue b/culture/src/views/strain-library/validation/primitive-cell/index.vue
index 7e87e13..87c4cec 100644
--- a/culture/src/views/strain-library/validation/primitive-cell/index.vue
+++ b/culture/src/views/strain-library/validation/primitive-cell/index.vue
@@ -1,17 +1,36 @@
 <template>
   <div class="list">
     <!-- Table -->
-    <TableCustom :queryForm="queryForm" :tableData="tableData" :total="total" @currentChange="handleCurrentChange"
-      @sizeChange="handleSizeChange">
+    <TableCustom :queryForm="queryForm" :height="null" :tableData="tableData" :total="total"
+      @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange">
       <template #search>
         <el-form :model="form" label-width="auto" inline>
+          <el-form-item label="选择项目组:">
+            <el-select
+                v-model="form.projectIds"
+                placeholder="请选择项目组"
+                filterable
+                clearable
+                :key="teamList.length"
+                :loading="teamLoading"
+                @focus="fetchTeamList"
+                multiple
+            >
+              <el-option
+                  v-for="item in teamList"
+                  :key="item.id"
+                  :label="item.teamName"
+                  :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
           <el-form-item label="鉴别菌株编号:">
             <el-input v-model="form.identifyingStrainCode" placeholder="请输入"></el-input>
           </el-form-item>
           <el-form-item label="鉴别菌株名称:">
             <el-input v-model="form.identifyingStrainName" placeholder="请输入"></el-input>
           </el-form-item>
-          <el-form-item label="验证实验编号:">
+          <el-form-item label="验证实验编号:" v-if="roleType != 4">
             <el-input v-model="form.validationExperimentCode" placeholder="请输入"></el-input>
           </el-form-item>
 
@@ -26,23 +45,37 @@
         <div class="tableTitle">
           <div class="flex a-center">
             <div class="title" :class="{ active: currentType === 'list' }" @click="handleTypeChange('list')">
-              原始细胞库验证资料
+              祖代菌种库验证资料
             </div>
-            <div class="drafts" :class="{ active: currentType === 'draft' }" @click="handleTypeChange('draft')">
+            <div class="drafts" v-if="roleType == 4 || roleType == 3" :class="{ active: currentType === 'draft' }"
+              @click="handleTypeChange('draft')">
               草稿箱
             </div>
           </div>
-          <div class="flex a-center">
+          <div class="flex a-center" v-if="roleType == 4">
             <el-button @click="handleNewStrain" class="el-icon-plus" type="primary"
-              style="margin-right: 12px">新增原始细胞库资料</el-button>
+              style="margin-right: 12px">新增祖代菌种库验证资料</el-button>
           </div>
         </div>
       </template>
 
       <template #table>
-        <el-table-column prop="strainSource" label="菌种来源" />
+        <el-table-column prop="projectName" label="项目组名称"/>
+        <el-table-column prop="strainSource" label="菌种来源">
+          <template #default="{ row }">
+            <el-tooltip :content="row.strainSource" placement="top" effect="dark">
+              <div class="ellipsis-text">{{ row.strainSource }}</div>
+            </el-tooltip>
+          </template>
+        </el-table-column>
         <el-table-column prop="identifyingStrainCode" label="鉴别菌株编号" />
-        <el-table-column prop="identifyingStrainName" label="鉴别菌株名称" />
+        <el-table-column prop="identifyingStrainName" label="鉴别菌株名称" >
+          <template #default="{ row }">
+            <el-tooltip :content="row.identifyingStrainName" placement="top" effect="dark">
+              <div class="ellipsis-text">{{ row.identifyingStrainName }}</div>
+            </el-tooltip>
+          </template>
+        </el-table-column>
         <el-table-column prop="validationExperimentCode" label="验证实验编号" />
         <el-table-column prop="createBy" label="创建人" />
         <el-table-column prop="createTime" label="创建时间" />
@@ -54,18 +87,21 @@
         </el-table-column>
         <el-table-column label="操作" width="200">
           <template #default="{ row }">
-            <el-button type="text" @click="$router.push('/strain/validation/confirm-detail')">确认</el-button>
-            <el-button type="text" @click="handleDetail(row)">详情</el-button>
-            <el-button type="text" @click="handleDetail2(row)">详情</el-button>
-            <el-button type="text" @click="handleEdit(row)">编辑</el-button>
-            <el-button type="text" @click="handleRecord(row)">删除</el-button>
+            <el-button  style="margin-right: 10px" type="text" v-if="row.status == 1 && roleType == 3"
+              @click="$router.push('/strain/validation/confirm-detail?id=' + row.id)">确认</el-button>
+            <el-button  style="margin-right: 10px" type="text" v-if="roleType == 4" @click="handleDetail(row)">详情</el-button>
+            <el-button  style="margin-right: 10px" type="text" v-if="roleType != 4" @click="handleDetail2(row)">详情</el-button>
+            <el-button  style="margin-right: 10px" type="text" v-if="(roleType == 1) || (roleType == 4 && currentType == 'draft')" @click="handleEdit(row)">编辑</el-button>
+            <el-button type="text" v-if="(roleType == 1) || (roleType == 4 && currentType == 'draft')"
+              @click="handleDelete(row)">删除</el-button>
           </template>
         </el-table-column>
       </template>
     </TableCustom>
     <PrimitiveCellDetailDialog :visible.sync="detailVisible" :detail="currentDetail" />
-    <DetailConditionDialog :visible.sync="detailDialogVisible" :value="detailDialogValue" />
+    <DetailConditionDialog @viewDetail="viewDetail" :visible.sync="detailDialogVisible" :value="detailDialogValue" />
     <EditConditionDialog :visible.sync="editDialogVisible" :value="editDialogValue" />
+    <ShowDelConfirm :show="showDelConfirm" @close="showDelConfirm = false" @confirm="handleDelConfirm" />
   </div>
 </template>
 
@@ -74,7 +110,9 @@
 import DetailConditionDialog from "./DetailConditionDialog.vue";
 import EditConditionDialog from "./EditConditionDialog.vue";
 
-import { getList } from "./service";
+import { getList, delTwo } from "./service";
+import moment from "moment";
+import {myTeamPageList} from "@/components/chooseProject/servce";
 export default {
   name: "PrimitiveCell",
   components: {
@@ -84,16 +122,23 @@
   },
   data() {
     return {
+      teamList: [], // 项目组列表
+      teamLoading: false, // 加载状态
       detailDialogVisible: false,
       detailDialogValue: {},
       dialogVisible: false,
       currentType: "list",
       detailVisible: false,
+      editDialogVisible: false,
+      showDelConfirm: false,
+      editDialogValue: {},
       currentDetail: {},
+      roleType: Number(JSON.parse(sessionStorage.getItem("userInfo")).roleType),
       form: {
         identifyingStrainCode: "",
         identifyingStrainName: "",
         validationExperimentCode: "",
+        projectIds: [],
         startTime: "",
         endTime: "",
         isDraft: 0,
@@ -109,6 +154,7 @@
   },
   methods: {
     handleDetail(row) {
+      row.experimentTime = moment(row.experimentTime).format('YYYY-MM-DD')
       this.currentDetail = row;
       this.detailVisible = true;
     },
@@ -118,6 +164,11 @@
     },
     handleViewMore() {
       this.dialogVisible = true;
+    },
+    viewDetail(row) {
+      row.isDetail = true;
+      this.editDialogValue = row;
+      this.editDialogVisible = true;
     },
     resetForm() {
       this.form = {
@@ -154,15 +205,31 @@
       // Implement batch add logic
     },
     handleEdit(row) {
-      // Implement edit logic
-    },
-    handleRecord(row) {
+      if (Number(this.roleType) === 1) {
+        this.$router.push({ path: "/strain/validation/confirm-detail", query: { id: row.id, mode: 'edit' } });
+        return;
+      }
       this.$router.push({
-        path: "/strain-library/strain-library-manage/record",
+        path: "/strain/validation/edit-primitive-cell",
         query: {
-          id: row.strainNo,
+          id: row.id,
         },
       });
+      // Implement edit logic
+    },
+    handleDelete(row) {
+      this.currentDetail = row;
+      this.showDelConfirm = true;
+    },
+    handleDelConfirm() {
+      delTwo({ id: this.currentDetail.id }).then(res => {
+        this.$message.success('删除成功')
+        this.showDelConfirm = false
+        if (this.tableData.length == 1 && this.queryForm.pageNum > 1) {
+          this.queryForm.pageNum -= 1;
+        }
+        this.searchData()
+      })
     },
     handleCurrentChange(page) {
       this.queryForm.pageNum = page;
@@ -178,9 +245,26 @@
       this.form.strainType = 1; // 1: 原始细胞库
       this.searchData();
     },
+    // 获取项目组列表
+    async fetchTeamList() {
+      if (this.teamList.length > 0) return // 已有数据不再重复请求
+      this.teamLoading = true
+      try {
+        const res = await myTeamPageList()
+        console.log('res', res)
+        // 根据实际接口返回的数据结构调整
+        this.teamList = res.data || res || []
+      } catch (error) {
+        console.error('获取项目组列表失败:', error)
+        this.$message.error('获取项目组列表失败')
+      } finally {
+        this.teamLoading = false
+      }
+    },
   },
-  mounted() {
-    this.searchData();
+  async activated() {
+    await this.fetchTeamList();
+    await this.searchData();
   },
 };
 </script>
@@ -365,4 +449,12 @@
     }
   }
 }
+.ellipsis-text {
+  display: -webkit-box;
+  -webkit-line-clamp: 3;
+  -webkit-box-orient: vertical;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  word-break: break-all;
+}
 </style>

--
Gitblit v1.7.1