Sfoglia il codice sorgente

task-4059 受控文件下载、删除权限均只对超级用户和文件管理员开放

cfort 1 anno fa
parent
commit
7b844b2c3c
1 ha cambiato i file con 17 aggiunte e 37 eliminazioni
  1. 17 37
      src/views/component/fileTraining/index.vue

+ 17 - 37
src/views/component/fileTraining/index.vue

@@ -47,7 +47,7 @@
                     </el-popover>
                     <el-button type="primary" icon="el-icon-view" @click="lookFile">查看文件信息</el-button>
                     <el-button type="primary" icon="el-icon-s-fold" @click="hideLeft">左侧内容</el-button>
-                    <el-button type="primary" icon="el-icon-download" @click="updateFile">下载文件</el-button>
+                    <el-button v-if="deleteShow" type="primary" icon="el-icon-download" @click="updateFile">下载文件</el-button>
                     <el-button type="danger" icon="el-icon-close" @click="closeDialog">关闭</el-button>
                 </el-col>
             </el-row>
@@ -254,6 +254,7 @@ export default {
         document.addEventListener('visibilitychange', this.handlePageChange)
         this.checkDialogBody()
         // task-3972 删除权限仅开放给超级用户和文件管理员
+        // task-4059 下载、删除权限均只对超级用户和文件管理员开放
         const roleList = ['wjgly']
         const isPower = this.role.some(item => roleList.includes(item.alias))
         this.deleteShow = this.isSuper || isPower
@@ -403,49 +404,28 @@ export default {
         },
         deleteFile () {
             this.deleteVisible = false
-            // const roleKey = ['xtgljs', 'syszr', 'wjgly', 'wjglzzc']
-            const roleKey = ['xtgljs']
-            const curRole = this.role.map(i => i.alias)
-            const isPower = curRole.some(item => roleKey.includes(item))
-            if (this.isSuper || isPower) {
-                const deleteParams = {
-                    tableName: 't_wjxxb',
-                    paramWhere: { id_: this.leftData[0].zId }
-                }
-                curdPost('delete', deleteParams).then(() => {
-                    this.$message({
-                        message: '删除成功!',
-                        type: 'warning'
-                    })
-                    this.dialogVisible = false
-                })
-                return
+            const deleteParams = {
+                tableName: 't_wjxxb',
+                paramWhere: { id_: this.leftData[0].zId }
             }
-            this.$message({
-                message: '您还没有权限,请联系管理员',
-                type: 'warning'
+            curdPost('delete', deleteParams).then(() => {
+                this.$message({
+                    message: '删除成功!',
+                    type: 'warning'
+                })
+                this.dialogVisible = false
             })
         },
         // closeDialog1 (val) {
         //     this.innerVisible = val
         // },
         updateFile () {
-            const roleKey = ['xtgljs', 'wjglzzc', 'wjgly']
-            const curRole = this.role.map(i => i.alias)
-            const isPower = curRole.some(i => roleKey.includes(i))
-            if (this.isSuper || isPower) {
-                const a = document.createElement('a')
-                a.href = this.optionFile.url
-                a.download = this.optionFile.data.fileName
-                document.body.appendChild(a)
-                a.click()
-                a.remove()
-                return
-            }
-            this.$message({
-                message: '您还没有权限,请联系管理员',
-                type: 'warning'
-            })
+            const a = document.createElement('a')
+            a.href = this.optionFile.url
+            a.download = this.optionFile.data.fileName
+            document.body.appendChild(a)
+            a.click()
+            a.remove()
         },
         fileShow (val) {
             return new Promise((resolve, reject) => {