Переглянути джерело

分类列表-中文分类配置化

cxmo 1 рік тому
батько
коміт
b646dc1133

+ 18 - 4
src/utils/buttonConfig.js

@@ -52,7 +52,24 @@ export const enReportManageBtn = {
 /*
 *--------中文分类----------- 
 */
-export const classifyBtn={}
+export const classifyBtn={
+    classifyList_cnClassify:'classifyList:cnClassify',//中文分类这个选项卡是否显示
+    classifyList_cnClassify_classifyDel:'classifyList:cnClassify:classifyDel',//一二级分类删除
+    classifyList_cnClassify_authSetting:'classifyList:cnClassify:authSetting',//二级分类权限配置
+    classifyList_cnClassify_chapterSetting:'classifyList:cnClassify:chapterSetting',//晨周报章节设置
+    /*---------添加编辑分类------------- */
+    classifyList_cnClassify_classifyAdd:'classifyList:cnClassify:classifyAdd',//一二级添加编辑分类
+    classifyList_cnClassify_relateSetting:'classifyList:cnClassify:relateSetting',//表单项:关联设置
+    classifyList_cnClassify_miniHidden:'classifyList:cnClassify:miniHidden',//表单项:小程序隐藏
+    classifyList_cnClassify_pcBackColor:'classifyList_cnClassify_pcBackColor',//表单项:PC端背景颜色
+    classifyList_cnClassify_shareImgs:'classifyList:cnClassify:shareImgs',//表单项:分享链接配图
+    classifyList_cnClassify_reportImgs:'classifyList:cnClassify:reportImgs',//表单项:报告合集配图
+    classifyList_cnClassify_ficcIcon:'classifyList:cnClassify:ficcIcon',//表单项:FICCicon
+    classifyList_cnClassify_ficcSort:'classifyList:cnClassify:ficcSort',//表单项:FICC页排序
+    classifyList_cnClassify_backSort:'classifyList:cnClassify:backSort',//表单项:后台排序
+    classifyList_cnClassify_showType:'classifyList:cnClassify:showType',//表单项:展示形式
+    classifyList_cnClassify_childMenu:'classifyList:cnClassify:childMenu',//表单项:子目录
+}
 /*
 *--------英文分类----------- 
 */
@@ -70,9 +87,6 @@ export const enClassifyBtn = {
     classifyList_enClassify_rpAuthSetting:'classifyList:enClassify:rpAuthSetting',//英文研报二级分类权限配置
     classifyList_enClassify_rpEdit:'classifyList:enClassify:rpEdit',//英文研报一二级编辑
     classifyList_enClassify_rpAddClassify:'classifyList:enClassify:rpAddClassify',//英文研报添加分类
-
-
-
 }
 /*
  * -----------------------------------------------------------------------------智能PPT------------------------------------------------

+ 2 - 2
src/views/classify_manage/classifyEnlist.vue

@@ -3,8 +3,8 @@
     <el-card>
       <div class="header" slot="header">
         <div class="type-box">
-					<span @click="$emit('typeChange','1')">中文分类</span>
-					<span class="act">英文分类</span>
+					<span @click="$emit('typeChange','1')" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify">中文分类</span>
+					<span class="act" v-permission="permissionBtn.enClassifyBtn.classifyList_enClassify">英文分类</span>
 				</div>
         <div>
         <el-button v-if="isAddClassifyBtnShow"

+ 61 - 21
src/views/classify_manage/classifylist.vue

@@ -3,12 +3,13 @@
 		<el-card class="box-card">
 			<div slot="header" class="header">
 				<div class="type-box">
-					<span class="act">中文分类</span>
-					<span @click="$emit('typeChange','2')">英文分类</span>
+					<span class="act" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify">中文分类</span>
+					<span @click="$emit('typeChange','2')" v-permission="permissionBtn.enClassifyBtn.classifyList_enClassify">英文分类</span>
 				</div>
 				<el-form :inline="true" :model="searchform" @submit.native.prevent>
 					<el-form-item label="">
-						<el-button type="primary" size="small" @click="aeDialogTrue">添加分类</el-button>
+						<el-button v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_classifyAdd"
+                            type="primary" size="small" @click="aeDialogTrue">添加分类</el-button>
 					</el-form-item>
 		  			<el-form-item>
 						<el-input placeholder="分类名称" @change="search" v-model="searchform.key_word" clearable size="small">
@@ -18,7 +19,8 @@
 		  		</el-form>
 			</div>
 			<template>
-				<el-table style="border:1px solid #eaeaea;" :data="tableData" v-loading="listLoading" :row-class-name="tableRowClassName" element-loading-text="数据加载中..." :default-expand-all='isexpand' row-key="Id" :tree-props="{children:'children',hasChildren:'hasChildren'}">
+				<el-table v-if="isTableShow"
+                    style="border:1px solid #eaeaea;" :data="tableData" v-loading="listLoading" :row-class-name="tableRowClassName" element-loading-text="数据加载中..." :default-expand-all='isexpand' row-key="Id" :tree-props="{children:'children',hasChildren:'hasChildren'}">
 					<!-- <el-table-column prop="id" label="序号" width="100px" align="left">
 						<template slot-scope="scope">
 							<span>{{scope.row.ischild?'':scope.row.id}}</span>
@@ -39,20 +41,24 @@
 					<el-table-column label="操作" align="center">
 						<template slot-scope="scope">
 							<div style="color:#4099ef; font-size:24px;">
-								<span class="editsty" v-if="scope.row.ClassifyName=='晨报' || scope.row.ClassifyName=='周报'" @click="chapterSetting(scope.row)">章节设置</span>
-								<span class="editsty" :class="{'editedsty' : editedItems.includes(scope.row.Id)}" v-if="scope.row.ischild" @click="configitem(scope.row)">权限配置</span>
+								<span class="editsty" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_chapterSetting"
+                                    v-if="scope.row.ClassifyName=='晨报' || scope.row.ClassifyName=='周报'" @click="chapterSetting(scope.row)">章节设置</span>
+								<span class="editsty" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_authSetting"
+                                    :class="{'editedsty' : editedItems.includes(scope.row.Id)}" v-if="scope.row.ischild" @click="configitem(scope.row)">权限配置</span>
 								&nbsp;&nbsp;
 								<!-- <i class="el-icon-edit-outline" @click="edititem(scope.row)"></i> -->
-								<span class="editsty" @click="edititem(scope.row)">编辑</span>
+								<span class="editsty" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_classifyAdd"
+                                    @click="edititem(scope.row)">编辑</span>
 								&nbsp;&nbsp;
 								<!-- <i class="el-icon-delete" @click="checkdeleteitem(scope.row)"></i> -->
-								<span class="deletesty" @click="checkdeleteitem(scope.row)">删除</span>
+								<span v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_classifyDel"
+                                    class="deletesty" @click="checkdeleteitem(scope.row)">删除</span>
 							</div>
 		  	    		</template>
 					</el-table-column>
 				</el-table>
 			</template>
-			<el-col :span="24" class="toolbar">
+			<el-col :span="24" class="toolbar" v-if="isTableShow">
 		  		<el-pagination v-if="ispage" layout="total,prev,pager,next,jumper" background @current-change="handleCurrentChange" :page-size="pageSize" @size-change="handleSizeChange" :total="total" style="float:right;"></el-pagination>
 		  	</el-col>
 		</el-card>
@@ -73,7 +79,8 @@
 					</el-select>
 				</el-form-item>
 				<!-- 子目录 -->
-				<el-form-item label="子目录" v-if="aeForm.parent_id==0&&aeForm.showType==1">
+				<el-form-item label="子目录" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_childMenu"
+                    v-if="aeForm.parent_id==0&&aeForm.showType==1">
 					<draggable v-model="ClassifyMenuList" animation="300">
 						<div style="display:inline-block;margin-right:5px" v-for="(item,index) in ClassifyMenuList" :key="item">
 							<el-input
@@ -111,7 +118,8 @@
 					</div>
 					
 				</el-form-item>
-				<el-form-item label="子目录" v-if="aeForm.parent_id!=0">
+				<el-form-item label="子目录" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_childMenu"
+                    v-if="aeForm.parent_id!=0">
 					<el-select v-model="aeForm.ClassifyMenuId"  clearable placeholder="请选择" style="width:400px;">
 						<el-option 
 							:label="item.MenuName" 
@@ -125,28 +133,33 @@
 				<el-form-item prop="label" label="分类标签" v-if="aeForm.parent_id!=0">
 					<el-input type="textarea" autosize v-model="aeForm.label" placeholder="请输入" size="small" style="width:400px;font-size:14px;"></el-input>
 				</el-form-item>
-				<el-form-item label="展示形式" prop="showType" v-if="aeForm.parent_id==0">
+				<el-form-item label="展示形式" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_showType"
+                    prop="showType" v-if="aeForm.parent_id==0">
 					<el-select v-model="aeForm.showType" placeholder="请选择" style="width:400px;">
 						<el-option label="列表" :value="1"></el-option>
 						<el-option label="专栏" :value="2"></el-option>
 						<el-option label="品种" :value="3"></el-option>
 					</el-select>
 				</el-form-item>
-				<el-form-item label="后台排序" prop="Sort" v-if="aeForm.parent_id==0">
+				<el-form-item label="后台排序" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_backSort"
+                    prop="Sort" v-if="aeForm.parent_id==0">
 					<el-input-number v-model="aeForm.Sort" placeholder="请输入数字"></el-input-number>
 					<!-- <el-input type="number" v-model="aeForm.Sort" placeholder="请输入数字" size="small" ></el-input> -->
 				</el-form-item>
-				<el-form-item label="FICC页排序" prop="YbFiccSort" v-if="aeForm.parent_id==0">
+				<el-form-item label="FICC页排序" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_ficcSort"
+                    prop="YbFiccSort" v-if="aeForm.parent_id==0">
 					<el-input-number v-model="aeForm.YbFiccSort" placeholder="请输入数字"></el-input-number>
 					<!-- <el-input type="number" v-model="aeForm.YbFiccSort" placeholder="请输入数字" size="small" style="width:400px;"></el-input> -->
 				</el-form-item>
-				<el-form-item label="FICC页icon" v-if="aeForm.parent_id==0" prop="YbFiccIcon">
+				<el-form-item label="FICC页icon" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_ficcIcon"
+                    v-if="aeForm.parent_id==0" prop="YbFiccIcon">
 					<input type="file" size="small" name="file" @change="fileSelected(6)" id="file6" class="true-file" style="display:none;">
 					<el-input readonly type="text" v-model="aeForm.YbFiccIcon" placeholder="上传FICC页icon" size="medium" style="width:400px;">
 						<el-button slot="append" type="primary" size="mini" @click.native="clickinput(6)">选择图片</el-button>
 					</el-input>
 				</el-form-item>
-        <el-form-item label="报告合集配图" v-if="aeForm.parent_id==0&&aeForm.showType!==2" prop="YbRightBanner">
+        <el-form-item label="报告合集配图" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_reportImgs"
+            v-if="aeForm.parent_id==0&&aeForm.showType!==2" prop="YbRightBanner">
 					<input type="file" size="small" name="file" @change="fileSelected(11)" id="file11" class="true-file" style="display:none;">
 					<el-input readonly type="text" v-model="aeForm.YbRightBanner" placeholder="上传报告合集配图" size="medium" style="width:400px;">
 					  <el-button slot="append" type="primary" size="mini" @click.native="clickinput(11)">选择图片</el-button>
@@ -165,18 +178,21 @@
 					</el-input>
 				</el-form-item> -->
         <!-- 一级分类 展示分享链接配图 -->
-				<el-form-item label="分享链接配图" prop="YbShareBgImg" v-if="aeForm.parent_id==0">
+				<el-form-item label="分享链接配图" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_shareImgs"
+                    prop="YbShareBgImg" v-if="aeForm.parent_id==0">
 					<input type="file" size="small" name="file" @change="fileSelected(10)" id="file10" class="true-file" style="display:none;">
 					<el-input readonly type="text" v-model="aeForm.YbShareBgImg" placeholder="上传分享链接配图" size="medium" style="width:400px;">
 						<el-button slot="append" type="primary" size="mini" @click.native="clickinput(10)">选择图片</el-button>
 					</el-input>
 				</el-form-item>
-				<el-form-item label="PC端背景颜色" prop="YbFiccPcIcon" v-if="aeForm.parent_id==0">
+				<el-form-item label="PC端背景颜色" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_pcBackColor"
+                    prop="YbFiccPcIcon" v-if="aeForm.parent_id==0">
 					<el-select v-model="aeForm.YbFiccPcIcon" placeholder="选择背景颜色" style="width:400px;">
 						<el-option :label="item.label" :value="item.val" v-for="item in YbFiccPcIconList" :key="item.label"></el-option>
 					</el-select>
 				</el-form-item>
-				<el-form-item label="小程序端隐藏" prop="IsShow" v-if="aeForm.parent_id==0">
+				<el-form-item label="小程序端隐藏" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_miniHidden"
+                    prop="IsShow" v-if="aeForm.parent_id==0">
 					<el-switch v-model="aeForm.IsShow" inactive-color="#ededed"></el-switch>
 					<!-- <span>{{aeForm.IsShow?'开':'关'}}</span> -->
 				</el-form-item>
@@ -186,7 +202,8 @@
 						<el-option label="有" :value="1"></el-option>
 					</el-select>
 				</el-form-item>
-				<el-form-item label="关联设置" prop="relate" v-if="!['晨报','周报'].includes(aeForm.classify_name)">
+				<el-form-item label="关联设置" v-permission="permissionBtn.classifyBtn.classifyList_cnClassify_relateSetting"
+                    prop="relate" v-if="!['晨报','周报'].includes(aeForm.classify_name)">
 					<el-select v-model="aeForm.relate" multiple placeholder="请选择" style="width:400px;">
 						<el-option label="报告电话会" :value="1"></el-option>
 						<el-option label="视频关联报告" :value="2"></el-option>
@@ -315,6 +332,13 @@ export default{
 			}
 			return arr
 		},
+        //通过计算属性判断是否展示
+        //当没有中文分类页面权限时,啥都不展示
+        isTableShow(){
+            return this.permissionBtn.checkPermissionBtn(
+                this.permissionBtn.classifyBtn.classifyList_cnClassify
+            )
+        },
 	},
 	data(){
 		return {
@@ -514,6 +538,7 @@ export default{
 		// 		this.getlist();
 		//     }
 		// }
+        this.setPermissRules()
 	},
 	methods:{
 		showInput(index){
@@ -871,7 +896,22 @@ export default{
       if(!parent) return
       YbShareBgImg = parent.YbShareBgImg||''
       return YbShareBgImg
-    }
+    },
+    //由于表单一些项可配置,表单验证规则也需要过滤掉不展示的项
+    setPermissRules(){
+            const {classifyBtn,checkPermissionBtn} = this.permissionBtn
+            const permissMap={
+                'YbFiccIcon':checkPermissionBtn(classifyBtn.classifyList_cnClassify_ficcIcon),
+                'YbRightBanner':checkPermissionBtn(classifyBtn.classifyList_cnClassify_reportImgs),
+                'YbShareBgImg':checkPermissionBtn(classifyBtn.classifyList_cnClassify_shareImgs),
+                'YbFiccPcIcon':checkPermissionBtn(classifyBtn.classifyList_cnClassify_pcBackColor)
+            }
+            for(let k in permissMap){
+                if(!permissMap[k]&&this.aerules[k]){
+                    delete this.aerules[k]
+                }
+            }
+        }
 	}
 }	
 </script>

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

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

+ 3 - 2
src/vuex/modules/permissionButton.js

@@ -24,8 +24,9 @@ const permissionButtons = {
                     {button_code:'reportManage_reportView_copyWechat'},
                     {button_code:'enReport:reportView'},
                     {button_code:'enReport:reportView:wechatShare'},
-                    {button_code:'classifyList:enClassify:rpAddClassify'},
-                    {button_code:'classifyList:enClassify:report'}
+                    //{button_code:'classifyList:enClassify'},
+                    {button_code:'classifyList:cnClassify'},
+                    {button_code:'classifyList:cnClassify:classifyAdd'}
                 ]
                 commit('SET_PERMISSION_BUTTONS',buttons)
                 resolve('获取权限按钮成功')