|
@@ -2,7 +2,7 @@
|
|
|
<div class="system-dataAuth-container layout-padding">
|
|
|
<div class="layout-padding-auto layout-padding-view pd20">
|
|
|
<!-- 正常 -->
|
|
|
- <template v-if="state.queryParams.roleid">
|
|
|
+ <template v-if="state.roleId">
|
|
|
<div class="flex-center-between mb20">
|
|
|
<p class="table-title">信息列表</p>
|
|
|
<div>
|
|
@@ -15,15 +15,11 @@
|
|
|
<el-table :data="state.tableData" v-loading="state.loading" row-key="id" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55" :reserve-selection="true" />
|
|
|
<el-table-column type="index" width="60" label="序号" />
|
|
|
- <el-table-column prop="role.displayName" label="角色名称" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="role.name" label="角色编码" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="role.description" label="角色说明" show-overflow-tooltip width="400"></el-table-column>
|
|
|
- <el-table-column prop="table.displayName" label="数据表" show-overflow-tooltip width="100"> </el-table-column>
|
|
|
- <el-table-column prop="authorityType" label="权限方式" show-overflow-tooltip width="100">
|
|
|
- <template #default="scope">
|
|
|
- {{ state.options[scope.row.authorityType].label }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <el-table-column prop="tableName" label="表编码" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="tableDisplay" label="表名称" show-overflow-tooltip> </el-table-column>
|
|
|
+ <el-table-column prop="roleDisplay" label="角色名称" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="roleCode" label="角色编码" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="accessLevelText" label="可见等级" show-overflow-tooltip width="100"> </el-table-column>
|
|
|
<el-table-column label="操作" width="130" fixed="right" align="center">
|
|
|
<template #default="scope">
|
|
|
<el-button link type="primary" @click="onEditAuth(scope.row)" v-auth="'100207'" title="修改">
|
|
@@ -55,9 +51,11 @@ import { ElMessageBox, ElMessage } from 'element-plus';
|
|
|
import { useRoute } from 'vue-router';
|
|
|
import table2excel from 'js-table2excel';
|
|
|
import { formatDate } from '/@/utils/formatTime';
|
|
|
+import { storeToRefs } from 'pinia';
|
|
|
+import { useThemeConfig } from '/@/stores/themeConfig';
|
|
|
import { auth } from '/@/utils/authFunction';
|
|
|
import { throttle } from '/@/utils/tools';
|
|
|
-import { getdataauthoritybyrole, deleteDataAuth } from '/@/api/system/roles';
|
|
|
+import { getdataauthoritybyrole, deleteDataAuth, baseData } from '/@/api/system/roles';
|
|
|
|
|
|
// 引入组件
|
|
|
const AddAuth = defineAsyncComponent(() => import('/@/views/system/dataAuth/component/AddAuth.vue'));
|
|
@@ -65,45 +63,26 @@ const EditAuth = defineAsyncComponent(() => import('/@/views/system/dataAuth/com
|
|
|
|
|
|
// 定义接口来定义对象的类型
|
|
|
interface QueryState {
|
|
|
- queryParams: {
|
|
|
- roleid: string | any[];
|
|
|
- };
|
|
|
+ roleId: string | any[];
|
|
|
tableData: Array<any>;
|
|
|
loading: boolean;
|
|
|
multipleSelection: Array<any>;
|
|
|
- options: Array<any>;
|
|
|
+ accessLevelOptions: Array<any>;
|
|
|
}
|
|
|
|
|
|
// 定义变量内容
|
|
|
const state = reactive<QueryState>({
|
|
|
- queryParams: {
|
|
|
- roleid: '',
|
|
|
- },
|
|
|
+ roleId: '',
|
|
|
tableData: [],
|
|
|
loading: false,
|
|
|
multipleSelection: [],
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: '全部可见',
|
|
|
- value: 0,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '本部',
|
|
|
- value: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '本部及以下',
|
|
|
- value: 2,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '创建人',
|
|
|
- value: 3,
|
|
|
- },
|
|
|
- ], //可用组织
|
|
|
+ accessLevelOptions: <any>[], //可用组织
|
|
|
});
|
|
|
const addAuthRef = ref(); //新增数据权限
|
|
|
const editAuthRef = ref(); //修改数据权限
|
|
|
const route = useRoute();
|
|
|
+const storesThemeConfig = useThemeConfig();
|
|
|
+const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
|
/** 搜索按钮操作 节流操作 */
|
|
|
const handleQuery = throttle(() => {
|
|
|
getList();
|
|
@@ -113,7 +92,7 @@ const getList = () => {
|
|
|
if (!auth('100209')) ElMessage.error('抱歉,您没有获取数据权限的权限!');
|
|
|
else {
|
|
|
state.loading = true;
|
|
|
- getdataauthoritybyrole(state.queryParams)
|
|
|
+ getdataauthoritybyrole(state.roleId)
|
|
|
.then((response: any) => {
|
|
|
state.tableData = response?.result ?? [];
|
|
|
state.loading = false;
|
|
@@ -126,7 +105,7 @@ const getList = () => {
|
|
|
|
|
|
// 新增数据权限
|
|
|
const onAddAuth = () => {
|
|
|
- addAuthRef.value.openDialog();
|
|
|
+ addAuthRef.value.openDialog(state.accessLevelOptions);
|
|
|
};
|
|
|
// 表格多选
|
|
|
const handleSelectionChange = (val: any) => {
|
|
@@ -135,7 +114,7 @@ const handleSelectionChange = (val: any) => {
|
|
|
|
|
|
// 打开修改数据权限弹窗
|
|
|
const onEditAuth = (row: any) => {
|
|
|
- editAuthRef.value.openDialog(row);
|
|
|
+ editAuthRef.value.openDialog(row, state.accessLevelOptions);
|
|
|
};
|
|
|
// 删除数据权限
|
|
|
const onRowDel = (row: any) => {
|
|
@@ -157,21 +136,31 @@ const onRowDel = (row: any) => {
|
|
|
// 导出表格
|
|
|
const onImportTable = () => {
|
|
|
const tabeHeader = [
|
|
|
- { key: 'name', colWidth: '', title: '姓名', type: 'text', isCheck: true },
|
|
|
- { key: 'userName', colWidth: '', title: '账号', type: 'text', isCheck: true },
|
|
|
- { key: 'orgName', colWidth: '', title: '所属部门', type: 'text', isCheck: true },
|
|
|
- { key: 'roles', colWidth: '', title: '角色', type: 'text', isCheck: true },
|
|
|
- { key: 'phoneNo', colWidth: '', title: '电话号码', type: 'text', isCheck: true },
|
|
|
- { key: 'staffNo', colWidth: '', title: '工号', type: 'text', isCheck: true },
|
|
|
- { key: 'defaultTelNo', colWidth: '', title: '默认分机', type: 'text', isCheck: true },
|
|
|
- { key: 'creationTime', colWidth: '', title: '更新时间', type: 'text', isCheck: true },
|
|
|
+ { key: 'tableName', colWidth: '', title: '表编码', type: 'text', isCheck: true },
|
|
|
+ { key: 'tableDisplay', colWidth: '', title: '表名称', type: 'text', isCheck: true },
|
|
|
+ { key: 'roleDisplay', colWidth: '', title: '角色名称', type: 'text', isCheck: true },
|
|
|
+ { key: 'roleCode', colWidth: '', title: '角色编码', type: 'text', isCheck: true },
|
|
|
+ { key: 'accessLevelText', colWidth: '', title: '可见等级', type: 'text', isCheck: true },
|
|
|
];
|
|
|
- table2excel(tabeHeader, state.multipleSelection, `用户信息 ${formatDate(new Date(), 'YYYY-mm-dd HH-MM')}`);
|
|
|
+ table2excel(
|
|
|
+ tabeHeader,
|
|
|
+ state.multipleSelection,
|
|
|
+ `${themeConfig.value.globalTitle}-${route.meta.title} ${formatDate(new Date(), 'YYYY-mm-dd HH-MM')}`
|
|
|
+ );
|
|
|
+};
|
|
|
+const getBaseData = async () => {
|
|
|
+ try {
|
|
|
+ const res: any = await baseData();
|
|
|
+ state.accessLevelOptions = res.result.accessLevelOptions ?? [];
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
if (route.query.id) {
|
|
|
- state.queryParams.roleid = route.query.id;
|
|
|
+ state.roleId = route.query.id;
|
|
|
getList();
|
|
|
+ getBaseData();
|
|
|
}
|
|
|
});
|
|
|
</script>
|