liuQiang 2 rokov pred
rodič
commit
a7e503f60f

+ 19 - 3
src/components/ScanFile/ScanFile.vue

@@ -10,7 +10,7 @@
       <div class="main">
         <!-- 头部的总计和移动按钮 -->
         <div class="statistics">
-          <el-checkbox v-model="checkedAll">共{{ total }}项</el-checkbox>
+          <el-checkbox v-model="checkedAll" @change="checkAllChange">共{{ props.scannerFiles.length }}项</el-checkbox>
           <div class="">
             <el-button color="#2E6BC8" @click="toSave">
               <img src="@/assets/images/folder_white.png" alt="" />&nbsp; 移动到
@@ -22,7 +22,7 @@
           <div v-for="item in props.scannerFiles" :key="item" class="one_box">
             <img :src="wangzhi + item.path" alt="" />
             <div class="top_check">
-              <el-checkbox @change="checkChange(item)"></el-checkbox>
+              <el-checkbox :checked="fileArr.some(par=>par == item.q)" @change="checkChange(item)"></el-checkbox>
             </div>
           </div>
         </div>
@@ -68,8 +68,24 @@ const checkChange = (item)=>{
   }else{
     arr.push(item.q)
   }
+  // 判断全选
+  if(arr.length ==  props.scannerFiles.length){
+    checkedAll.value = true
+  }else{
+    checkedAll.value = false
+  }
   fileArr.value = JSON.parse(JSON.stringify(arr))
-  // console.log('fileArr',toRaw(fileArr.value));
+  console.log('fileArr',toRaw(fileArr.value));
+}
+const checkAllChange = ()=>{
+  console.log('checkedAll.value',checkedAll.value);
+  fileArr.value = []
+  if(checkedAll.value){ //全选
+    props.scannerFiles.forEach(item=>{
+      fileArr.value.push(item.q)
+    })
+  }
+  console.log('fileArr',fileArr.value);
 }
 const toSave = ()=>{
   emit('saveScanFile',toRaw(fileArr.value))

+ 1 - 1
src/views/department/MyFile.vue

@@ -137,7 +137,7 @@
                                 </div>
                             </div>
                         </template>
-                          <div v-if="thisFolder.dirType == '1' && isDept"
+                          <div v-if="thisFolder.dirId&& isDept"
                                 style="display: flex;width: 92px;height: 32px;justify-content: flex-start;align-items: center;line-height: 18px;">
                                 <div style="margin-left: 5px;">
                                     <img src="../../assets/images/scanFile.png" style="width: 24px;height: 24px;" alt="">