1.字段权限配置完成;
This commit is contained in:
@@ -9,9 +9,17 @@ export function getRoleList(query: PageQuery) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getMenuList(query: PageQuery) {
|
||||
return request({
|
||||
url: '/api/system/menu/',
|
||||
method: 'get',
|
||||
params: {is_catalog:0,...query},
|
||||
});
|
||||
}
|
||||
|
||||
export function getModelList() {
|
||||
return request({
|
||||
url: '/api/system/column/get_models/',
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,21 +10,6 @@
|
||||
<el-table :data="state.data" border v-loading="state.loading" class="ctc-table">
|
||||
<el-table-column prop="field_name" label="字段名" />
|
||||
<el-table-column prop="title" label="列名" />
|
||||
<el-table-column prop="is_create" label="创建显示">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.is_create" @change="handleChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_update" label="编辑显示">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.is_update" @change="handleChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="is_query" label="查询显示">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.is_query" @change="handleChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" align="center">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" @click="handleUpdateColumn('update', scope.row)">编辑</el-button>
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
<template>
|
||||
<fs-page class="columns">
|
||||
<el-row class="columns-el-row">
|
||||
<el-row class="columns-el-row" :gutter="10">
|
||||
<el-col :span="4">
|
||||
<div class="columns-box columns-left">
|
||||
<ItemCom title="角色" type="role" showPagination @fetchData="fetchRoleData" @itemClick="handleClick" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<div class="columns-box columns-left">
|
||||
<ItemCom title="菜单" type="menu" showPagination @fetchData="fetchMenuData" @itemClick="handleClick" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div class="columns-box columns-center">
|
||||
<ItemCom title="模型表" type="model" label="showText" value="key" @fetchData="fetchModelData" @itemClick="handleClick" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="14">
|
||||
<el-col :span="10">
|
||||
<div class="columns-box columns-right">
|
||||
<ColumnsTableCom ref="columnsTableRef" :currentInfo="currentInfo" />
|
||||
</div>
|
||||
@@ -24,7 +29,7 @@
|
||||
import { ref, reactive } from 'vue';
|
||||
import ItemCom from './components/ItemCom/index.vue';
|
||||
import ColumnsTableCom from './components/ColumnsTableCom/index.vue';
|
||||
import { getRoleList, getModelList } from './api';
|
||||
import { getRoleList, getModelList,getMenuList } from './api';
|
||||
import { PageQuery, CurrentInfoType, ModelItemType } from './types';
|
||||
|
||||
const columnsTableRef = ref<InstanceType<typeof ColumnsTableCom> | null>(null);
|
||||
@@ -32,13 +37,29 @@ let currentInfo = reactive<CurrentInfoType>({
|
||||
role: '',
|
||||
model: '',
|
||||
app: '',
|
||||
menu:''
|
||||
});
|
||||
|
||||
/**
|
||||
* 获取角色
|
||||
* @param query
|
||||
* @param callback
|
||||
*/
|
||||
const fetchRoleData = async (query: PageQuery, callback: Function) => {
|
||||
const res = await getRoleList(query);
|
||||
callback(res);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取菜单
|
||||
* @param query
|
||||
* @param callback
|
||||
*/
|
||||
const fetchMenuData= async (query: PageQuery, callback: Function) => {
|
||||
const res = await getMenuList(query);
|
||||
callback(res);
|
||||
};
|
||||
|
||||
const fetchModelData = async (query: PageQuery, callback: Function) => {
|
||||
const res = await getModelList();
|
||||
res.data.forEach((item: ModelItemType) => {
|
||||
@@ -58,6 +79,11 @@ const handleClick = (type: string, record: any) => {
|
||||
if (type === 'role') {
|
||||
currentInfo.role = record.id;
|
||||
}
|
||||
|
||||
if(type === 'menu'){
|
||||
currentInfo.menu = record.id;
|
||||
}
|
||||
|
||||
if (type === 'model') {
|
||||
currentInfo.model = record.key;
|
||||
currentInfo.app = record.app;
|
||||
@@ -88,7 +114,6 @@ const handleClick = (type: string, record: any) => {
|
||||
border-radius: 0 8px 8px 0;
|
||||
}
|
||||
.columns-center {
|
||||
margin: 0 10px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.columns-right {
|
||||
|
||||
@@ -13,6 +13,8 @@ export interface CurrentInfoType {
|
||||
role: string;
|
||||
model: string;
|
||||
app: string;
|
||||
|
||||
menu: string;
|
||||
}
|
||||
|
||||
export interface ModelItemType {
|
||||
@@ -38,4 +40,4 @@ export interface ColumnsFormDataType {
|
||||
is_create: boolean;
|
||||
is_update: boolean;
|
||||
is_query: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,29 +49,23 @@
|
||||
<div class="pccm-item">
|
||||
<p>对这些数据有以下字段权限</p>
|
||||
|
||||
<el-radio-group v-model="item.radio">
|
||||
<el-radio label="1">全部字段可查看可编辑</el-radio>
|
||||
<el-radio label="2">全部字段仅可查看不可编辑</el-radio>
|
||||
<el-radio label="3">自定义字段权限</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
<ul v-show="item.radio === '3'" class="columns-list">
|
||||
<ul class="columns-list">
|
||||
<li class="columns-head">
|
||||
<div class="width-txt">
|
||||
<span>字段</span>
|
||||
</div>
|
||||
|
||||
<div v-for="btn in item.btns" :key="btn.value" class="width-check">
|
||||
<el-checkbox :label="btn.value" @change="handleColumnChange($event, item, btn.value)">
|
||||
<span>{{ btn.label }}</span>
|
||||
<div v-for="(head,hIndex) in column.header" :key="hIndex" class="width-check">
|
||||
<el-checkbox :label="head.value" @change="handleColumnChange($event, item, head.value)">
|
||||
<span>{{head.label}}</span>
|
||||
</el-checkbox>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li v-for="(c_item, c_index) in item.columns" :key="c_index" class="columns-item">
|
||||
<div class="width-txt">{{ c_item.name }}</div>
|
||||
<div v-for="btn in item.btns" :key="btn.value" class="width-check">
|
||||
<el-checkbox v-model="c_item[btn.value]" class="ci-checkout"></el-checkbox>
|
||||
<div class="width-txt">{{ c_item.title }}</div>
|
||||
<div v-for="(col,cIndex) in column.header" :key="cIndex" class="width-check">
|
||||
<el-checkbox v-model="c_item[col.value]" class="ci-checkout"></el-checkbox>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -112,7 +106,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref, onMounted, defineProps, watch,computed} from 'vue';
|
||||
import {ref, onMounted, defineProps, watch, computed, reactive} from 'vue';
|
||||
import XEUtils from 'xe-utils';
|
||||
import {errorNotification} from '/@/utils/message';
|
||||
import {getDataPermissionRange, getDataPermissionDept, getRolePremission, setRolePremission,setBtnDatarange} from './api';
|
||||
@@ -257,6 +251,10 @@ const handleSavePermission = () => {
|
||||
})
|
||||
}
|
||||
|
||||
const column = reactive({
|
||||
header:[{value:'is_create',label:'新增可见'},{value:'is_update',label:'编辑可见'},{value:'is_query',label:'列表可见'}]
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
});
|
||||
</script>
|
||||
@@ -300,7 +298,7 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.width-check {
|
||||
width: 80px;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.width-icon {
|
||||
|
||||
Reference in New Issue
Block a user