Ver código fonte

关联质检修改

duy 1 ano atrás
pai
commit
a23f04067a

+ 16 - 7
src/views/debit-pay/admin/components/middlepay/addModal.vue

@@ -666,9 +666,7 @@ const associateQual = ()=>{
 const closeQual = ()=>{
     qualityMoadal.value = false
 }
-const finishModal = (rows)=>{
-    console.log(rows, 'rows')
-    console.log( baseForm.value.fileList, ' baseForm.value.fileList')
+const finishModal = (rows, cancelcheck)=>{
     // 使用reduce方法进行去重
     const uniqueArray = rows.reduce((acc, current) => {
     // 检查当前对象的某个字段是否已存在于累积数组中
@@ -694,18 +692,29 @@ const finishModal = (rows)=>{
                 selectId:ele.selectId,
             })
         }
-
-
     })
-    console.log( baseForm.value.fileList, 'baseForm.value.fileList')
-    console.log( fileList, 'fileList')
+
    fileList.forEach((ele)=>{
     baseForm.value.fileList.push(ele)
    })
 
+//表格取消勾选回显
+
+cancelcheck.forEach((ele)=>{
+    baseForm.value.fileList.forEach((ele1)=>{
+        if (ele === ele1.selectId) {
+           console.log(ele, 'ele')
+          let arr = arrDelKey(baseForm.value.fileList, 'selectId', ele)
+          console.log(arr, 'arr')
+          baseForm.value.fileList = arr
+        }
+    })
+})
 
+// arrDelKey([{id:1},{id:2}], 'id', 2) // [{id:1}]
 
    selectId.value = arrToKey( baseForm.value.fileList, 'selectId', ',')
+   console.log(baseForm.value.fileList, 'baseForm.value.fileList')
 
 }
 </script>

+ 15 - 4
src/views/debit-pay/admin/components/middlepay/qualityRleation.vue

@@ -9,7 +9,11 @@
                     </hc-body>
                 </div>
                 <div :id="`hc_table_card_${uuid}`" class="relative flex-1">
-                    <HcTable ref="qualTable" :column="tableColumn" :datas="tableData" is-new is-check is-reserve-selection :loading="tableLoading" @selection-change="tableSelection">
+                    <HcTable
+                        ref="qualTable" :column="tableColumn" :datas="tableData" is-new is-check is-reserve-selection :loading="tableLoading"
+                        @select="tableSelect"
+                        @selection-change="tableSelection"
+                    >
                         <template #appStatusName="{ row }">
                             <el-tag
                                 v-if="row.appStatusName"
@@ -31,7 +35,7 @@
 
 <script setup>
 import { nextTick, ref, watch } from 'vue'
-import { arrUnion, getArrValue, getObjValue, getRandom } from 'js-fast-way'
+import { arrUnion, getArrValue, getObjValue, getRandom, isArrIndex } from 'js-fast-way'
 import { useAppStore } from '~src/store'
 import unitApi from '~api/project/debit/contract/unit'
 import { queryWbsTreeData } from '~api/other'
@@ -210,9 +214,16 @@ const tableSelection = (rows) => {
     tableKeys.value = rows
      
 }
+const cancelcheck = ref([])
+const tableSelect = (rows)=>{
+   const { selection, row } = rows
+   const isDel = isArrIndex( selection, 'selectId', row.selectId)
+   if (!isDel) {
+      cancelcheck.value.push( row.selectId)
+   }
+}
 //之前选中的
 const saveQualModal = ()=>{
- 
         qualityMoadal.value = false
         emit('close')
         let alarr = arrUnion(tableKeys.value, oriCheckRows.value)
@@ -229,7 +240,7 @@ const saveQualModal = ()=>{
         }
         }, [])
         alarr = uniqueArray
-        emit('finish', alarr)
+        emit('finish', alarr, cancelcheck.value)
         setStoreValue('checkRows', alarr)