From 037a7112a2bc9e38bb2f398ff5ca740ac01a8fb2 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 20 二月 2025 10:21:05 +0800
Subject: [PATCH] 检验任务搬迁30%

---
 src/views/system/customer/index.vue |   61 +++++++++++++++++++++++++-----
 1 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/src/views/system/customer/index.vue b/src/views/system/customer/index.vue
index bdd5b8f..e88b72b 100644
--- a/src/views/system/customer/index.vue
+++ b/src/views/system/customer/index.vue
@@ -18,7 +18,10 @@
       </div>
     </div>
     <div>
-      <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"></lims-table>
+      <lims-table :tableData="tableData" :column="column"
+                  :height="'calc(100vh - 250px)'"
+                  :page="page" :tableLoading="tableLoading"
+                  @pagination="pagination"></lims-table>
     </div>
     <el-dialog :title="formTitle" :visible.sync="addDia" width="450px">
       <el-form ref="userForm" :model="user" :rules="userRules" label-position="right" label-width="100px">
@@ -59,7 +62,7 @@
 
 <script>
 import limsTable from '@/components/Table/lims-table.vue'
-import {addCustom, selectCustomPageList, upCustom} from "@/api/system/customer";
+import {addCustom, delCustomById, selectCustomPageList, upCustom} from "@/api/system/customer";
 export default {
   components: {
     limsTable
@@ -90,6 +93,12 @@
               clickFun: (row) => {
                 this.openFormDia('edit', row);
               },
+            },{
+              name: '鍒犻櫎',
+              type: 'text',
+              clickFun: (row) => {
+                this.delete(row);
+              },
             },
           ]
         }
@@ -106,13 +115,13 @@
       addDia: false,
       addPower: true,
       user: {
-        name: null
+        company: ''
       },
       userRules: {
         company: [{ required: true, message: '璇疯緭鍏ュ鎴峰悕绉�', trigger: 'blur' }],
         companyEn: [{ required: true, message: '璇疯緭鍏ュ鎴峰悕绉癊N', trigger: 'blur' }],
         address: [{ required: true, message: '璇疯緭鍏ュ崟浣嶅湴鍧�', trigger: 'blur' }],
-        addressEn: [{ required: true, message: '璇疯緭鍗曚綅鍦板潃EN', trigger: 'blur' }],
+        addressEn: [{ required: true, message: '璇疯緭鍏ュ崟浣嶅湴鍧�EN', trigger: 'blur' }],
         num: [{ required: true, message: '璇疯緭鍏ュ姞鎬ラ搴�', trigger: 'blur' }],
         code2: [{ required: true, message: '璇疯緭鍏ュ鎴风紪鍙�', trigger: 'blur' }],
       },
@@ -130,8 +139,8 @@
       selectCustomPageList({...this.queryParams, ...this.page}).then(res => {
         this.tableLoading = false
         if (res.code === 200) {
-          this.tableData = res.data
-          this.page.total = res.total
+          this.tableData = res.data.records
+          this.page.total = res.data.total
         }
       }).catch(err => {
         this.tableLoading = false
@@ -142,10 +151,18 @@
       this.queryParams.company = ''
       this.getList()
     },
+    pagination (page) {
+      this.page.size = page.limit
+      this.getList()
+    },
     openFormDia (type, row) {
       this.addDia = true
+      this.user = {}
       this.formTitle = type === 'add' ? '鏂板瀹㈡埛' : '缂栬緫瀹㈡埛'
       this.operationType = type
+      if (type === 'edit') {
+        this.user = this.HaveJson(row)
+      }
     },
     customAdd() {
       this.$refs['userForm'].validate((valid) => {
@@ -153,27 +170,49 @@
           this.loading = true
           if (this.operationType === 'add') {
             addCustom(this.user).then(res => {
-              if (res.code === 201) return
+              this.loading = false
+              if (res.code !== 200) return
               this.$message.success('鏂板鎴愬姛')
               this.getList()
-              this.loading = false
               this.reset()
+            }).catch(err => {
+              this.loading = false
             })
           } else {
             upCustom(this.user).then(res => {
-              if (res.code === 201) return
+              this.loading = false
+              if (res.code !== 200) return
               this.$message.success('淇敼鎴愬姛')
               this.getList()
-              this.loading = false
               this.reset()
+            }).catch(err => {
+              this.loading = false
             })
           }
         }
       })
     },
     reset () {
-      this.addDia = false
+      this.user = {}
       this.resetForm("userForm");
+      this.addDia = false
+    },
+    delete (row) {
+      this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      }).then(() => {
+        delCustomById({id: row.id}).then(res => {
+          if (res.code === 500) {
+            return
+          }
+          this.$message.success('鍒犻櫎鎴愬姛')
+          this.getList()
+        }).catch(e => {
+          this.$message.error('鍒犻櫎澶辫触')
+        })
+      }).catch(() => {})
     }
   }
 }

--
Gitblit v1.9.3