From 4a364d65d24020dcacab6c1ee86f854d8de8cd36 Mon Sep 17 00:00:00 2001
From: pyt <626651354@qq.com>
Date: 星期一, 19 五月 2025 09:05:19 +0800
Subject: [PATCH] feat

---
 culture/src/views/strain-library/strain-library-manage/index.vue |  229 +++++++++++++++++++--------------------------------------
 1 files changed, 77 insertions(+), 152 deletions(-)

diff --git a/culture/src/views/strain-library/strain-library-manage/index.vue b/culture/src/views/strain-library/strain-library-manage/index.vue
index f5e0be6..dc579a6 100644
--- a/culture/src/views/strain-library/strain-library-manage/index.vue
+++ b/culture/src/views/strain-library/strain-library-manage/index.vue
@@ -1,7 +1,7 @@
 <template>
     <div class="list">
         <el-card class="header-box">
-            
+
             <div class="box-title">
                 <img src="@/assets/public/notice.png" class="header-icon">
                 <span>菌种源保藏出/入细胞库登记表说明</span>
@@ -15,12 +15,7 @@
             </div>
 
             <!-- 查看全部弹窗 -->
-            <el-dialog
-                title="菌种源保藏出/入细胞库登记表说明"
-                :visible.sync="dialogVisible"
-                width="50%"
-                class="view-all-dialog"
-            >
+            <el-dialog title="菌种源保藏出/入细胞库登记表说明" :visible.sync="dialogVisible" width="50%" class="view-all-dialog">
                 <div class="dialog-content">
                     <p>1、菌种全部集中登记在【菌种源保藏出/入细胞库登记表】,请将来源有3 类菌经。</p>
                     <p>1.1 原净土管理日油性的源头菌种:入细胞细胞库(现代-O)。</p>
@@ -50,8 +45,8 @@
                         </el-select>
                     </el-form-item>
                     <el-form-item class="search-btn-box">
-                            <el-button type="default" @click="resetForm">重置</el-button>
-                            <el-button type="primary" @click="searchData">查询</el-button>
+                        <el-button type="default" @click="resetForm">重置</el-button>
+                        <el-button type="primary" @click="searchData">查询</el-button>
                     </el-form-item>
                 </el-form>
             </template>
@@ -67,23 +62,24 @@
                             草稿箱</div>
                     </div>
                     <div class="flex a-center">
-                        <el-button @click="handleNewStrain" class="el-icon-plus" type="primary" style="margin-right: 12px;">新增原始细胞</el-button>
-                        <el-button @click="handleBatchAdd" class="el-icon-plus" type="primary">批量新增</el-button>
+                        <el-button @click="handleNewStrain" class="el-icon-plus" type="primary"
+                            style="margin-right: 12px;">新增原始细胞</el-button>
+                        <el-button @click="handleNewStrain" class="el-icon-plus" type="primary">批量新增</el-button>
                     </div>
                 </div>
             </template>
 
             <template #table>
-                <el-table-column prop="strainNo" label="菌种编号" />
+                <el-table-column prop="strainCode" label="菌种编号" />
                 <el-table-column prop="strainName" label="菌种名称" />
-                <el-table-column prop="source" label="菌种来源" />
-                <el-table-column prop="method" label="鉴定方法" />
-                <el-table-column prop="certificate" label="特征描述" />
-                <el-table-column prop="storage" label="菌种保存方法" />
-                <el-table-column prop="amount" label="保存位置" />
-                <el-table-column prop="inventory" label="库存余量" />
-                <el-table-column prop="notes" label="备注" />
-                <el-table-column prop="status" label="当前状态">
+                <el-table-column prop="strainSource" label="菌种来源" />
+                <el-table-column prop="appraisalMethod" label="鉴定方法" />
+                <el-table-column prop="features" label="特征描述" />
+                <el-table-column prop="saveMethod" label="菌种保存方法" />
+                <el-table-column prop="saveLocation" label="保藏位置" />
+                <el-table-column prop="stock" label="库存余量" />
+                <el-table-column prop="remark" label="备注" />
+                <el-table-column v-if="currentType === 'list'" prop="status" label="当前状态">
                     <template #default="{ row }">
                         <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag>
                     </template>
@@ -92,25 +88,23 @@
                     <template #default="{ row }">
                         <el-button type="text" @click="handleDetail(row)">详情</el-button>
                         <el-button type="text" @click="handleEdit(row)">编辑</el-button>
-                        <el-button type="text" @click="handleRecord(row)">出入库记录</el-button>
+                        <el-button v-if="currentType === 'list'" type="text" @click="handleRecord(row)">出入库记录</el-button>
                     </template>
                 </el-table-column>
             </template>
         </TableCustom>
-        <StrainDetail
-            :visible.sync="detailVisible"
-            :detail="currentDetail"
-        />
+        <StrainDetail :visible.sync="detailVisible" :detail="currentDetail" />
     </div>
 </template>
 
 <script>
 import StrainDetail from './components/StrainDetail.vue'
+import { getList } from './service'
 
 export default {
     name: 'StrainLibraryManage',
     components: {
-        StrainDetail
+        StrainDetail,
     },
     data() {
         return {
@@ -121,78 +115,34 @@
             form: {
                 strainNo: '',
                 strainName: '',
-                status: ''
+                status: '',
+                type: 1
             },
             queryForm: {
                 pageSize: 10,
-                pageNum: 1
+                pageNum: 1,
             },
             total: 800,
-            tableData: [
-                {
-                    strainNo: 'YX-2024001',
-                    strainName: '大肠杆菌',
-                    source: '实验室分离',
-                    method: '形态学鉴定、生理生化试验',
-                    certificate: '革兰氏阴性杆菌,可发酵葡萄糖产酸产气,IMViC试验++--',
-                    storage: '斜面培养',
-                    amount: 'A区-01-001',
-                    inventory: '50',
-                    notes: '用于质粒转化',
-                    status: '1'
-                },
-                {
-                    strainNo: 'YX-2024002',
-                    strainName: '枯草芽孢杆菌',
-                    source: '菌种保藏中心',
-                    method: '16S rDNA测序',
-                    certificate: '革兰氏阳性芽孢杆菌,可水解淀粉,产生溶菌素',
-                    storage: '冷冻保存',
-                    amount: 'B区-02-005',
-                    inventory: '30',
-                    notes: '工业发酵菌种',
-                    status: '1'
-                },
-                {
-                    strainNo: 'YX-2024003',
-                    strainName: '酿酒酵母',
-                    source: '发酵工厂',
-                    method: '显微镜观察、生理特性',
-                    certificate: '椭圆形单细胞真菌,可发酵葡萄糖产生乙醇',
-                    storage: '甘油管保存',
-                    amount: 'A区-03-002',
-                    inventory: '40',
-                    notes: '发酵工艺优化',
-                    status: '2'
-                },
-                {
-                    strainNo: 'YX-2024004',
-                    strainName: '乳酸菌',
-                    source: '乳制品分离',
-                    method: '生化鉴定、API条',
-                    certificate: '革兰氏阳性球菌,产生乳酸,耐酸性强',
-                    storage: '冷冻干燥',
-                    amount: 'C区-01-003',
-                    inventory: '25',
-                    notes: '益生菌研究',
-                    status: '3'
-                },
-                {
-                    strainNo: 'YX-2024005',
-                    strainName: '青霉菌',
-                    source: '环境样本',
-                    method: '形态学特征、ITS测序',
-                    certificate: '丝状真菌,产生蓝绿色分生孢子,可产青霉素',
-                    storage: '斜面培养',
-                    amount: 'B区-04-001',
-                    inventory: '35',
-                    notes: '次级代谢产物研究',
-                    status: '1'
-                }
-            ]
+            tableData: []
         }
     },
+    activated() {
+        this.searchData()
+    },
     methods: {
+        handleRecord(row) {
+            this.$router.push({ path: `/strain-library/strain-library-manage/record?id=${row.id}` })
+        },
+        handleNewStrain() {
+            this.$router.push({ path: '/strain-library/strain-library-manage/add' })
+        },
+        handleEdit(row) {
+            this.$router.push({ path: `/strain-library/strain-library-manage/add?id=${row.id}` })
+        },
+        handleDetail(row) {
+            this.currentDetail = row;
+            this.detailVisible = true;
+        },
         handleViewMore() {
             this.dialogVisible = true;
         },
@@ -205,78 +155,54 @@
             this.searchData()
         },
         searchData() {
-            // 模拟搜索逻辑
-            const { strainNo, strainName, status } = this.form
-            let filteredData = [...this.tableData]
-            
-            if (strainNo) {
-                filteredData = filteredData.filter(item => 
-                    item.strainNo.toLowerCase().includes(strainNo.toLowerCase())
-                )
-            }
-            if (strainName) {
-                filteredData = filteredData.filter(item => 
-                    item.strainName.toLowerCase().includes(strainName.toLowerCase())
-                )
-            }
-            if (status) {
-                filteredData = filteredData.filter(item => 
-                    item.status === status
-                )
-            }
-            
-            this.total = filteredData.length
-            // 实际项目中这里应该调用API
-            console.log('搜索条件:', this.form)
-            console.log('分页信息:', this.queryForm)
-        },
-        handleNewStrain() {
-            this.$router.push('/strain-library/strain-library-manage/add')
-            // Implement new strain logic
-        },
-        handleBatchAdd() {
-            // Implement batch add logic
-        },
-        handleDetail(row) {
-            this.currentDetail = row;
-            this.detailVisible = true;
-        },
-        handleEdit(row) {
-            // Implement edit logic
-        },
-        handleRecord(row) {
-            this.$router.push({
-                path: '/strain-library/strain-library-manage/record',
-                query: {
-                    id: row.strainNo
+            const params = {
+                pageNum: this.queryForm.pageNum,
+                pageSize: this.queryForm.pageSize,
+                strainCode: this.form.strainNo,
+                strainName: this.form.strainName,
+                isDraft: this.currentType === 'draft' ? 1 : 0,
+                status: {
+                    '1': 3,
+                    '2': 1,
+                    '3': 4
+                }[this.form.status] || ''
+            };
+            getList(params).then(res => {
+                if (res.code === 200) {
+                    this.tableData = res.data.records;
+                    this.total = res.data.total;
                 }
-            })
+            }).catch(err => {
+                this.$message.error('数据加载失败');
+            });
         },
         handleCurrentChange(page) {
-            this.queryForm.pageNum = page
-            // Implement page change logic
+            this.queryForm.pageNum = page;
+            this.searchData();
         },
         handleSizeChange(size) {
-            this.queryForm.pageSize = size
-            // Implement size change logic
+            this.queryForm.pageSize = size;
+            this.searchData();
         },
         handleTypeChange(type) {
             this.currentType = type;
-            // Implement type change logic
+            this.searchData()
         },
         getStatusType(status) {
             const types = {
-                1: 'success',
-                2: 'info',
-                3: 'warning'
+                1: 'warning',
+                2: 'warning',
+                3: 'success',
+                4: 'success'
             }
             return types[status] || 'info'
         },
         getStatusText(status) {
             const texts = {
-                1: '已入库',
-                2: '已出库',
-                3: '入库待确认'
+                1: '已出库',
+                2: '出库待确认',
+                3: '已入库',
+                4: '入库待确认'
             }
             return texts[status] || '未知状态'
         }
@@ -427,7 +353,7 @@
         background: #ffffff;
         border-radius: 8px 8px 0px 0px;
         border: 1px solid #049c9a;
-        
+
     }
 }
 
@@ -436,7 +362,7 @@
         padding: 20px;
         border-bottom: 1px solid #EBEEF5;
         margin-right: 0;
-        
+
         .el-dialog__title {
             font-size: 18px;
             font-weight: bold;
@@ -454,11 +380,11 @@
 
             p {
                 margin: 12px 0;
-                
+
                 &:first-child {
                     margin-top: 0;
                 }
-                
+
                 &:last-child {
                     margin-bottom: 0;
                 }
@@ -466,5 +392,4 @@
         }
     }
 }
-
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.7.1