Procházet zdrojové kódy

档案初验修改

duy před 1 rokem
rodič
revize
dde7acee5b

+ 24 - 7
src/views/transfer/components/table-collect.vue

@@ -36,7 +36,7 @@
                             <!-- <span class="text-gray">(238卷)</span> -->
                         </template>
                         <div :style="`height: ${item1.list !== null && item1.list.length > 9 ? '300px' : 'auto'};`">
-                            <visualTable ref="visuatable" :table-data="item1.list " @getTableKeys="getTableKeys" />
+                            <visualTable ref="visuatable" :table-data="item1.list " :index-num="index" @getTableKeys="getTableKeys($event, index1)" />
                         </div>
                     </HcCardItem>
                 </template>
@@ -56,7 +56,7 @@
         :ids="reportIds"
         is-datas
         :datas="reportDatas"
-        @hide="showReportModal = false"
+        @hide="hidereport"
         @finish="showReportFinish"
         @tagClose="reportTaskTagClose"
     />
@@ -161,12 +161,21 @@ const getTotalTabledata = (data)=>{
 
 //上报
 const tableKeys = ref([])
-const getTableKeys = (val)=>{
-    tableKeys.value = val
+const reprotTitle = ref(new Map())
+const getTableKeys = (val, index)=>{
+    let arr = []
+    reprotTitle.value.set(index, val)
+    for (const value of reprotTitle.value.values()) {
+        console.log(value)
+        value.forEach((ele)=>{
+            arr.push(ele)
+        })
+     }
+     tableKeys.value = arr
+
 }
 const checkedval = ref(false)
-const clickAll = (val, index)=>{
-    console.log(val, 'val')
+const clickAll = (val)=>{
     if (val) {
         tableKeys.value = totalTabledata.value
     } else {
@@ -180,6 +189,8 @@ const reportDatas = ref([])
 const showReportModal = ref(false)
 const reportLoading = ref(false)
 const reportModalClick = async () => {
+    console.log(visuatable.value, 'visuatable.value')
+
     const rows = tableKeys.value
     console.log(rows, 'rows验收申请行')
     if (rows.length > 0) {
@@ -203,13 +214,19 @@ const reportModalClick = async () => {
         window.$message?.warning('请先勾选需要申请验收的数据')
     }
 }
+const hidereport = ()=>{
+    showReportModal.value = false
+    visuatable.value.forEach((ele, index)=>{
+        visuatable.value[index]?.clearSelection()
+    })
+}
 const visuatable = ref(null)
 //上报的审批内容移除
 const reportTaskTagClose = (index) => {
     // const row = tableKeys.value[index]
     console.log(visuatable.value[0])
     tableKeys.value.splice(index, 1)
-
+  
     // // tableRef.value?.toggleRowSelection(row, false)
     // console.log(visuatable.value[index], '1111')
 }

+ 16 - 20
src/views/transfer/components/visual-table.vue

@@ -19,38 +19,29 @@ const props = defineProps({
       type:Boolean,
       default:true,
     },
+    indexNum:{
+      type:Number,
+      default:0,
+    },
 })
 //事件
 const emit = defineEmits(['getTableKeys'])
 const isCheck = ref(props.isCheck)
 const allData = ref(props.tableData)
+const indexNum = ref(props.indexNum)
 const needle = ref(10)//数据指针 默认19
 const tableData = ref([])
 const tableLoaing = ref(false)
 //多选
 const tableKeys = ref([])
 const tableSelection = (rows) => {
+
     tableKeys.value = rows
-    emit('getTableKeys', rows)
-}
-const tableSelectAll = (val)=>{
-  if (val) {
-    // tableData.value.forEach((ele1)=>{
-    //     nextTick(()=>{
-    //       tableRef.value.toggleRowSelection( ele1, true )
-    //     })
-    //   })
+    emit('getTableKeys', rows, indexNum.value)
 
-    tableKeys.value = allData.value 
-    emit('getTableKeys', allData.value )
-  } else {
-    tableRef.value.clearSelection()
-    tableKeys.value = []
-    emit('getTableKeys', tableKeys.value )
-  }
-  
-  
 }
+//返回当前选中的行
+
 //表头
 const tableRef = ref(null)
 const tableColumn = ref([
@@ -64,9 +55,11 @@ const tableColumn = ref([
 watch(() => [
     props.tableData,
     props.isCheck,
-], ([Data, Check]) => {
+    props.indexNum,
+], ([Data, Check, index]) => {
     allData.value = Data
     isCheck.value = Check
+    indexNum.value = index
     tableData.value = []
         //判断数据长度有没有9个,有就先添加9个,没有直接获取所有数据
         if (allData.value.length > 9) {
@@ -120,9 +113,12 @@ const scrollBehavior = async (e)=>{
         }
       }
 }
+const clearSelection = ()=>{
+  tableRef.value?.clearSelection()
+}
 // 暴露出去
 defineExpose({
-  tableSelectAll,
+  clearSelection,
 })
 </script>