From b1187d1141a17fea3a7c184db73f232ca9877a85 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 15 二月 2025 15:41:39 +0800
Subject: [PATCH] 能力范围-零件绑定联调

---
 src/components/Table/lims-table.vue                               |    8 
 src/api/structural/structureTestObjectPart.js                     |   30 ++++
 src/components/capability/EditForm.vue                            |   10 -
 src/components/capability/bindPartDialog.vue                      |  136 +++++++++++++++++-----
 src/components/capability/testObjectEditForm.vue                  |   25 ++--
 src/views/structural/capabilityAndLaboratory/capability/index.vue |  125 ++++++++++++++++----
 6 files changed, 252 insertions(+), 82 deletions(-)

diff --git a/src/api/structural/structureTestObjectPart.js b/src/api/structural/structureTestObjectPart.js
index c6c8dd2..d908897 100644
--- a/src/api/structural/structureTestObjectPart.js
+++ b/src/api/structural/structureTestObjectPart.js
@@ -13,7 +13,7 @@
   return request({
     url: '/structureTestObjectPart/addTestObjectPart',
     method: 'post',
-    params: query
+    data: query
   })
 }
 // 妫�楠屽璞′慨鏀逛骇鍝侀浂浠�
@@ -21,7 +21,7 @@
   return request({
     url: '/structureTestObjectPart/updateTestObjectPart',
     method: 'post',
-    params: query
+    data: query
   })
 }
 // 妫�楠屽璞″垹闄や骇鍝侀浂浠�
@@ -35,8 +35,32 @@
 // 鏍规嵁浜у搧id鏌ヨ闆朵欢
 export function selectByProductId(query) {
   return request({
-    url: 'ctPart/selectByProductId',
+    url: '/productPart/selectByProductId',
     method: 'post',
     params: query
   })
 }
+// 鏂板浜у搧闆朵欢
+export function addProductPart(query) {
+  return request({
+    url: '/productPart/addProductPart',
+    method: 'post',
+    data: query
+  })
+}
+// 淇敼浜у搧闆朵欢
+export function updateProductPart(query) {
+  return request({
+    url: '/productPart/updateProductPart',
+    method: 'post',
+    data: query
+  })
+}
+// 鍒犻櫎浜у搧闆朵欢
+export function deleteProductPart(query) {
+  return request({
+    url: '/productPart/deleteProductPart',
+    method: 'post',
+    data: query
+  })
+}
diff --git a/src/components/Table/lims-table.vue b/src/components/Table/lims-table.vue
index 7cc7d82..4f4d89e 100644
--- a/src/components/Table/lims-table.vue
+++ b/src/components/Table/lims-table.vue
@@ -68,17 +68,19 @@
                 <template v-for="(o, key) in item.operation">
                   <el-button
                       v-if="o.type!='upload'"
+                      size="mini"
                       v-show="o.showHide ? o.showHide(scope.row) : true"
                       :disabled="o.disabled ? o.disabled(scope.row) : false"
-                      :icon="o.icon | iconFn(scope.row)"
-                      :plain="o.plain" :size="o.size"
-                      :style="{ 'color': o.color }"
+                      :icon="o.icon | iconFn(scope.row, o)"
+                      :plain="o.plain"
+                      :style="{ 'color': o.name === '鍒犻櫎' ? '#f56c6c' : o.color }"
                       :type="o.type | typeFn(scope.row)"
                       @click="o.clickFun(scope.row)">
                     {{ o.name }}
                   </el-button>
                   <el-upload
                     action="#"
+                    size="mini"
                     :on-change="(file, fileList)=>o.clickFun(scope.row,file, fileList)"
                     :multiple="o.multiple?o.multiple:false"
                     :limit="o.limit?o.limit:1"
diff --git a/src/components/capability/EditForm.vue b/src/components/capability/EditForm.vue
index 2a74a3f..3543847 100644
--- a/src/components/capability/EditForm.vue
+++ b/src/components/capability/EditForm.vue
@@ -317,9 +317,7 @@
           let obj = this.HaveJson(this.editForm)
           obj.method = JSON.stringify(obj.method)
           obj.sample = JSON.stringify(obj.sample)
-          if (obj.radiusList !== null && obj.radiusList.length > 0) {
-            obj.radiusList = JSON.stringify(obj.radiusList)
-          }
+          obj.radiusList = JSON.stringify(obj.radiusList)
           if(obj.id){
             // 淇敼
             upItemParameter(obj).then(res => {
@@ -329,7 +327,7 @@
               }
               this.$message.success('淇敼鎴愬姛')
               this.editFormDia = false
-              this.$emit('refreshTable')
+              this.$emit('refreshList')
             }).catch(e => {
               this.editLoad = false
             })
@@ -342,7 +340,7 @@
               }
               this.$message.success('娣诲姞鎴愬姛')
               this.editFormDia = false
-              this.$emit('refreshTable')
+              this.$emit('refreshList')
             }).catch(e => {
               this.editLoad = false
             })
@@ -353,7 +351,7 @@
     // 鍏抽棴寮规
     closeDia () {
       this.editFormDia = false
-      this.$refs.editForm.resetFields()
+      this.resetForm("editForm");
     },
     selectTestObjectByName() {
       getItemTree().then(res => {
diff --git a/src/components/capability/bindPartDialog.vue b/src/components/capability/bindPartDialog.vue
index 8b876a3..011bffa 100644
--- a/src/components/capability/bindPartDialog.vue
+++ b/src/components/capability/bindPartDialog.vue
@@ -7,7 +7,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="$emit('closeBindPartDialog')">鍙� 娑�</el-button>
-        <el-button type="primary" @click="addBindPart" :loading="addBindLoad">鏂� 澧�</el-button>
+        <el-button type="primary" @click="addBindPart('add')" :loading="addBindLoad">鏂� 澧�</el-button>
       </span>
     </el-dialog>
     <el-dialog :title="dialogTitle" :visible.sync="addBindPartDialog" width="400px" @close="closeBindPartDialog"
@@ -20,10 +20,10 @@
           <el-form-item label="闆朵欢鍙凤細" prop="partNo">
             <el-input v-model="bindPartData.partNo" size="small"></el-input>
           </el-form-item>
-          <el-form-item label="棰滆壊锛�">
+          <el-form-item label="棰滆壊锛�" prop="color">
             <el-input v-model="bindPartData.color" size="small"></el-input>
           </el-form-item>
-          <el-form-item label="鑹叉爣锛�">
+          <el-form-item label="鑹叉爣锛�" prop="colorCode">
             <el-input v-model="bindPartData.colorCode" size="small"></el-input>
           </el-form-item>
         </el-form>
@@ -38,7 +38,13 @@
 
 <script>
 import limsTable from "@/components/Table/lims-table.vue";
-import {selectByProductId, selectByTestObjectId} from "@/api/structural/structureTestObjectPart";
+import {
+  addProductPart,
+  addTestObjectPart, deleteProductPart, deleteTestObjectPart,
+  selectByProductId,
+  selectByTestObjectId, updateProductPart, updateTestObjectPart
+} from "@/api/structural/structureTestObjectPart";
+import {delProduct} from "@/api/structural/capability";
 
 export default {
   name: "bindPartDialog",
@@ -63,6 +69,7 @@
     return {
       isShow: this.bindPartDialog,
       dialogTitle: '鏂板闆朵欢缁戝畾',
+      operationType: '',
       tableData: [],
       tableLoading: false,
       column: [
@@ -78,7 +85,7 @@
               name: '缂栬緫',
               type: 'text',
               clickFun: (row) => {
-                this.editForm(row);
+                this.addBindPart('edit', row);
               },
             },
             {
@@ -149,29 +156,34 @@
       this.tableLoading = true
       // 鏍规嵁绫诲瀷鍒ゆ柇鏄楠屽璞¢浂浠剁粦瀹氳繕鏄骇鍝佺淮鎶ら浂浠剁粦瀹�
       if (this.type === 0) {
-        selectByTestObjectId(this.currentRow.id).then(res => {
+        selectByTestObjectId({id: this.currentRow.id}).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
         })
       } else {
-        selectByProductId(this.currentRow.id).then(res => {
+        selectByProductId({id: this.currentRow.id}).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
         })
       }
     },
-    addBindPart () {
+    addBindPart (type, row) {
       this.addBindPartDialog = true
+      this.dialogTitle = type === 'add' ? '鏂板闆朵欢缁戝畾' : '淇敼闆朵欢缁戝畾'
+      this.operationType = type
+      if (type === 'edit') {
+        this.bindPartData = row
+      }
     },
     // 鎻愪氦闆朵欢缁戝畾
     submitBind () {
@@ -190,33 +202,95 @@
             partNo: this.bindPartData.partNo,
           }
           this.bindLoad = true
-          if (this.type === 0) {
-
+          if (this.operationType === 'add') {
+            if (this.type === 0) {
+              addTestObjectPart(params).then(res => {
+                if (res.code === 200) {
+                  this.resetForm('bindPartData')
+                  this.addBindPartDialog = false
+                  this.$message.success('鏂板鎴愬姛')
+                  this.getList()
+                }
+              }).catch(err => {
+                this.bindLoad = false
+                console.log(err)
+              })
+            } else {
+              addProductPart(params).then(res => {
+                if (res.code === 200) {
+                  this.resetForm('bindPartData')
+                  this.addBindPartDialog = false
+                  this.$message.success('鏂板鎴愬姛')
+                  this.getList()
+                }
+              }).catch(err => {
+                this.bindLoad = false
+                console.log(err)
+              })
+            }
+          } else {
+            if (this.type === 0) {
+              updateTestObjectPart(params).then(res => {
+                if (res.code === 200) {
+                  this.resetForm('bindPartData')
+                  this.addBindPartDialog = false
+                  this.$message.success('淇敼鎴愬姛')
+                  this.getList()
+                }
+              }).catch(err => {
+                this.bindLoad = false
+                console.log(err)
+              })
+            } else {
+              updateProductPart(params).then(res => {
+                if (res.code === 200) {
+                  this.resetForm('bindPartData')
+                  this.addBindPartDialog = false
+                  this.$message.success('淇敼鎴愬姛')
+                  this.getList()
+                }
+              }).catch(err => {
+                this.bindLoad = false
+                console.log(err)
+              })
+            }
           }
-          this.$axios.post(url, params, {
-            headers: {
-              'Content-Type': 'application/json'
-            }
-          }).then(res => {
-            this.bindLoad = false
-            if (res.code === 200) {
-              this.$refs['bindPartData'].resetFields();
-              this.addBindPartDialog = false
-              this.$message.success('鎿嶄綔鎴愬姛')
-              this.getList()
-            }
-          }).catch(err => {
-            this.bindLoad = false
-            console.log(err)
-          })
         } else {
           console.log('error submit!!');
           return false;
         }
       })
     },
+    delete (row) {
+      this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        if (this.type === 0) {
+          deleteTestObjectPart({id:row.id}).then(res => {
+            if (res.code === 200) {
+              this.$message.success('鍒犻櫎鎴愬姛')
+              this.getList();
+            }
+          })
+        } else {
+          deleteProductPart({id:row.id}).then(res => {
+            if (res.code === 200) {
+              this.$message.success('鍒犻櫎鎴愬姛')
+              this.getList();
+            }
+          })
+        }
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      })
+    },
     closeBindPartDialog () {
-      this.$refs['bindPartData'].resetFields();
+      this.resetForm('bindPartData')
       this.addBindPartDialog = false
     },
   },
diff --git a/src/components/capability/testObjectEditForm.vue b/src/components/capability/testObjectEditForm.vue
index 5b1a799..e92119c 100644
--- a/src/components/capability/testObjectEditForm.vue
+++ b/src/components/capability/testObjectEditForm.vue
@@ -4,7 +4,7 @@
       <el-form ref="editForm" :model="editForm" :rules="editFormRules" label-width="120px" label-position="right">
         <el-form-item label="鍦烘墍锛�" prop="laboratoryId">
           <el-select v-model="editForm.laboratoryId" clearable placeholder="璇烽�夋嫨" size="small" style="width: 100%">
-            <el-option v-for="item in laboratoryList" :key="item.label" :label="item.label" :value="item.label"></el-option>
+            <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="妫�楠屽璞★細" prop="specimenName">
@@ -46,6 +46,7 @@
       editFormDia: false,
       editLoad: false,
       editForm: {
+        id: '',
         laboratoryId: '', // 鍦烘墍
         specimenName: '', // 妫�楠屽璞�
         specimenNameEn: '', // 妫�楠屽璞N
@@ -74,9 +75,9 @@
       this.obtainItemParameterList()
       this.editFormDia = true
       if (type === 'add') {
-        this.$refs.editForm.resetFields()
+        this.resetForm("editForm");
       } else {
-        this.editForm = this.HaveJson(row)
+        this.editForm = {...row}
       }
     },
     // 鎻愪氦缂栬緫
@@ -84,32 +85,31 @@
       this.$refs.editForm.validate(valid => {
         if (valid) {
           this.editLoad = true
-          let obj = this.HaveJson(this.editForm)
-          if(obj.id){
+          if(this.editForm.id){
             // 淇敼
-            upTestObject(obj).then(res => {
+            upTestObject(this.editForm).then(res => {
               this.editLoad = false
-              if (res.code === 201) {
+              if (res.code === 500) {
                 return
               }
               this.$message.success('淇敼鎴愬姛')
               this.closeDia()
+              this.$emit('refreshList')
             }).catch(e => {
               this.editLoad = false
-              this.editFormDia = false
             })
           }else{
             // 鏂板
-            addTestObject(obj).then(res => {
+            addTestObject(this.editForm).then(res => {
               this.editLoad = false
-              if (res.code === 201) {
+              if (res.code === 500) {
                 return
               }
               this.$message.success('娣诲姞鎴愬姛')
               this.closeDia()
+              this.$emit('refreshList')
             }).catch(e => {
               this.editLoad = false
-              this.editFormDia = false
             })
           }
         }
@@ -118,8 +118,7 @@
     // 鍏抽棴寮规
     closeDia () {
       this.editFormDia = false
-      this.$refs.editForm.resetFields()
-      this.$parent.refreshTable('page')
+      this.resetForm("editForm");
     },
     // 鑾峰彇鍦烘墍涓嬫媺妗嗙殑鍊�
     obtainItemParameterList() {
diff --git a/src/views/structural/capabilityAndLaboratory/capability/index.vue b/src/views/structural/capabilityAndLaboratory/capability/index.vue
index 9916b1e..d026e38 100644
--- a/src/views/structural/capabilityAndLaboratory/capability/index.vue
+++ b/src/views/structural/capabilityAndLaboratory/capability/index.vue
@@ -3,7 +3,7 @@
     <div>
       <el-row class="title">
         <el-col :span="12" style="text-align: left">
-          <el-radio-group v-model="radio" size="medium" fill="#409EFF">
+          <el-radio-group v-model="radio" size="medium" fill="#409EFF" @change="refreshTable">
             <el-radio-button :label="0">妫�楠岄」鐩弬鏁�</el-radio-button>
             <el-radio-button :label="1">妫�楠屽璞�</el-radio-button>
           </el-radio-group>
@@ -43,10 +43,12 @@
           <el-button icon="el-icon-refresh" size="mini" @click="refresh">閲� 缃�</el-button>
         </el-form-item>
       </el-form>
+<!--      妫�楠岄」鐩弬鏁拌〃鏍�-->
       <div class="table" v-if="radio===0">
         <lims-table :tableData="tableData" :column="column"
                     :page="page" :tableLoading="tableLoading"></lims-table>
       </div>
+<!--      妫�楠屽璞¤〃鏍�-->
       <div class="table" v-if="radio===1">
         <lims-table :tableData="testObjectTableData" :column="testObjectColumn"
                     :page="testObjectPage" :tableLoading="tableLoading"></lims-table>
@@ -64,8 +66,8 @@
       </span>
     </el-dialog>
     <!--浜у搧缁存姢缂栬緫-->
-    <el-dialog title="缂栬緫浜у搧缁存姢" :visible.sync="productEditDia" width="400px">
-      <el-form :model="productEditForm" ref="productEditForm" :rules="productRules">
+    <el-dialog title="鎿嶄綔浜у搧缁存姢" :visible.sync="productEditDia" width="400px">
+      <el-form :model="productEditForm" ref="productEditForm" :rules="productRules" label-position="right" label-width="100px">
         <el-form-item label="浜у搧鍚嶇О" prop="name">
           <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="productEditForm.name"></el-input>
         </el-form-item>
@@ -96,8 +98,8 @@
       </span>
     </el-dialog>
     <!--妫�楠岄」鐩弬鏁�-缂栬緫寮规-->
-    <EditForm ref="editForm" @refreshTable="refreshTable"></EditForm>
-    <testObjectEditForm ref="testObjectEditForm"></testObjectEditForm>
+    <EditForm ref="editForm" @refreshList="refreshList1"></EditForm>
+    <testObjectEditForm ref="testObjectEditForm" @refreshList="refreshList"></testObjectEditForm>
     <BindPartDialog v-if="bindPartDialog" :bindPartDialog="bindPartDialog"
                     :currentRow="currentRow"
                     :type="type"
@@ -113,8 +115,9 @@
 import BindPartDialog from "@/components/capability/bindPartDialog.vue"
 import BindSupplierDensityDialog from "@/components/capability/bindSupplierDensityDialog.vue"
 import {
+  addProduct,
   delItemParameter, delProduct, delTestObject, selectItemParameterList, selectProductListByObjectId,
-  selectTestObjectList,
+  selectTestObjectList, upProduct,
 } from "@/api/structural/capability";
 import limsTable from "@/components/Table/lims-table.vue";
 import EditForm from "@/components/capability/EditForm.vue";
@@ -151,10 +154,12 @@
           dataType: 'action',
           fixed: 'right',
           label: '鎿嶄綔',
+          width: '140px',
           operation: [
             {
               name: '缂栬緫',
               type: 'text',
+              icon: 'el-icon-edit',
               clickFun: (row) => {
                 this.editForm(row);
               },
@@ -162,6 +167,7 @@
             {
               name: '鍒犻櫎',
               type: 'text',
+              icon: 'el-icon-delete',
               clickFun: (row) => {
                 this.delete(row);
               },
@@ -240,10 +246,12 @@
           dataType: 'action',
           fixed: 'right',
           label: '鎿嶄綔',
+          width: '240px',
           operation: [
             {
               name: '缂栬緫',
               type: 'text',
+              icon: 'el-icon-edit',
               clickFun: (row) => {
                 this.editTestObjectForm(row);
               },
@@ -251,6 +259,7 @@
             {
               name: '鍒犻櫎',
               type: 'text',
+              icon: 'el-icon-delete',
               clickFun: (row) => {
                 this.deleteTest(row);
               },
@@ -300,6 +309,7 @@
             {
               name: '缂栬緫',
               type: 'text',
+              icon: 'el-icon-edit',
               clickFun: (row) => {
                 this.editProduct('edit', row);
               },
@@ -307,6 +317,7 @@
             {
               name: '鍒犻櫎',
               type: 'text',
+              icon: 'el-icon-delete',
               clickFun: (row) => {
                 this.deleteProduct(row);
               },
@@ -336,10 +347,14 @@
       },
       productableLoading: false,
       productEditDia: false,
+      operationType: '',
       productEditForm: {
+        objectId: '',
+        id: '',
         name: '',
         nameEn: ''
       },
+      objectId: '',
       productRules: {
         name: [{ required: true, message: '璇峰~鍐欎骇鍝佸悕绉�', trigger: 'blur' }],
         nameEn: [{ required: true, message: '璇峰~鍐欎骇鍝佸悕绉癊N', trigger: 'blur' }]
@@ -355,7 +370,7 @@
       type: null,  // 闆朵欢缁戝畾鐨勭被鍨�--0锛氭楠屽璞★紝1锛氫骇鍝佺淮鎶�
     }
   },
-  mounted() {
+  created() {
     this.refreshTable()
   },
   computed: {
@@ -365,7 +380,7 @@
   },
   methods: {
     submitUpload() {
-      if (this.$refs.upload.uploadFiles.length == 0) {
+      if (this.$refs.upload.uploadFiles.length === 0) {
         this.$message.error('鏈�夋嫨鏂囦欢')
         return
       }
@@ -376,7 +391,7 @@
       this.$refs.upload.clearFiles()
       this.uploadDia = false
       this.uploading = false
-      if (response.code == 201) {
+      if (response.code === 201) {
         this.$message.error(response.message)
         return
       }
@@ -414,11 +429,17 @@
     },
     handleSuccessUp (response, file, fileList) {
       this.$refs.upload.clearFiles()
-      if (response.code == 201) {
+      if (response.code === 201) {
         this.$message.error(response.message)
         return
       }
       this.$message.success('涓婁紶鎴愬姛')
+      this.refreshTable()
+    },
+    refreshList () {
+      this.refreshTable()
+    },
+    refreshList1 () {
       this.refreshTable()
     },
     refreshTable() {
@@ -463,12 +484,23 @@
     },
     // 妫�楠岄」鐩弬鏁�-鍒犻櫎
     delete (row) {
-      this.$modal.confirm('鏄惁纭鍒犻櫎姝ゆ暟鎹」锛�').then(function() {
-        return delItemParameter(row.id);
+      this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
       }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
+        delItemParameter({id:row.id}).then(res => {
+          if (res.code === 200) {
+            this.$message.success('鍒犻櫎鎴愬姛')
+            this.refreshTable();
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      })
     },
     // 妫�楠屽璞�-鎵撳紑淇敼寮规
     editTestObjectForm (row) {
@@ -476,16 +508,28 @@
     },
     // 妫�楠岄」鐩弬鏁�-鍒犻櫎
     deleteTest (row) {
-      this.$modal.confirm('鏄惁纭鍒犻櫎姝ゆ暟鎹」锛�').then(function() {
-        return delTestObject(row.id);
+      this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
       }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
+        delTestObject({id:row.id}).then(res => {
+          if (res.code === 200) {
+            this.$message.success('鍒犻櫎鎴愬姛')
+            this.refreshTable();
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      })
     },
     // 浜у搧缁存姢
     upProduct(row) {
       this.diaProduct = true
+      this.objectId = row.id
       this.getProductList(row)
     },
     getProductList (row) {
@@ -506,6 +550,7 @@
     // 浜у搧缁存姢-鏂板-缂栬緫
     editProduct (type, row) {
       this.productEditDia = true
+      this.operationType = type
       if (type === 'edit') {
         this.productEditForm = row
       }
@@ -514,7 +559,24 @@
     submitProduct () {
       this.$refs['productEditForm'].validate((valid) => {
         if (valid) {
-
+          this.productEditForm.objectId = this.objectId
+          if (this.operationType === 'add') {
+            addProduct(this.productEditForm).then(res => {
+              if (res.code === 200) {
+                this.$message.success('鏂板鎴愬姛')
+                this.productEditDia = false
+                this.refreshTable();
+              }
+            })
+          } else {
+            upProduct(this.productEditForm).then(res => {
+              if (res.code === 200) {
+                this.$message.success('鏂板鎴愬姛')
+                this.productEditDia = false
+                this.refreshTable();
+              }
+            })
+          }
         }
       })
     },
@@ -524,12 +586,23 @@
     },
     // 浜у搧缁存姢-鍒犻櫎
     deleteProduct (row) {
-      this.$modal.confirm('鏄惁纭鍒犻櫎姝ゆ暟鎹」锛�').then(function() {
-        return delProduct(row.id);
+      this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
       }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
+        delProduct({id:row.id}).then(res => {
+          if (res.code === 200) {
+            this.$message.success('鍒犻櫎鎴愬姛')
+            this.refreshTable();
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      })
     },
     // 闆朵欢缁戝畾
     bindPartFirst (row) {

--
Gitblit v1.9.3