修正一些问题

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_MODE_KEY=admin.theme.mode
VUE_APP_THEME_COLOR_KEY=admin.theme.color VUE_APP_THEME_COLOR_KEY=admin.theme.color
VUE_APP_API_BASE_URL=http://zxx4.f3322.net:46000 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_BEID=1
VUE_APP_PTYID=0 VUE_APP_PTYID=0

View File

@ -1,9 +1,8 @@
<template> <template>
<div class="footer"> <div class="footer">
<div class="copyright"> <div class="copyright">
<a-icon type="copyright" />{{project.copyright}} <br /> <a-icon type="copyright" />{{ Project.copyright }} <br />
<a-icon type="copyright" />{{project.en_copyright}} <br /> <a-icon type="copyright" />{{ Project.en_copyright }} <br />
</div> </div>
</div> </div>
@ -15,11 +14,16 @@ export default {
name: 'PageFooter', name: 'PageFooter',
data() { data() {
return { 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> </script>

View File

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

View File

@ -39,14 +39,16 @@
</template> </template>
<template #op2="{ row }"> <template #op2="{ row }">
<div class="oplinks2"> <div class="oplinks2">
<a-button @click.stop="pageRole(row)">角色设置</a-button> <a-button @click.stop="pageRole(row)">关联角色</a-button>
</div> </div>
</template> </template>
<template #op3="{ row }"> <template #op3="{ row }">
<div class="oplinks2"> <div class="oplinks2">
<a-button @click.stop="pagePermission(row)">权限设置</a-button> <a-button @click.stop="pagePermission(row)">设置</a-button>
</div> </div>
</template> </template>
</vxe-grid> </vxe-grid>
</div> </div>
@ -69,7 +71,7 @@
<span>设置权限</span> <span>设置权限</span>
</template> </template>
<template #default> <template #default>
<!-- 显示设置权限 -->
<vxe-table show-overflow auto-resize height="500" row-id="id" ref="xPermissionTable" :data="permissionData" <vxe-table show-overflow auto-resize height="500" row-id="id" ref="xPermissionTable" :data="permissionData"
:tree-config="{ transform: true, expandAll: true }" :tree-config="{ transform: true, expandAll: true }"
:checkbox-config="{ reserve: true, highlight: true, trigger: 'row', labelField: 'nodeTitle' }"> :checkbox-config="{ reserve: true, highlight: true, trigger: 'row', labelField: 'nodeTitle' }">
@ -183,13 +185,13 @@ export default {
columns: [ columns: [
{ type: 'checkbox', width: 50 }, { type: 'checkbox', width: 50 },
{ type: 'seq', width: 50 }, { type: 'seq', width: 50 },
{ title: '操作', slots: { default: 'op' }, width: 120 }, { field: 'realname', sortable: true, title: '名称' },
{ title: '角色设置', slots: { default: 'op2' }, width: 120 }, { field: 'nickname', sortable: true, title: '昵称', showHeaderOverflow: true },
{ title: '权限设置', slots: { default: 'op3' }, width: 120 },
{ field: 'name', sortable: true, title: '名称' },
{ field: 'nick_name', sortable: true, title: '昵称', showHeaderOverflow: true },
{ field: 'email', sortable: true, title: 'email', 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 customList = a.data.UserCustom || [];
let adds = []; let adds = [];
let removes = []; let removes = [];
customList.forEach(customItem => { customList.forEach(customItem => { //
if (rows.filter(row => row.permission_code == customItem.permission_code).length == 0) { if (rows.filter(row => row.permission_code == customItem.permission_code).length == 0) {
removes.push(customItem.id); removes.push(customItem.id);
} }
}); });
rows.forEach(row => { rows.forEach(row => { //
if (customList.filter(customItem => row.permission_code == customItem.permission_code).length == 0) { if (customList.filter(customItem => row.permission_code == customItem.permission_code).length == 0) {
adds.push(row.permission_code); adds.push(row.permission_code);
} }
}) })
this.savePermission({ adds, removes }); this.savePermission({ adds, removes }); //
}); });
}, },
roleDataInit() { roleDataInit() { //
this.$mk.post({ this.$mk.post({
url: this.actions.roleList, url: this.actions.roleList,
data: { data: {
@ -413,7 +415,7 @@ export default {
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
}, },
permissionDataInit() { permissionDataInit() { //
this.$mk.post({ this.$mk.post({
url: this.actions.permissionList, url: this.actions.permissionList,
@ -448,7 +450,9 @@ export default {
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
}, },
pageRole(row) {
pageRole(row) { //
if (!row) { if (!row) {
this.$mk.msg("请选择行"); this.$mk.msg("请选择行");
return; return;
@ -477,22 +481,22 @@ export default {
}); });
}, },
pagePermission(row) { pagePermission(row) { //
if (!row) { if (!row) {
this.$mk.msg("请选择行"); this.$mk.msg("请选择行");
return; return;
} }
this.currentRow = row; this.currentRow = row; //
this.$mk.post({ this.$mk.post({ //
url: this.actions.userPermissionList, url: this.actions.userPermissionList,
data: { data: {
target_uid: row.uid target_uid: row.uid
} }
}).then(a => { }).then(a => { //
this.showPermission = true; this.showPermission = true;
let rows = []; let rows = [];
let uesrCustom = a.data.UserCustom || []; let uesrCustom = a.data.UserCustom || []; //
this.permissionData.forEach(item => { this.permissionData.forEach(item => { //
if (uesrCustom.filter(customerItem => item.permission_code == customerItem.permission_code).length) { if (uesrCustom.filter(customerItem => item.permission_code == customerItem.permission_code).length) {
rows.push(item); rows.push(item);
} }
@ -507,7 +511,7 @@ export default {
}, },
pageDelete(row) { pageDelete(row) { //
let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords(); let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords();
@ -541,7 +545,7 @@ export default {
}, },
onSearch() { onSearch() { //
this.$refs.xGrid.commitProxy('query') this.$refs.xGrid.commitProxy('query')
} }
}, },
@ -551,14 +555,26 @@ export default {
} }
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.page-body { .page-body {
padding: 10px 10px; padding: 20px 20px;
background: @base-bg-color; background: @base-bg-color;
} }
.gridPanel { .gridPanel {
height: calc(100vh - 430px); 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="{}"> <template #date="{}">
<a-form-item label="创建时间" :style="{ display: 'inline-block', width: 120 }"> <a-form-item label="创建时间" :style="{ display: 'inline-block', width: 120 }">
</a-form-item> </a-form-item>
<a-form-item :style="{ display: 'inline-block', width: 'calc(100% - 120px )' }"> <a-form-item :style="{ display: 'inline-block', width: 'calc(100% - 120px )' }">
<a-range-picker @change="onDateChange" /> <a-range-picker @change="onDateChange" />
</a-form-item> </a-form-item>
</template> </template>
</vxe-form> </vxe-form> -->
<!-- 批量删除工具条 -->
<vxe-toolbar ref="xToolbar" custom> <vxe-toolbar ref="xToolbar" custom>
<template #buttons> <template #buttons>
<a-button type="primary" icon="delete" @click="pageDelete()">批量删除</a-button> <a-button type="primary" icon="delete" @click="pageDelete()">批量删除</a-button>
</template> </template>
</vxe-toolbar> </vxe-toolbar>
<!-- 表格区 --> <!-- 表格区 -->
<div class="gridPanel"> <div class="gridPanel">
<vxe-grid ref='xGrid' v-bind="gridOptions"> <vxe-grid ref='xGrid' v-bind="gridOptions">
@ -75,28 +78,27 @@ export default {
// //
var pageData = { var pageData = {
keyName: 'id', keyName: 'id', //
actions: { actions: { //
getList: `${BASE_URL.BASE_URL}/BasePermission/v1/role/list`, getList: `${BASE_URL.BASE_URL}/BasePermission/v1/role/list`, //
delete: `${BASE_URL.BASE_URL}/BasePermission/v1/role/batchDelete`, delete: `${BASE_URL.BASE_URL}/BasePermission/v1/role/batchDelete`, //
permissionList: `${BASE_URL.BASE_URL}/BasePermission/v1/service/permission/list`, permissionList: `${BASE_URL.BASE_URL}/BasePermission/v1/service/permission/list`, //
rolePermissionList: `${BASE_URL.BASE_URL}/BasePermission/v1/role/permission/list`, rolePermissionList: `${BASE_URL.BASE_URL}/BasePermission/v1/role/permission/list`, //
savePermission: `${BASE_URL.BASE_URL}/BasePermission/v1/role/permission/batchHandle`, savePermission: `${BASE_URL.BASE_URL}/BasePermission/v1/role/permission/batchHandle`, //
}, },
permissionData: [], permissionData: [], //
showPermission: false, showPermission: false, //
currentRow: null, currentRow: null, //
start_time: 0, start_time: 0, //
end_time: 0, end_time: 0, //
// //
searchFormData: { searchFormData: { //
name: '', name: '', //
nick_name: '',
}, },
searchRules: [ searchRules: [
{ key: "name", mode: "like" }, { key: "name", mode: "like" },
@ -110,8 +112,8 @@ export default {
title: '左侧', title: '左侧',
span: 20, span: 20,
children: [ children: [
{ field: 'name', 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: '请输入描述' } } }, { field: 'desc', title: '角色描述', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } },
{ span: 8, slots: { default: 'date' } }, { span: 8, slots: { default: 'date' } },
{ align: 'right', span: 4, itemRender: { name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, { align: 'right', span: 4, itemRender: { name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } },
{ props: { type: 'reset', content: '重置' } }] } } { props: { type: 'reset', content: '重置' } }] } }
@ -158,10 +160,10 @@ export default {
columns: [ columns: [
{ type: 'checkbox', width: 50 }, { type: 'checkbox', width: 50 },
{ type: 'seq', 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 }, { title: '权限设置', slots: { default: 'op3' }, width: 120 },
{ field: 'name', sortable: true, title: '名称' }, { title: '操作', slots: { default: 'op' },width:120 }
{ field: 'desc', sortable: true, title: '描述', showHeaderOverflow: true }
] ]
} }
}; };
@ -436,10 +438,17 @@ export default {
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.page-body { .page-body {
padding: 10px 10px; padding: 20px 20px;
background: @base-bg-color; background: @base-bg-color;
} }
.gridPanel{ .gridPanel{
height: calc(100vh - 430px); 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> <template>
<div class="page-body"> <div class="page-body">
<!-- 开始表单 -->
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth" <!-- :data 表单数据 -->
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon> <!-- :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="{}"> <template #myregion="{}">
<!-- 搜索 -->
<!-- placeholder 占位符 -->
<!-- enter-button 是否显示搜索按钮 -->
<a-input-search placeholder="input search text" enter-button /> <a-input-search placeholder="input search text" enter-button />
</template> </template>
</vxe-form> </vxe-form>
<!-- 按钮 -->
<div> <div>
<a-button type="primary" @click="ok">确定</a-button> <a-button type="primary" @click="ok">确定</a-button>
<a-button @click="cancel">取消</a-button> <a-button @click="cancel">取消</a-button>
@ -18,15 +27,15 @@
</template> </template>
<script> <script>
import BASE_URL from '@/services/base/api.js'; import BASE_URL from '@/services/base/api.js'; // api
export default { export default {
name: 'BasePermissionEdit', name: 'BasePermissionEdit',
props: { props: { //
pageMode: { pageMode: { // add edit
type: String, type: String, //
default: "edit" default: "edit" //
}, },
dataId: { dataId: {
} }
@ -38,35 +47,45 @@ export default {
// //
var pageData = { var pageData = {
actions: { actions: { // api
create: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/create`, create: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/create`, //
update: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/update`, update: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/update`, //
get: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/detail` get: `${BASE_URL.BASE_URL}/BasePermission/v1/base/permission/detail` //
}, },
formOptions: { formOptions: { //
data: { data: { //
"title": "", "title": "",
"service": "", "service": "",
"permission_code": "", "permission_code": "",
"desc": "" "desc": ""
}, },
titleWidth: 100, titleWidth: 100, //
titleAlign: 'right', titleAlign: 'right', //
rules: { rules: { //
title: [ title: [ //
{ required: true, message: '请输入权限名' } { required: true, message: '请输入权限名' }
] ]
}, },
items: [ items: [
{ {
title: '左侧', title: '左侧', //
children: [ children: [
{ field: 'title', title: '权限名', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入权限名' } } }, {
{ field: 'permission_code', title: '编号', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入编号' } } }, 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: 'service', title: 'service', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入service' } } },
{ field: 'desc', title: '描述', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } } { 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); pageData.formOptions = Object.assign(this.$mk.config.defaults.formOptions, pageData.formOptions);
//
return pageData; return pageData;
}, },
created() { created() { //
if (this.dataId) { if (this.dataId) { // id
this.$mk.post({ this.$mk.post({ //
url: this.actions.get, url: this.actions.get, // api
loading: "加载中...", loading: "加载中...", //
data: { data: { //
id: this.dataId id: this.dataId // id
} }
}).then(a => { }).then(a => { //
this.formOptions.data = a.data.base_permission; this.formOptions.data = a.data.base_permission; //
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
} }
@ -103,43 +122,43 @@ export default {
loadData() { loadData() {
}, },
ok() { ok() { //
let save = () => { let save = () => { //
let action = this.pageMode == "add" ? this.actions.create : this.actions.update; 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); let postdata = this.pageMode == "add" ? Object.assign({ id: this.dataId }, this.formOptions.data) : Object.assign({}, this.formOptions.data); // apiapi
this.$mk.post({ this.$mk.post({ //
url: action, url: action, // api
loading: "保存中...", loading: "保存中...", //
data: postdata data: postdata //
}).then(() => { }).then(() => { //
this.$mk.success("保存成功"); this.$mk.success("保存成功"); //
this.$emit("callback", { success: true }); this.$emit("callback", { success: true }); //
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg); //
}); });
}; };
this.$refs.xForm.validate((a) => { this.$refs.xForm.validate((a) => { //
if (a) { if (a) { //
let count = 0; let count = 0; //
for (let name in a) { for (let name in a) { //
a[name]; a[name]; //
count++; count++; // +1
} }
this.$mk.error(`存在${count}项错误,请检查`); this.$mk.error(`存在${count}项错误,请检查`); //
} else { } else {
save(); save(); //
} }
}); });
}, },
cancel() { cancel() { //
this.$emit("callback", {}); this.$emit("callback", {}); //
} }
}, },
// //

View File

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