Browse Source

系统配置权限配置化,完成

cxmo 1 year ago
parent
commit
46b2f08cc6

+ 53 - 1
src/utils/buttonConfig.js

@@ -400,4 +400,56 @@ export const productPricePermission = {
 }
 /*
  * --------------------------------------------------------------------------系统设置------------------------------------------------
-*/
+*/
+export const sysDepartPermission = {
+    /*-----------部门管理-------- */
+    sysDepart_saveUser:'sysDepart:saveUser',//添加/编辑用户按钮
+    sysDepart_resetPass:'sysDepart:resetPass',//重置密码
+    sysDepart_moveGroup:'sysDepart:moveGroup',//移动分组
+    sysDepart_enable:'sysDepart:enable',//启用禁用
+    sysDepart_del:'sysDepart:del',//用户删除
+    sysDepart_saveUser_researchGroup:'sysDepart:saveUser:researchGroup',//添加/编辑用户表单中,研究方向的按钮
+    /*-----------角色管理-------- */
+    sysRole_del:'sysRole:del',//删除角色
+    sysRole_settingAuth:'sysRole:settingAuth',//设置/查看权限
+    sysRole_addRole:'sysRole:addRole',//添加角色
+    /*-----------英文权限配置-------- */
+    enAuthManage_del:'enAuthManage:del',
+    enAuthManage_settingAuth:'enAuthManage:settingAuth'
+}
+/*-----------数据操作权限-------- */
+export const operateAuthPermission = {
+    /*---------图库-------- */
+    operateAuth_chartLib:'operateAuth:chartLib',//图库tab
+    operateAuth_chartLib_edit:'operateAuth:chartLib:edit',//图库的编辑,批量编辑按钮
+    /*---------ETA预测指标库-------- */
+    operateAuth_etaPredictLib:'operateAuth:etaPredictLib',
+    operateAuth_etaPredictLib_authSetting:'operateAuth:etaPredictLib:authSetting',//权限设置/批量权限设置
+    operateAuth_etaPredictLib_edit:'operateAuth:etaPredictLib:edit',
+    /*---------ETA指标库-------- */
+    operateAuth_etaLib:'operateAuth:etaLib',
+    operateAuth_etaLib_authSetting:'operateAuth:etaLib:authSetting',
+    operateAuth_etaLib_edit:'operateAuth:etaLib:edit',
+    /*---------钢联化工数据库-------- */
+    operateAuth_mysteel:'operateAuth:mysteel',
+    operateAuth_mysteel_edit:'operateAuth:mysteel:edit',
+    /*---------手工数据指标-------- */
+    operateAuth_manual:'operateAuth:manual',
+    operateAuth_manual_edit:'operateAuth:manual:edit',
+}
+/*-----------基本配置-------- */
+export const baseConfigPermission = {
+    /*-------其他设置------- */
+    sysJump_updateLog:'sysJump:updateLog',//更新日志
+    sysJump_helpDoc:'sysJump:helpDoc',//帮助文档,如果两个都没权限,就隐藏按钮
+    sysJump_crm:'sysJump:crm',//跳转CRM的按钮
+    sysJump_hr:'sysJump:hr',//跳转HR系统的按钮
+    sysJump_finance:'sysJump:finance',//跳转财务系统的按钮
+    /*-------基本配置表格---*/
+    etaBaseConfig_xunfei:'etaBaseConfig:xunfei',
+    etaBaseConfig_pptEn:'etaBaseConfig:pptEn',
+    etaBaseConfig_ppt:'etaBaseConfig:ppt',
+    etaBaseConfig_watermark:'etaBaseConfig:watermark',
+    etaBaseConfig_watermark_ybChart:'etaBaseConfig:watermark:ybChart',//如果没权限,表单不显示也不校验
+
+}

+ 1 - 1
src/views/system_manage/components/addUserDialog.vue

@@ -38,7 +38,7 @@
                     </el-option>
                 </el-select>
             </el-form-item>
-            <el-form-item label="研究方向" prop="direct">
+            <el-form-item label="研究方向" prop="direct" v-permission="permissionBtn.sysDepartPermission.sysDepart_saveUser_researchGroup">
                 <el-cascader collapse-tags :show-all-levels="false" :options="researchGroup" v-model="userForm.direct"
                     :props="form_directProp" placeholder="请选择研究方向" clearable></el-cascader>
             </el-form-item>

+ 14 - 8
src/views/system_manage/departManage.vue

@@ -42,7 +42,7 @@
 					</span>
 				</span>
 			</el-tree>
-			<div class="noDepart" @click="addDepart" v-permission="'system:menu:edit'">
+			<div class="noDepart" @click="addDepart">
 				<img src="~@/assets/img/set_m/add_ico.png" alt="" style="width:16px;height:16px;marginRight:10px;">
 				<span>新建部门</span>
 			</div>
@@ -50,7 +50,8 @@
 		<div class="right_cont">
 			<div class="right_cont_top">
 				<div>
-					<el-button type="primary" @click="addUser">添加用户</el-button>
+					<el-button v-permission="permissionBtn.sysDepartPermission.sysDepart_saveUser"
+						type="primary" @click="addUser">添加用户</el-button>
 					<!-- <el-button type="primary" @click="synchronizationMEIKE" style="margin-left: 26px;">同步每刻</el-button> -->
 				</div>
 				<el-input
@@ -106,14 +107,18 @@
 					<el-table-column label="操作" align="center" width="300">
 						<template slot-scope="scope">
 							<div style="color:#4099ef; font-size:24px;display: flex;gap:0 10px;">
-								<span class="editsty" @click.stop="editUser(scope.row)">编辑</span>
-								<span class="editsty" @click.stop="resetPassWord(scope.row)">重置密码</span>
-								<span class="editsty" @click.stop="moveDepart(scope.row)">移动分组</span>
-								<span 
+								<span v-permission="permissionBtn.sysDepartPermission.sysDepart_saveUser"
+									class="editsty" @click.stop="editUser(scope.row)">编辑</span>
+								<span v-permission="permissionBtn.sysDepartPermission.sysDepart_resetPass"
+									class="editsty" @click.stop="resetPassWord(scope.row)">重置密码</span>
+								<span v-permission="permissionBtn.sysDepartPermission.sysDepart_moveGroup"
+									class="editsty" @click.stop="moveDepart(scope.row)">移动分组</span>
+								<span v-permission="permissionBtn.sysDepartPermission.sysDepart_enable"
 									class="editsty" 
 									@click.stop="handleChangeStatus(scope.row)"
 								>{{scope.row.Enabled===0?'启用':'禁用'}}</span>
-								<span class="deletesty" @click.stop="delUser(scope.row)">删除</span>
+								<span v-permission="permissionBtn.sysDepartPermission.sysDepart_del"
+									class="deletesty" @click.stop="delUser(scope.row)">删除</span>
 							</div>
 						</template>
 					</el-table-column>
@@ -161,7 +166,8 @@
 								<h4 class="item_tit">角色:</h4>
 								<span>{{userObj.role}}</span>
 							</li>
-							<li class="info_item" v-if="userObj.depart.includes('FICC研究部')">
+							<li v-permission="permissionBtn.sysDepartPermission.sysDepart_saveUser_researchGroup"
+								class="info_item" v-if="userObj.depart.includes('FICC研究部')">
 								<h4 class="item_tit">研究方向:</h4>
 								<span>{{userObj.direct.map(i=>i.join('/')).join('、')||'暂无'}}</span>
 							</li>

+ 3 - 2
src/views/system_manage/enAuthManage.vue

@@ -83,10 +83,11 @@
             </el-tooltip>
           </template>
           <template slot-scope="{ row }">
-            <span @click="setAuth(row)"
+            <span v-permission="permissionBtn.sysDepartPermission.enAuthManage_settingAuth"
+              @click="setAuth(row)"
               style="cursor: pointer; color:#409eff;margin-right: 5px;"
             >设置权限</span>
-            <span
+            <span v-permission="permissionBtn.sysDepartPermission.enAuthManage_del"
               @click="handleDeleteAuth(row)"
               style="cursor: pointer; color: #d1433a"
               >删除</span

+ 35 - 5
src/views/system_manage/etaBaseConfig.vue

@@ -16,7 +16,8 @@
                             @remove="deleteFormImg('CompanyWatermark')"
                             />
                         <!-- 后面可能会有新的选项 -->
-                        <el-checkbox-group v-model="checkList" style="position: absolute;top: -40px;left: 100px;">
+                        <el-checkbox-group v-if="isShowYBChart"
+                            v-model="checkList" style="position: absolute;top: -40px;left: 100px;">
                             <el-checkbox label="研报图表"></el-checkbox>
                         </el-checkbox-group>
                         <ConfigAnnotation picName="CompanyWatermark" @showImage="previewImage"/>
@@ -35,12 +36,12 @@
                     </el-form-item>
                 </div>
             </div>
-            <div class="part-ppt part">
+            <div class="part-ppt part" v-if="isShowPPT||isShowEnPPT">
                 <el-radio-group v-model="pptLang" style="margin-bottom: 22px;">
                     <el-radio-button label="cn">中文PPT</el-radio-button>
                     <el-radio-button label="en">英文PPT</el-radio-button>
                 </el-radio-group>
-                <div v-show="pptLang === 'cn'" class="ppt-form-item-wrap">
+                <div v-if="isShowPPT" v-show="pptLang === 'cn'" class="ppt-form-item-wrap">
                     <el-form-item label="PPT封面图" prop="CnPptCoverImgs">
                         <div class="input-line" style="display:flex;">
                             <ImgUpload 
@@ -78,7 +79,7 @@
                             picHintText="上传格式:png、jpg,建议图片比例:10:7 16:9 4:3"/>
                     </el-form-item>
                 </div>
-                <div v-show="pptLang === 'en'" class="ppt-form-item-wrap">
+                <div v-if="isShowEnPPT" v-show="pptLang === 'en'" class="ppt-form-item-wrap">
                     <el-form-item label="PPT封面图" prop="EnPptCoverImgs">
                         <div class="input-line" style="display:flex;">
                             <ImgUpload 
@@ -117,7 +118,8 @@
                     </el-form-item>
                 </div>
             </div>
-            <div class="part-Iflytek part">
+            <div class="part-Iflytek part" 
+                v-if="isShowXunFei">
                 <!-- 科大讯飞 -->
                 <div style="width:100%;">
                     <span style="color:#606266;">科大讯飞服务</span> 
@@ -263,6 +265,32 @@ export default {
 
         };
     },
+    computed:{
+        //是否显示科大讯飞相关的表单项
+        isShowXunFei(){
+            return this.permissionBtn.checkPermissionBtn(
+                    this.permissionBtn.baseConfigPermission.etaBaseConfig_xunfei
+                )
+        },
+        //是否显示中文PPT相关的表单项
+        isShowPPT(){
+            return this.permissionBtn.checkPermissionBtn(
+                this.permissionBtn.baseConfigPermission.etaBaseConfig_ppt
+            )
+        },
+        //是否显示英文PPT相关的表单项
+        isShowEnPPT(){
+            return this.permissionBtn.checkPermissionBtn(
+                this.permissionBtn.baseConfigPermission.etaBaseConfig_pptEn
+            )
+        },
+        //是否显示公司水印旁的研报图表,目前只有一个选项,当选项多的时候,不要再单个单个判断
+        isShowYBChart(){
+            return this.permissionBtn.checkPermissionBtn(
+                this.permissionBtn.baseConfigPermission.etaBaseConfig_watermark_ybChart
+            )
+        }
+    },
     methods: {
         handleUploadImage(file,key){
             /* console.log('type',key)
@@ -365,6 +393,8 @@ export default {
                     this.formData.UseXf = ''+(this.Iflytek?true:false)
                     const CnPptCoverImgs = this.formData.CnPptCoverImgs.join(',')
                     const EnPptCoverImgs = this.formData.EnPptCoverImgs.join(',')
+                    //通过验证后,提交数据前
+                    //根据isShowXunFei,isShowPPTisShowEnPPT这三个计算属性将对应的表单项隐藏
                     etaBaseConfigInterence.saveBaseConfig({...this.formData,...{CnPptCoverImgs,EnPptCoverImgs}}).then(res=>{
                         if(res.Ret!==200) return 
                         this.$message.success('保存成功,请稍后到对应页面/项目查看')

+ 49 - 8
src/views/system_manage/operateAuthManage.vue

@@ -2,10 +2,10 @@
   <div class="container">
     <div class="top">
       <ul class="tab-ul">
-        <li :class="['tab-li',{act: default_tab===item.key}]" v-for="item in tabs" :key="item.key" @click="changeTab(item)">{{item.label}}</li>
+        <li :class="['tab-li',{act: default_tab===item.key}]" v-for="item in authTabs" :key="item.key" @click="changeTab(item)">{{item.label}}</li>
       </ul>
 
-      <div class="right-side">
+      <div class="right-side" v-if="authTabs.length">
         <el-input 
           v-model="searchForm.key_word" 
           :placeholder="default_tab === 5 ? '请输入图表名称' : '请输入指标Id/指标名称'" 
@@ -19,7 +19,7 @@
     </div>
 
     <div class="top">
-        <div>
+        <div v-if="authTabs.length">
           <el-cascader
             v-model="searchForm.classification"
             :options="classificationList"
@@ -58,9 +58,10 @@
           />
         </div>
         <div>
-          <el-button type="primary" @click="editAuthHandle({},'multiple')">批量编辑</el-button>
+          <el-button type="primary" @click="editAuthHandle({},'multiple')" 
+          v-if="[3,4].includes(default_tab)?authBtn('edit'):authTabs.length">批量编辑</el-button>
           <el-button type="primary" @click="edbAuthSetHandle({},'multiple')" v-if="[3,4].includes(default_tab
-        )">权限设置</el-button>
+        )&&authBtn('auth')">权限设置</el-button>
         </div>
     </div>
      <el-table
@@ -193,7 +194,26 @@ export default {
         { label: '创建人',key: 'CreateUserName' },
         { label: '操作',key: 'handle' },
       ]
-    }
+    },
+    //权限配置化后的tabs
+    authTabs(){
+        const {operateAuthPermission,checkPermissionBtn} = this.permissionBtn
+        const operaMap = {
+            1:checkPermissionBtn(operateAuthPermission.operateAuth_manual),
+            2:checkPermissionBtn(operateAuthPermission.operateAuth_mysteel),
+            3:checkPermissionBtn(operateAuthPermission.operateAuth_etaLib),
+            4:checkPermissionBtn(operateAuthPermission.operateAuth_etaPredictLib),
+            5:checkPermissionBtn(operateAuthPermission.operateAuth_chartLib),
+        }
+        let temp = []
+        for(const k in operaMap){
+            console.log('k',k,operaMap[k])
+            if(operaMap[k]){
+                temp.push(this.tabs[k-1])
+            }
+        }
+        return temp
+    },
   },
   data() {
     return {
@@ -349,13 +369,34 @@ export default {
     cancelDialogHandle() {
       this.$refs.formRef.resetFields();
       this.isOpenDialog = false
+    },
+    authBtn(type){
+        const {operateAuthPermission,checkPermissionBtn} = this.permissionBtn
+        const authMap = {
+            3:operateAuthPermission.operateAuth_etaLib_authSetting,
+            4:operateAuthPermission.operateAuth_etaPredictLib_authSetting,
+        }
+        const editMap = {
+            3:operateAuthPermission.operateAuth_etaLib_edit,
+            4:operateAuthPermission.operateAuth_etaPredictLib_edit,
+        }
+        if(type==='auth'){
+            return checkPermissionBtn(authMap[this.default_tab])
+        }else{
+            return checkPermissionBtn(editMap[this.default_tab])
+        }
     }
   },
   mounted() {
-    this.getUserList();
+    if(this.authTabs.length){
+        this.getUserList();
+    }
   },
   created(){
-    this.getClassificationList()
+    if(this.authTabs.length){
+        this.default_tab = this.authTabs[0].key
+        this.getClassificationList()
+    }
   }
 }
 </script>

+ 8 - 4
src/views/system_manage/roleManage.vue

@@ -2,8 +2,10 @@
 	<div class="roleManage_container">
 		<div class="role_cont_top">
 			<div>
-				<el-button type="primary" @click="addRole" style="marginRight:14px;">添加角色</el-button>
-				<el-button type="primary" @click="setAuth">设置权限</el-button>
+				<el-button v-permission="permissionBtn.sysDepartPermission.sysRole_addRole"
+					type="primary" @click="addRole" style="marginRight:14px;">添加角色</el-button>
+				<el-button v-permission="permissionBtn.sysDepartPermission.sysRole_settingAuth"
+					type="primary" @click="setAuth">设置权限</el-button>
 			</div>
 			<el-input
 				placeholder="角色搜索"
@@ -42,9 +44,11 @@
 				<el-table-column label="操作" align="center">
 					<template slot-scope="scope">
 						<div style="color:#4099ef; font-size:24px;">
-							<span class="editsty" @click.stop="getAuthDetail(scope.row)" style="marginRight:20px;">查看权限</span>
+							<span v-permission="permissionBtn.sysDepartPermission.sysRole_settingAuth"
+								class="editsty" @click.stop="getAuthDetail(scope.row)" style="marginRight:20px;">查看权限</span>
 							<!-- <span class="editsty" @click.stop="editRole(scope.row)" style="marginRight:20px;">编辑</span> -->
-							<span class="deletesty" @click.stop="delRole(scope.row)">删除</span>
+							<span v-permission="permissionBtn.sysDepartPermission.sysRole_del"
+								class="deletesty" @click.stop="delRole(scope.row)">删除</span>
 						</div>
 					</template>
 				</el-table-column>

+ 4 - 0
src/vuex/modules/permissionButton.js

@@ -44,6 +44,10 @@ const permissionButtons = {
                     {button_code:'stockPlant:anlysisView'},
                     //goodsPrice:incomeLine:refresh
                     {button_code:'goodsPrice:incomeLine:refresh'},
+                    //operaAuth test
+                    {button_code:'operateAuth:etaLib'},
+                    {button_code:'operateAuth:etaLib:authSetting'},
+                    {button_code:'operateAuth:mysteel'},
                 ]
                 commit('SET_PERMISSION_BUTTONS',buttons)
                 resolve('获取权限按钮成功')