Browse Source

删除抽检记录接口调用

duy 1 year ago
parent
commit
245215a3a6
1 changed files with 29 additions and 4 deletions
  1. 29 4
      src/views/transfer/components/examination/table-opinion.vue

+ 29 - 4
src/views/transfer/components/examination/table-opinion.vue

@@ -14,7 +14,7 @@
             <el-button v-else type="primary" size="small" @click="editClick(row)">
                 编辑
             </el-button>
-            <el-button type="danger" size="small" @click="delClick(row)">
+            <el-button type="danger" size="small" :loading="delLoading" @click="delClick(row)">
                 删除
             </el-button>
         </template>
@@ -25,6 +25,7 @@
 import { onMounted, ref, watch } from 'vue'
 import { getArrValue } from 'js-fast-way'
 import initialgApi from '~api/initial/initial'
+import { delMessageV2 } from '~com/message/index.js'
 
 //参数
 const props = defineProps({
@@ -108,16 +109,40 @@ const saveClick = async (row) => {
     if (!error && code === 200) {
         window.$message.success(msg)
        
-      
+        getTableData()
 
     } else {
         row.opinion = ''
     }
 }
 
-//删除
-const delClick = (row) => {
+//删除('抽检意见传空')
+const delLoading = ref(false)
+const delClick = async (row) => {
+    delMessageV2(async (action, instance, done) => {
+        if (action === 'confirm') {
+            instance.confirmButtonLoading = true
+            delLoading.value = true
+            const { error, code, data, msg } = await initialgApi.saveInspect({
+            ...row,
+            opinion:'',
 
+            })
+            delLoading.value = false
+            if (!error && code === 200) {
+                window.$message.success(msg)
+            
+                getTableData()
+
+            } else {
+                row.opinion = ''
+            }
+            instance.confirmButtonLoading = false
+            done()
+        } else {
+            done()
+        }
+     })
 }
 </script>