Browse Source

feat: 支持文件批量检入检出

yusheng 2 months ago
parent
commit
c04045cf36

+ 2 - 3
src/api/doc-manage/index.js

@@ -59,13 +59,12 @@ export async function directoryDeleteAPI(data) {
 }
 
 
-
 /**
  * 检入
  * @data data
  */
 export async function checkEnter(data) {
-  const res = await request.post('/fm/file/checkEnter', data);
+  const res = await request.post('/fm/file/checkEnterList', data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -76,7 +75,7 @@ export async function checkEnter(data) {
  * @data data
  */
 export async function checkOut(data) {
-  const res = await request.post('/fm/file/checkOut', data);
+  const res = await request.post('/fm/file/checkOutList', data);
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 1 - 1
src/views/doc/components/file-edit.vue

@@ -305,7 +305,7 @@
                 await fileVersion({ id: data.id });
               }
               this.cancel();
-              this.$emit('done');
+              this.$emit('done','isDefaultExpandedKeys');
             })
             .catch((e) => {
               this.loading = false;

+ 22 - 10
src/views/doc/components/file-table-list.vue

@@ -97,7 +97,9 @@
               isArr: true
             })
           "
-          :disabled="selection.length > 1 || selection[0]?.checkOutStatus == 0"
+          :disabled="
+            selection.filter((item) => item.checkOutStatus != 1).length
+          "
           v-if="lcyStatus == 1"
         >
           检入
@@ -111,7 +113,9 @@
               isArr: true
             })
           "
-          :disabled="selection.length > 1 || selection[0]?.checkOutStatus == 1"
+          :disabled="
+            selection.filter((item) => item.checkOutStatus == 1).length
+          "
           v-if="lcyStatus == 1"
         >
           检出
@@ -848,10 +852,14 @@
         if (this.powerFn(powerData)) {
           return;
         }
-        checkOut({
-          id: this.selection[0].id,
-          checkOutStatus: 1
-        }).then((msg) => {
+        checkOut(
+          this.selection.map((item) => {
+            return {
+              id: item.id,
+              checkOutStatus: 1
+            };
+          })
+        ).then((msg) => {
           this.reload();
         });
       },
@@ -864,10 +872,14 @@
         if (this.powerFn(powerData)) {
           return;
         }
-        checkEnter({
-          id: this.selection[0].id,
-          checkOutStatus: 0
-        }).then((msg) => {
+        checkEnter(
+          this.selection.map((item) => {
+            return {
+              id: item.id,
+              checkOutStatus: 0
+            };
+          })
+        ).then((msg) => {
           this.reload();
         });
       },

+ 1 - 1
src/views/doc/components/folder-edit.vue

@@ -159,7 +159,7 @@ export default {
           this.loading = false;
           // this.$message.success('新建成功');
           this.cancel();
-          this.$emit('done', data);
+          this.$emit('done', data.id?data:'isDefaultExpandedKeys');
         })
         .catch((e) => {
           this.loading = false;

+ 13 - 7
src/views/doc/components/main.vue

@@ -234,20 +234,26 @@
           await validationPersonal();
           await this.query();
         }
-        if (this.data.length) {
-          this.defaultExpandedKeys = [this.data[0].id];
-        }
+        // if (this.data.length) {
+        //   this.defaultExpandedKeys = [this.data[0].id];
+        // }
         this.$nextTick(() => {
+          alert(row)
           if (this.$route.params.row) {
             this.$refs.tree.setCurrentKey(this.$route.params.row.id);
-             this.defaultExpandedKeys = [this.$route.params.row.id];
+            this.defaultExpandedKeys = [this.$route.params.row.id];
             this.onNodeClick(this.$route.params.row);
           } else if (row && row.id) {
             this.$refs.tree.setCurrentKey(row.id);
+            this.defaultExpandedKeys = [row.id];
             this.onNodeClick(row);
+          } else if (row == 'isDefaultExpandedKeys'&&this.current?.id) {
+            this.$refs.tree.setCurrentKey(this.current.id);
+            this.defaultExpandedKeys = [this.current.id];
+            this.onNodeClick(this.current);
           } else {
             this.$refs.tree.setCurrentKey(this.data[0].id);
-
+            this.defaultExpandedKeys = [this.data[0].id];
             this.onNodeClick(this.data[0]);
           }
         });
@@ -362,7 +368,7 @@
           authority: 1
         }).then((msg) => {
           this.powerVisible = false;
-          this.query();
+          this.query(this.current);
         });
       },
       goTo(name, row) {
@@ -468,7 +474,7 @@
     .element-tree-node-line-ver {
     border: none;
   }
-  .el-tree-node > .el-tree-node__children{
+  .el-tree-node > .el-tree-node__children {
     overflow: inherit;
   }
 </style>