修正一些问题
This commit is contained in:
parent
621d77d7ae
commit
e8b47a4e0e
2
.env
2
.env
|
|
@ -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
|
||||||
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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" />
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -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; // 如果是新增就是创建api,否则就是更新api
|
||||||
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); // 如果是新增就是创建api,否则就是更新api
|
||||||
|
|
||||||
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", {}); // 回调
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 监听属性
|
// 监听属性
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
Loading…
Reference in New Issue