Selaa lähdekoodia

取消选择接口调用

duy 2 kuukautta sitten
vanhempi
commit
2fbbb6efa1

+ 8 - 0
src/api/modules/tentative/material/sampling.js

@@ -115,4 +115,12 @@ export default {
             params: form,
         })
     },
+    //取消关联取样
+    async cancelSample(form) {
+        return HcApi({
+            url: '/api/blade-business/entrustinfo/cancelSample',
+            method: 'get',
+            params: form,
+        })
+    },
 }

+ 15 - 1
src/views/tentative/detect/commission.vue

@@ -418,12 +418,16 @@ const getDelegateExcelHtml = async () => {
 }
 
 //关联材料选择
-const linkSamplingChange = async ({ id, entrustId }) => {
+const linkSamplingChange = async ({ id, entrustId }, cancelRow) => {
     await getDelegateExcelHtml()
     if (id) {
        isCancel.value = false
 
     } else {
+   
+         await getCancelRow( cancelRow)
+       
+
         isCancel.value = true
     
     }
@@ -433,7 +437,17 @@ const linkSamplingChange = async ({ id, entrustId }) => {
  
   
 }
+//取消关联取样
+
 
+const getCancelRow = async (cancelRow) => {
+ 
+    const { error, code, msg, data } = await samplingApi.cancelSample({
+        id: cancelRow.entrustId,
+        sampleId: cancelRow.id,
+    })
+ 
+}
 //获取委托数据
 const getDelegateDataInfo = async (id, entrustId, formData) => {
     const { primaryKeyId } = nodeDataInfo.value

+ 4 - 3
src/views/tentative/detect/commission/sampling.vue

@@ -175,10 +175,11 @@ const rowSelect = (row) => {
     currentId.value = row.id
     rowItem.value = row
 }
-
+const cancelRow = ref(null)
 //取消选择
-const rowCancel = () => {
+const rowCancel = (row) => {
     currentId.value = null
+    cancelRow.value = row
 }
 
 //确认关联取样材料
@@ -188,7 +189,7 @@ const linkSamplingClick = () => {
         if (currentId.value) {
         emit('change', rowItem.value)
     } else {
-        emit('change', {}) // 如果没有选择,传递空对象
+        emit('change', {}, cancelRow.value) // 如果没有选择,传递空对象
     }
     console.log(rowItem.value, 'rowItem.value')