Răsfoiți Sursa

搜索条件

yusheng 1 an în urmă
părinte
comite
57af0686bb

+ 1 - 1
src/store/modules/user.js

@@ -67,7 +67,7 @@ export default {
     },
     // 设置登录用户的权限
     setAuthorities(state, authorities) {
-      state.authorities = authorities;
+      state.authorities = authorities.map((item) => item.permissionCode);
     },
     // 设置登录用户的权限路由
     setAuthoritiesRouter(state, authoritiesRouter) {

+ 14 - 8
src/views/doc/components/file-search.vue

@@ -5,10 +5,11 @@
     class="ele-form-search"
     @keyup.enter.native="search"
     @submit.native.prevent
+    style="width: 600px; display: inline-block"
   >
     <el-row :gutter="24">
-      <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
-      <el-form-item label="文档名称" label-width="80px">
+      <el-col :span="10">
+        <el-form-item label="文档名称" label-width="80px">
           <el-input
             clearable
             size="small"
@@ -16,21 +17,26 @@
             placeholder="请输入文档名称"
           />
         </el-form-item>
-        </el-col>
-
-
-      <el-col v-bind="styleResponsive ?  { md: 6 } : { span: 6 }">
-        <el-form-item>
+      </el-col>
+      <el-col :span="14">
+        <el-form-item label="文档编码" label-width="80px">
+          <el-input
+            clearable
+            size="small"
+            v-model.trim="where.code"
+            placeholder="请输入文档编码"
+            style="width: 65%;"
+          />
           <el-button
             size="small"
             type="primary"
             icon="el-icon-search"
             class="ele-btn-icon"
             @click="search"
+            style="margin-left: 5px;"
           >
             查询
           </el-button>
-          <slot></slot>
         </el-form-item>
       </el-col>
     </el-row>

+ 12 - 11
src/views/doc/components/file-table-list.vue

@@ -19,7 +19,8 @@
     >
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
-        <el-dropdown trigger="click" v-if="lcyStatus == 1">
+        <!-- <div style="display: contents;"> -->
+          <el-dropdown trigger="click" v-if="lcyStatus == 1">
           <el-button type="primary">
             新建<i class="el-icon-arrow-down el-icon--right"></i>
           </el-button>
@@ -87,15 +88,7 @@
           批量上传
         </el-button>
 
-        <!-- <el-button type="primary" v-if="lcyStatus == 1">
-          复制
-        </el-button>
-        <el-button type="primary" v-if="lcyStatus == 1">
-          剪切
-        </el-button> -->
-        <!-- <el-button type="primary" v-if="isPower(current, 'checkEnter',selection)">
-          粘贴
-        </el-button> -->
+    
         <el-button
           type="primary"
           @click.native="
@@ -220,6 +213,9 @@
         >
           移动
         </el-button>
+        <fileSearch @search="reload" style="margin-left: 20px;"></fileSearch>
+        <!-- </div> -->
+       
       </template>
 
       <!-- 操作列 -->
@@ -602,7 +598,9 @@
             size: limit,
             directoryId: this.parentData?.id,
             lcyStatus: this.lcyStatus,
-            fileType: this.fileType
+            fileType: this.fileType,
+            isQueryAll:this.$hasPermission('fm:doc:viewAll')?1:''
+            
           });
         }
       },
@@ -918,4 +916,7 @@
   .el-tabs__content {
     height: calc(100% - 39px);
   }
+  :deep(.ele-table-tool-title-content){
+         display: contents;
+  }
 </style>

+ 138 - 77
src/views/doc/util.js

@@ -1,94 +1,155 @@
 import store from '@/store';
-const userId = store.state.user.info.userId
-const userName = store.state.user.info.name
+import vue from 'vue';
+const userId = store.state.user.info.userId;
+const userName = store.state.user.info.name;
 
 export function isCreateUserId(row) {
-    return userId == row?.createUserId
+  return userId == row?.createUserId;
 }
 export function isPower(data = {}, power, selection = []) {
+  if (!data.id && selection.length == 0) {
+    return false;
+  }
+  if (
+    //文件查看浏览权限
+    vue.prototype.$hasPermission('fm:doc:viewAll') &&
+    ['check', 'browse'].includes(power)
+  ) {
+    return true;
+  }
 
-    if (!data.id && selection.length == 0) {
-        return false
+  if (power == 'add' && data.userAuthority.length == 0) {
+    return true;
+  }
+  if (power == 'checkEnter' && data?.checkOutUserId != userId) {
+    //检入特殊处理
+    return false;
+  }
+  if (selection.length > 0) {
+    //多选情况处理
+    let _isPower = true;
+    let userAuthorityS = [];
+    let createUserIdS = selection
+      .map((item) => item.createUserId)
+      .filter((createUserId) => createUserId == userId);
+    if (createUserIdS.length == selection.length || userName == 'admin') {
+      //创建人/admin所有权限
+      return true;
     }
-    if (power == 'add' && data.userAuthority.length == 0) { //文件夹默认开放新增权限
-        return true
-    }
-    if (power == 'checkEnter' && data?.checkOutUserId != userId) { //检入特殊处理
-        return false
-    }
-    if (selection.length > 0) { //多选情况处理
-        let _isPower = true
-        let userAuthorityS = []
-        let createUserIdS = selection.map(item => item.createUserId).filter(createUserId => createUserId == userId)
-        if (createUserIdS.length == selection.length || userName == 'admin') { //创建人/admin所有权限
-            return true
-        }
-        selection.forEach(val => {
-            const powerObj = val.userAuthority.find(item => item.id == userId)
-            if (powerObj) {
-                userAuthorityS.push(powerObj)
-            }
-        })
 
-        if (userAuthorityS.length == 0) {
-            _isPower = false
-        }
-        userAuthorityS.forEach(item => {
-            if (item[power] != '1') {
-                _isPower = false
-            }
-        })
-        return _isPower
-    }
+    selection.forEach((val) => {
+      const powerObj = val.userAuthority.find((item) => item.id == userId);
+      if (powerObj) {
+        userAuthorityS.push(powerObj);
+      }
+    });
 
-    if (data.createUserId == userId || userName == 'admin') { //创建人/admin所有权限
-        return true
-    }
-    if (!power) {
-        return false
-    }
-    const powerObj = data.userAuthority?.find(item => item.id == userId)
-    if (powerObj) {
-        return powerObj[power] == '1'
+    if (userAuthorityS.length == 0) {
+      _isPower = false;
     }
+    userAuthorityS.forEach((item) => {
+      if (item[power] != '1') {
+        _isPower = false;
+      }
+    });
+    return _isPower;
+  }
+
+  if (data.createUserId == userId || userName == 'admin') {
+    //创建人/admin所有权限
+    return true;
+  }
+  if (!power) {
+    return false;
+  }
+  const powerObj = data.userAuthority?.find((item) => item.id == userId);
+  if (powerObj) {
+    return powerObj[power] == '1';
+  }
 }
-export function isCheckOut(data = {}) { //检出判断
-    if (data?.checkOutStatus == 1&&userId!=data.checkOutUserId) {
-        return true
-    }
+export function isCheckOut(data = {}) {
+  //检出判断
+  if (data?.checkOutStatus == 1 && userId != data.checkOutUserId) {
+    return true;
+  }
 }
-export function setFolderList(data) { //递归过滤文件夹权限
-    data.forEach((item) => {
-        item['disabled'] = !isPower(item, 'add');
-        if (item.sonDirectoryList && item.sonDirectoryList.length > 0) {
-            setFolderList(item.sonDirectoryList);
-        }
-    });
+export function setFolderList(data) {
+  //递归过滤文件夹权限
+  data.forEach((item) => {
+    item['disabled'] = !isPower(item, 'add');
+    if (item.sonDirectoryList && item.sonDirectoryList.length > 0) {
+      setFolderList(item.sonDirectoryList);
+    }
+  });
 }
 
 export function getFileType() {
-    return ['par', 'asm', 'psm', 'dft', 'sldprt',
-        'sldasm', 'ipt', ' iam',
-        'prt', '3dxml', 'CATPart', 'CATProduct', 'cgr',
-        'model', 'exp', 'session', 'x_t', 'xmt_txt',
-        'x_b', 'xmp_bin', 'xmp_txt', 'sat', '.sab', '.igs',
-        'iges', 'stp', 'step', 'jt', 'xcgm', '3dm', 'stl', 'obj', '3mf', 'fbx', 'vda', 'dxf', 'dwg', 'idf', 'idb', 'emn', 'brd'
-    ]
+  return [
+    'par',
+    'asm',
+    'psm',
+    'dft',
+    'sldprt',
+    'sldasm',
+    'ipt',
+    ' iam',
+    'prt',
+    '3dxml',
+    'CATPart',
+    'CATProduct',
+    'cgr',
+    'model',
+    'exp',
+    'session',
+    'x_t',
+    'xmt_txt',
+    'x_b',
+    'xmp_bin',
+    'xmp_txt',
+    'sat',
+    '.sab',
+    '.igs',
+    'iges',
+    'stp',
+    'step',
+    'jt',
+    'xcgm',
+    '3dm',
+    'stl',
+    'obj',
+    '3mf',
+    'fbx',
+    'vda',
+    'dxf',
+    'dwg',
+    'idf',
+    'idb',
+    'emn',
+    'brd'
+  ];
 }
 export function fileStatus(status) {
-    return status==1?'发布中':status==2?'已发布':status==3?'已归档':status==4?'已废止':''
-    // if (fileType == 2) {
-    //     return status == 1 ? '已发布' : '未发布';
-    // }
-    // if (fileType === 0) {
-    //     if (lcyStatus == 2) {
-    //         return '已归档'
-    //     }
-    //     if (lcyStatus == 3) {
-    //         return '已发布'
-    //     }
-    //     if (lcyStatus == 4) {
-    //         return '已废止'
-    //     }
-    // }
-}
+  return status == 1
+    ? '发布中'
+    : status == 2
+    ? '已发布'
+    : status == 3
+    ? '已归档'
+    : status == 4
+    ? '已废止'
+    : '';
+  // if (fileType == 2) {
+  //     return status == 1 ? '已发布' : '未发布';
+  // }
+  // if (fileType === 0) {
+  //     if (lcyStatus == 2) {
+  //         return '已归档'
+  //     }
+  //     if (lcyStatus == 3) {
+  //         return '已发布'
+  //     }
+  //     if (lcyStatus == 4) {
+  //         return '已废止'
+  //     }
+  // }
+}