yusheng 10 месяцев назад
Родитель
Сommit
63a163f526
3 измененных файлов с 91 добавлено и 19 удалено
  1. 12 0
      src/api/doc-manage/index.js
  2. 76 19
      src/views/doc/components/file-table-list.vue
  3. 3 0
      src/views/doc/util.js

+ 12 - 0
src/api/doc-manage/index.js

@@ -309,6 +309,18 @@ export async function fileUpdateAPI(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+/**
+ * 批量修改
+ * @data data
+ */
+export async function fileUpdateAllAPI(data) {
+  const res = await request.post('/fm/file/updateList', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 /**
  * 详情
  * @id id

+ 76 - 19
src/views/doc/components/file-table-list.vue

@@ -7,7 +7,7 @@
       :datasource="datasource"
       height="calc(45vh)"
       tool-class="ele-toolbar-form"
-       :initLoad="false"
+      :initLoad="false"
       row-key="id"
       :current.sync="current"
       :selection.sync="selection"
@@ -20,7 +20,7 @@
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
         <!-- <div style="display: contents;"> -->
-          <el-dropdown trigger="click" v-if="lcyStatus == 1">
+        <el-dropdown trigger="click" v-if="lcyStatus == 1">
           <el-button type="primary">
             新建<i class="el-icon-arrow-down el-icon--right"></i>
           </el-button>
@@ -88,7 +88,6 @@
           批量上传
         </el-button>
 
-    
         <el-button
           type="primary"
           @click.native="
@@ -191,8 +190,13 @@
         >
           废止
         </el-button>
-
-        <!-- <el-button type="primary"> 上传 </el-button> -->
+        <el-button
+          v-if="fileType === 0 && lcyStatus != 4"
+          type="primary"
+          @click="powerOpen"
+        >
+          批量设置权限
+        </el-button>
         <el-button
           type="primary"
           @click.native="
@@ -213,9 +217,8 @@
         >
           移动
         </el-button>
-        <fileSearch @search="reload" style="margin-left: 20px;"></fileSearch>
+        <fileSearch @search="reload" style="margin-left: 20px"></fileSearch>
         <!-- </div> -->
-       
       </template>
 
       <!-- 操作列 -->
@@ -346,6 +349,16 @@
       ref="processSubmitDialogRef"
       @reload="reload"
     ></process-submit-dialog>
+    <ele-modal
+      width="70vw"
+      :visible.sync="powerOpenShow"
+      :close-on-click-modal="false"
+      custom-class="ele-dialog-form"
+      :maxable="true"
+      append-to-body
+    >
+      <Power style="" @powerSave="powerSave" ref="PowerRefAll" />
+    </ele-modal>
   </div>
 </template>
 
@@ -378,7 +391,8 @@
     checkOut,
     fileUpdateAPI,
     updateLcyStatus,
-    noUpdateLcyStatus
+    noUpdateLcyStatus,
+    fileUpdateAllAPI
   } from '@/api/doc-manage';
   export default {
     components: {
@@ -429,6 +443,7 @@
         isPower,
         isCheckOut,
         isCreateUserId,
+        powerOpenShow: false,
         selection: [],
         processSubmitDialogFlag: false,
         current: {},
@@ -599,8 +614,7 @@
             directoryId: this.parentData?.id,
             lcyStatus: this.lcyStatus,
             fileType: this.fileType,
-            isQueryAll:this.$hasPermission('fm:doc:viewAll')?1:''
-            
+            isQueryAll: this.$hasPermission('fm:doc:viewAll') ? 1 : ''
           });
         }
       },
@@ -736,15 +750,58 @@
           return true;
         }
       },
+      powerOpen() {
+        if (!this.selection?.length) {
+          this.$message.warning('请选择一条数据!');
+          return;
+        }
+
+        let createUserS=[],checkOutS=[]
+        this.selection.forEach(item=>{
+          if(!isCreateUserId(item)){
+            createUserS.push(item.name)
+          }
+          if(isCreateUserId(item)){
+            checkOutS.push(item.name)
+          }
+        })
+        if(createUserS.toString()){
+          this.$message.warning(createUserS+'您不是创建人,无权限修改!');
+          return;
+        }
+        if(!checkOutS.toString()){
+          this.$message.warning(checkOutS+'已被检出 无法修改!');
+          return;
+        }
+        this.powerOpenShow = true;
+        this.$nextTick(()=>{
+          this.$refs.PowerRefAll.setTableList([])
+        })
+                
+      },
       //权限保存
       powerSave(tableList) {
-        fileUpdateAPI({
-          id: this.current.id,
-          userAuthority: tableList,
-          authority: 1
-        }).then((msg) => {
-          this.reload();
-        });
+        if (this.powerOpenShow) {
+          let data = this.selection.map((item) => {
+            return {
+              id: item.id,
+              userAuthority: tableList,
+              authority: 1
+            };
+          });
+          fileUpdateAllAPI(data).then((msg) => {
+            this.reload();
+          });
+          this.powerOpenShow = false;
+        } else {
+          fileUpdateAPI({
+            id: this.current.id,
+            userAuthority: tableList,
+            authority: 1
+          }).then((msg) => {
+            this.reload();
+          });
+        }
       },
       //检出
       checkOut(powerData) {
@@ -916,7 +973,7 @@
   .el-tabs__content {
     height: calc(100% - 39px);
   }
-  :deep(.ele-table-tool-title-content){
-         display: contents;
+  :deep(.ele-table-tool-title-content) {
+    display: contents;
   }
 </style>

+ 3 - 0
src/views/doc/util.js

@@ -4,6 +4,9 @@ const userId = store.state.user.info.userId;
 const userName = store.state.user.info.name;
 
 export function isCreateUserId(row) {
+  if (vue.prototype.$hasPermission('fm:doc:viewAll')) {
+    return true;
+  }
   return userId == row?.createUserId;
 }
 export function isPower(data = {}, power, selection = []) {