修正一些问题

This commit is contained in:
zxx 2022-12-21 22:36:19 +08:00
parent 621d77d7ae
commit e8b47a4e0e
7 changed files with 175 additions and 120 deletions

2
.env
View File

@ -16,6 +16,6 @@ VUE_APP_LAYOUT_KEY=admin.layout
VUE_APP_THEME_MODE_KEY=admin.theme.mode
VUE_APP_THEME_COLOR_KEY=admin.theme.color
VUE_APP_API_BASE_URL=http://zxx4.f3322.net:46000
VUE_APP_USER_MODEL=AdminUser
VUE_APP_USER_MODEL=BaseAdmin
VUE_APP_BEID=1
VUE_APP_PTYID=0

View File

@ -1,9 +1,8 @@
<template>
<div class="footer">
<div class="copyright">
<a-icon type="copyright" />{{project.copyright}} <br />
<a-icon type="copyright" />{{project.en_copyright}} <br />
<a-icon type="copyright" />{{ Project.copyright }} <br />
<a-icon type="copyright" />{{ Project.en_copyright }} <br />
</div>
</div>
@ -15,11 +14,16 @@ export default {
name: 'PageFooter',
data() {
return {
project: localStorage.getItem(process.env.VUE_APP_PROJECT_KEY)
Project: [],
}
},
created() { //
},
mounted() { //
this.Project = JSON.parse(localStorage.getItem(process.env.VUE_APP_PROJECT_KEY))
},
}
</script>

View File

@ -17,7 +17,7 @@
</a-menu-item>
<a-menu-item @click="adminRole" v-if="!isMiddleAdmin()">
<a-icon type="appstore" />
<span>权限管理</span>
<span>角色管理</span>
</a-menu-item>
<a-menu-item @click="showCompany" v-if="!isMiddleAdmin()">
<a-icon type="compass" />

View File

@ -39,14 +39,16 @@
</template>
<template #op2="{ row }">
<div class="oplinks2">
<a-button @click.stop="pageRole(row)">角色设置</a-button>
<a-button @click.stop="pageRole(row)">关联角色</a-button>
</div>
</template>
<template #op3="{ row }">
<div class="oplinks2">
<a-button @click.stop="pagePermission(row)">权限设置</a-button>
<a-button @click.stop="pagePermission(row)">设置</a-button>
</div>
</template>
</vxe-grid>
</div>
@ -69,7 +71,7 @@
<span>设置权限</span>
</template>
<template #default>
<!-- 显示设置权限 -->
<vxe-table show-overflow auto-resize height="500" row-id="id" ref="xPermissionTable" :data="permissionData"
:tree-config="{ transform: true, expandAll: true }"
:checkbox-config="{ reserve: true, highlight: true, trigger: 'row', labelField: 'nodeTitle' }">
@ -183,13 +185,13 @@ export default {
columns: [
{ type: 'checkbox', width: 50 },
{ type: 'seq', width: 50 },
{ title: '操作', slots: { default: 'op' }, width: 120 },
{ title: '角色设置', slots: { default: 'op2' }, width: 120 },
{ title: '权限设置', slots: { default: 'op3' }, width: 120 },
{ field: 'name', sortable: true, title: '名称' },
{ field: 'nick_name', sortable: true, title: '昵称', showHeaderOverflow: true },
{ field: 'realname', sortable: true, title: '名称' },
{ field: 'nickname', sortable: true, title: '昵称', showHeaderOverflow: true },
{ field: 'email', sortable: true, title: 'email', showHeaderOverflow: true },
{ field: 'mobile', sortable: true, title: '电话', showHeaderOverflow: true }
{ field: 'mobile', sortable: true, title: '电话', showHeaderOverflow: true },
{ title: '角色设置', slots: { default: 'op2' }, width: 120 },
{ title: '自定义权限设置', slots: { default: 'op3' }, width: 120 },
{ title: '操作', slots: { default: 'op' }, width: 120 }
]
}
};
@ -388,20 +390,20 @@ export default {
let customList = a.data.UserCustom || [];
let adds = [];
let removes = [];
customList.forEach(customItem => {
customList.forEach(customItem => { //
if (rows.filter(row => row.permission_code == customItem.permission_code).length == 0) {
removes.push(customItem.id);
}
});
rows.forEach(row => {
rows.forEach(row => { //
if (customList.filter(customItem => row.permission_code == customItem.permission_code).length == 0) {
adds.push(row.permission_code);
}
})
this.savePermission({ adds, removes });
this.savePermission({ adds, removes }); //
});
},
roleDataInit() {
roleDataInit() { //
this.$mk.post({
url: this.actions.roleList,
data: {
@ -413,7 +415,7 @@ export default {
this.$mk.error(a.data.msg);
});
},
permissionDataInit() {
permissionDataInit() { //
this.$mk.post({
url: this.actions.permissionList,
@ -448,7 +450,9 @@ export default {
this.$mk.error(a.data.msg);
});
},
pageRole(row) {
pageRole(row) { //
if (!row) {
this.$mk.msg("请选择行");
return;
@ -477,22 +481,22 @@ export default {
});
},
pagePermission(row) {
pagePermission(row) { //
if (!row) {
this.$mk.msg("请选择行");
return;
}
this.currentRow = row;
this.$mk.post({
this.currentRow = row; //
this.$mk.post({ //
url: this.actions.userPermissionList,
data: {
target_uid: row.uid
}
}).then(a => {
}).then(a => { //
this.showPermission = true;
let rows = [];
let uesrCustom = a.data.UserCustom || [];
this.permissionData.forEach(item => {
let uesrCustom = a.data.UserCustom || []; //
this.permissionData.forEach(item => { //
if (uesrCustom.filter(customerItem => item.permission_code == customerItem.permission_code).length) {
rows.push(item);
}
@ -507,7 +511,7 @@ export default {
},
pageDelete(row) {
pageDelete(row) { //
let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords();
@ -541,7 +545,7 @@ export default {
},
onSearch() {
onSearch() { //
this.$refs.xGrid.commitProxy('query')
}
},
@ -551,14 +555,26 @@ export default {
}
};
</script>
<style scoped lang="less">
.page-body {
padding: 10px 10px;
padding: 20px 20px;
background: @base-bg-color;
}
.gridPanel {
height: calc(100vh - 430px);
}
</style>
</style>
<style>
.oplinks svg {
width: 22px;
height: 22px;
margin: 0 5px 0 0;
}
</style>

View File

@ -7,25 +7,28 @@
<!-- 搜索区 -->
<vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch">
<!-- <vxe-form :data="searchFormData" :items="searchFormItems" titleColon @submit="onSearch">
<template #date="{}">
<a-form-item label="创建时间" :style="{ display: 'inline-block', width: 120 }">
</a-form-item>
<a-form-item :style="{ display: 'inline-block', width: 'calc(100% - 120px )' }">
<a-range-picker @change="onDateChange" />
</a-form-item>
</template>
</vxe-form>
</vxe-form> -->
<!-- 批量删除工具条 -->
<vxe-toolbar ref="xToolbar" custom>
<template #buttons>
<a-button type="primary" icon="delete" @click="pageDelete()">批量删除</a-button>
</template>
</vxe-toolbar>
<!-- 表格区 -->
<div class="gridPanel">
<vxe-grid ref='xGrid' v-bind="gridOptions">
@ -75,28 +78,27 @@ export default {
//
var pageData = {
keyName: 'id',
actions: {
getList: `${BASE_URL.BASE_URL}/BasePermission/v1/role/list`,
delete: `${BASE_URL.BASE_URL}/BasePermission/v1/role/batchDelete`,
keyName: 'id', //
actions: { //
getList: `${BASE_URL.BASE_URL}/BasePermission/v1/role/list`, //
delete: `${BASE_URL.BASE_URL}/BasePermission/v1/role/batchDelete`, //
permissionList: `${BASE_URL.BASE_URL}/BasePermission/v1/service/permission/list`,
rolePermissionList: `${BASE_URL.BASE_URL}/BasePermission/v1/role/permission/list`,
savePermission: `${BASE_URL.BASE_URL}/BasePermission/v1/role/permission/batchHandle`,
permissionList: `${BASE_URL.BASE_URL}/BasePermission/v1/service/permission/list`, //
rolePermissionList: `${BASE_URL.BASE_URL}/BasePermission/v1/role/permission/list`, //
savePermission: `${BASE_URL.BASE_URL}/BasePermission/v1/role/permission/batchHandle`, //
},
permissionData: [],
permissionData: [], //
showPermission: false,
currentRow: null,
showPermission: false, //
currentRow: null, //
start_time: 0,
end_time: 0,
start_time: 0, //
end_time: 0, //
//
searchFormData: {
name: '',
nick_name: '',
searchFormData: { //
name: '', //
},
searchRules: [
{ key: "name", mode: "like" },
@ -110,8 +112,8 @@ export default {
title: '左侧',
span: 20,
children: [
{ field: 'name', title: '名称', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入名称' } } },
{ field: 'desc', title: '描述', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } },
{ field: 'name', title: '角色名称', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入名称' } } },
{ field: 'desc', title: '角色描述', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } },
{ span: 8, slots: { default: 'date' } },
{ align: 'right', span: 4, itemRender: { name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } },
{ props: { type: 'reset', content: '重置' } }] } }
@ -158,10 +160,10 @@ export default {
columns: [
{ type: 'checkbox', width: 50 },
{ type: 'seq', width: 50 },
{ title: '操作', slots: { default: 'op' },width:120 },
{ field: 'name', sortable: true, title: '角色' },
{ field: 'desc', sortable: true, title: '角色描述', showHeaderOverflow: true } ,
{ title: '权限设置', slots: { default: 'op3' }, width: 120 },
{ field: 'name', sortable: true, title: '名称' },
{ field: 'desc', sortable: true, title: '描述', showHeaderOverflow: true }
{ title: '操作', slots: { default: 'op' },width:120 }
]
}
};
@ -436,10 +438,17 @@ export default {
</script>
<style scoped lang="less">
.page-body {
padding: 10px 10px;
padding: 20px 20px;
background: @base-bg-color;
}
.gridPanel{
height: calc(100vh - 430px);
}
</style>
</style>
<style>
.oplinks svg {
width: 22px;
height: 22px;
margin: 0 5px 0 0;
}
</style>

View File

@ -1,14 +1,23 @@
<template>
<div class="page-body">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
<!-- 开始表单 -->
<!-- :data 表单数据 -->
<!-- :title-width 标题宽度 -->
<!-- :title-align 标题对齐方式 -->
<!-- :rules 表单验证规则 -->
<!-- :items 表单配置 -->
<!-- titleColon 标题后面是否带冒号 -->
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth" :title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
<!-- 自定义区域 -->
<template #myregion="{}">
<!-- 搜索 -->
<!-- placeholder 占位符 -->
<!-- enter-button 是否显示搜索按钮 -->
<a-input-search placeholder="input search text" enter-button />
</template>
</vxe-form>
<!-- 按钮 -->
<div>
<a-button type="primary" @click="ok">确定</a-button>
<a-button @click="cancel">取消</a-button>
@ -18,15 +27,15 @@
</template>
<script>
import BASE_URL from '@/services/base/api.js';
import BASE_URL from '@/services/base/api.js'; // api
export default {
export default {
name: 'BasePermissionEdit',
props: {
pageMode: {
type: String,
default: "edit"
props: { //
pageMode: { // add edit
type: String, //
default: "edit" //
},
dataId: {
}
@ -38,35 +47,45 @@ export default {
//
var pageData = {
actions: {
create: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/create`,
update: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/update`,
get: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/detail`
actions: { // api
create: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/create`, //
update: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/update`, //
get: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/detail` //
},
formOptions: {
data: {
formOptions: { //
data: { //
"title": "",
"service": "",
"permission_code": "",
"desc": ""
},
titleWidth: 100,
titleAlign: 'right',
titleWidth: 100, //
titleAlign: 'right', //
rules: {
title: [
{ required: true, message: '请输入权限名' }
rules: { //
title: [ //
{ required: true, message: '请输入权限名' }
]
},
items: [
{
title: '左侧',
children: [
{ field: 'title', title: '权限名', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入权限名' } } },
{ field: 'permission_code', title: '编号', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入编号' } } },
title: '左侧', //
children: [
{
field: 'title', //
title: '权限名', //
span: 24, //
itemRender: { //
name: '$input', //
props: { //
placeholder: '请输入权限名' //
}
}
},
{ field: 'permission_code', title: '编号', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入编码' } } },
{ field: 'service', title: 'service', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入service' } } },
{ field: 'desc', title: '描述', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } }
]
@ -75,22 +94,22 @@ export default {
}
};
//
pageData.formOptions = Object.assign(this.$mk.config.defaults.formOptions, pageData.formOptions);
//
return pageData;
},
created() {
if (this.dataId) {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: {
id: this.dataId
created() { //
if (this.dataId) { // id
this.$mk.post({ //
url: this.actions.get, // api
loading: "加载中...", //
data: { //
id: this.dataId // id
}
}).then(a => {
this.formOptions.data = a.data.base_permission;
}).catch((a) => {
}).then(a => { //
this.formOptions.data = a.data.base_permission; //
}).catch((a) => { //
this.$mk.error(a.data.msg);
});
}
@ -103,43 +122,43 @@ export default {
loadData() {
},
ok() {
ok() { //
let save = () => {
let action = this.pageMode == "add" ? this.actions.create : this.actions.update;
let postdata = this.pageMode == "add" ? Object.assign({ id: this.dataId }, this.formOptions.data) : Object.assign({}, this.formOptions.data);
let save = () => { //
let action = this.pageMode == "add" ? this.actions.create : this.actions.update; // apiapi
let postdata = this.pageMode == "add" ? Object.assign({ id: this.dataId }, this.formOptions.data) : Object.assign({}, this.formOptions.data); // apiapi
this.$mk.post({
url: action,
loading: "保存中...",
data: postdata
}).then(() => {
this.$mk.success("保存成功");
this.$emit("callback", { success: true });
}).catch((a) => {
this.$mk.error(a.data.msg);
this.$mk.post({ //
url: action, // api
loading: "保存中...", //
data: postdata //
}).then(() => { //
this.$mk.success("保存成功"); //
this.$emit("callback", { success: true }); //
}).catch((a) => { //
this.$mk.error(a.data.msg); //
});
};
this.$refs.xForm.validate((a) => {
this.$refs.xForm.validate((a) => { //
if (a) {
let count = 0;
for (let name in a) {
a[name];
count++;
if (a) { //
let count = 0; //
for (let name in a) { //
a[name]; //
count++; // +1
}
this.$mk.error(`存在${count}项错误,请检查`);
this.$mk.error(`存在${count}项错误,请检查`); //
} else {
save();
save(); //
}
});
},
cancel() {
this.$emit("callback", {});
cancel() { //
this.$emit("callback", {}); //
}
},
//

View File

@ -279,4 +279,11 @@ export default {
padding: 30px ;
background: @base-bg-color;
}
</style>
</style>
<style>
.oplinks svg {
width: 22px;
height: 22px;
margin: 0 5px 0 0;
}
</style>