Browse Source

作者管理配置化

cxmo 1 year ago
parent
commit
e5fc5de251

+ 18 - 0
src/utils/buttonConfig.js

@@ -88,6 +88,24 @@ export const enClassifyBtn = {
     classifyList_enClassify_rpEdit:'classifyList:enClassify:rpEdit',//英文研报一二级编辑
     classifyList_enClassify_rpAddClassify:'classifyList:enClassify:rpAddClassify',//英文研报添加分类
 }
+/*
+*--------作者管理----------- 
+*/
+export const authorManage = {
+/*------------------英文研报作者管理------------ */
+    authorManage_enReport:'authorManage:enReport',//英文研报选项卡是否展示
+    authorManage_enReport_enable:'authorManage:enReport:enable',//英文研报作者启用/禁用
+    authorManage_enReport_del:'authorManage:enReport:del',//英文研报作者删除
+    authorManage_enReport_edit:'authorManage:enReport:edit',//英文研报作者编辑
+/*------------------中文研报作者管理------------ */
+    authorManage_cnReport:'authorManage:cnReport',//中文研报选项卡是否展示
+    authorManage_cnReport_enable:'authorManage:cnReport:enable',//中文研报作者启用/禁用
+    authorManage_cnReport_del:'authorManage:cnReport:del',//中文研报作者删除
+    authorManage_cnReport_edit:'authorManage:cnReport:edit',//中文研报作者编辑
+
+    authorManage_add:'authorManage:add',//添加作者按钮
+}
+
 /*
  * -----------------------------------------------------------------------------智能PPT------------------------------------------------
  */

+ 82 - 9
src/views/report_manage/reportAuthor.vue

@@ -1,7 +1,8 @@
 <template>
   <div class="sandList-container">
-    <div class="main-top">
-      <el-button type="primary" @click="addAuthorHandle">添加作者</el-button>
+    <div class="main-top" v-if="authTabsOpt">
+      <el-button v-if="isAddBtnShow"
+        type="primary" @click="addAuthorHandle">添加作者</el-button>
       <div>
         <el-input
           v-model="search_txt"
@@ -12,9 +13,9 @@
         </el-input>
       </div>
     </div>
-    <div class="main-bottom">
+    <div class="main-bottom" v-if="authTabsOpt.length">
       <ul class="tab-ul">
-        <li :class="['tab-li',default_tab===tab.key && 'act']" v-for="tab in panelTabs" :key="tab.key" @click="default_tab=tab.key">{{tab.name}}</li>
+        <li :class="['tab-li',default_tab===tab.key && 'act']" v-for="tab in authTabsOpt" :key="tab.key" @click="default_tab=tab.key">{{tab.label}}研报</li>
       </ul>
       <el-table
         :data="tableData"
@@ -45,9 +46,12 @@
         </el-table-column>
         <el-table-column width="260" align="center" label="操作">
           <template slot-scope="{row}">
-            <span class="editsty" @click="itemHandle(row, 'edit')" style="margin-right: 10px">编辑</span>
-            <span class="deletesty" @click="itemHandle(row, 'del')" style="margin-right: 10px">删除</span>
-            <span class="editsty" @click="itemHandle(row, 'set')">{{row.Enable?'禁用':'启用'}}</span>
+            <span class="editsty" v-if="isEditBtnShow"
+                @click="itemHandle(row, 'edit')" style="margin-right: 10px">编辑</span>
+            <span class="deletesty" v-if="isDeleteBtnShow"
+                @click="itemHandle(row, 'del')" style="margin-right: 10px">删除</span>
+            <span class="editsty" v-if="isEnableBtnShow"
+                @click="itemHandle(row, 'set')">{{row.Enable?'禁用':'启用'}}</span>
           </template>
         </el-table-column>
 
@@ -93,7 +97,7 @@
               placeholder="请选择研报类型"
               style="width:400px;"
             >
-              <el-option v-for="item in reportTypes" :key="item.key" :label="item.label" :value="item.key"/>
+              <el-option v-for="item in authTabsOpt" :key="item.key" :label="item.label" :value="item.key"/>
             </el-select>
           </el-form-item>
         </el-form>
@@ -166,6 +170,71 @@ export default {
       this.getTableData();
     }
   },
+  computed:{
+    //过滤后的tab栏
+    authTabsOpt(){
+        const cnReport = this.permissionBtn.checkPermissionBtn(
+            this.permissionBtn.authorManage.authorManage_cnReport
+        )
+        const enReport = this.permissionBtn.checkPermissionBtn(
+            this.permissionBtn.authorManage.authorManage_enReport
+        )
+        //没时间写更好的写法了,有空再优化
+        let authTabs = []
+        if(cnReport){
+            authTabs.push(this.reportTypes[0])
+        }
+        if(enReport){
+            authTabs.push(this.reportTypes[1])
+        }
+        return authTabs
+    },
+    //是否显示添加作者按钮
+    isAddBtnShow(){
+        if(this.authTabsOpt.length){
+            return this.permissionBtn.checkPermissionBtn(
+                  this.permissionBtn.authorManage.authorManage_add
+                )
+        }
+        return false
+    },
+    //是否展示编辑按钮
+    isEditBtnShow(){
+        if(this.default_tab===1){
+            return this.permissionBtn.checkPermissionBtn(
+                  this.permissionBtn.authorManage.authorManage_cnReport_edit
+                )
+        }else{
+            return this.permissionBtn.checkPermissionBtn(
+                  this.permissionBtn.authorManage.authorManage_enReport_edit
+                )
+        }
+    },
+    //是否展示删除按钮
+    isDeleteBtnShow(){
+        if(this.default_tab===1){
+            return this.permissionBtn.checkPermissionBtn(
+                  this.permissionBtn.authorManage.authorManage_cnReport_del
+                )
+        }else{
+            return this.permissionBtn.checkPermissionBtn(
+                  this.permissionBtn.authorManage.authorManage_enReport_del
+                )
+        }
+    },
+    //是否展示禁用启用按钮
+    isEnableBtnShow(){
+        if(this.default_tab===1){
+            return this.permissionBtn.checkPermissionBtn(
+                  this.permissionBtn.authorManage.authorManage_cnReport_enable
+                )
+        }else{
+            return this.permissionBtn.checkPermissionBtn(
+                  this.permissionBtn.authorManage.authorManage_enReport_enable
+                )
+        }
+    }
+  },
   methods: {
     /* 获取表格数据 */
     getTableData() {
@@ -272,7 +341,11 @@ export default {
     
   },
   mounted() {
-    this.getTableData();
+    if(this.authTabsOpt.length){
+        this.default_tab = this.authTabsOpt[0].key
+        this.getTableData();
+    }
+    
   },
 };
 </script>

+ 1 - 1
src/views/system_manage/mock.js

@@ -1360,4 +1360,4 @@ export const mockList = [
         }
       ]
     }
-  ]
+  ]

+ 5 - 1
src/vuex/modules/permissionButton.js

@@ -26,7 +26,11 @@ const permissionButtons = {
                     {button_code:'enReport:reportView:wechatShare'},
                     //{button_code:'classifyList:enClassify'},
                     {button_code:'classifyList:cnClassify'},
-                    {button_code:'classifyList:cnClassify:classifyAdd'}
+                    {button_code:'classifyList:cnClassify:classifyAdd'},
+                    {button_code:'authorManage:add'},
+                    {button_code:'authorManage:cnReport'},
+                    {button_code:'authorManage:enReport'},
+                    {button_code:'authorManage:cnReport:edit'},
                 ]
                 commit('SET_PERMISSION_BUTTONS',buttons)
                 resolve('获取权限按钮成功')