fix 修复菜单编辑
This commit is contained in:
@@ -43,7 +43,7 @@ export default {
|
|||||||
onOpen(record) {
|
onOpen(record) {
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
this.$nextTick(async () => {
|
this.$nextTick(async () => {
|
||||||
await this.formBody.onInit();
|
await this.formBody.onInit(record);
|
||||||
this.formBody.onFillData(record);
|
this.formBody.onFillData(record);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
<a-form-model-item label="内外链地址" prop="link" v-if="form.type == 1 && form.openType == 3">
|
<a-form-model-item label="内外链地址" prop="link" v-if="form.type == 1 && form.openType == 3">
|
||||||
<a-input placeholder="请输入内外链地址" v-model="form.link" />
|
<a-input placeholder="请输入内外链地址" v-model="form.link" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="权重" prop="weight">
|
<!-- <a-form-model-item label="权重" prop="weight">
|
||||||
<template slot="help">
|
<template slot="help">
|
||||||
系统权重:菜单可分配给任何角色
|
系统权重:菜单可分配给任何角色
|
||||||
<br />业务权重:菜单对超级管理员不可见
|
<br />业务权重:菜单对超级管理员不可见
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
v-for="type in codes.menuWerght"
|
v-for="type in codes.menuWerght"
|
||||||
>{{type.value}}</a-radio-button>
|
>{{type.value}}</a-radio-button>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</a-form-model-item>
|
</a-form-model-item>-->
|
||||||
<a-form-model-item label="可见性">
|
<a-form-model-item label="可见性">
|
||||||
<a-switch checked-children="可见" un-checked-children="隐藏" v-model="form.visible" />
|
<a-switch checked-children="可见" un-checked-children="隐藏" v-model="form.visible" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
@@ -118,16 +118,22 @@
|
|||||||
</a-form-model>
|
</a-form-model>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { EMPTY_ID } from '@/util/global';
|
||||||
|
|
||||||
|
const defaultValue = {
|
||||||
|
type: '1',
|
||||||
|
openType: '1',
|
||||||
|
weight: '1',
|
||||||
|
visible: true,
|
||||||
|
sort: 100,
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
/** 表单数据 */
|
/** 表单数据 */
|
||||||
form: {
|
form: {
|
||||||
type: '1',
|
...defaultValue,
|
||||||
openType: '1',
|
|
||||||
weight: '2',
|
|
||||||
visible: true,
|
|
||||||
sort: 100,
|
|
||||||
},
|
},
|
||||||
/** 验证格式 */
|
/** 验证格式 */
|
||||||
rules: {
|
rules: {
|
||||||
@@ -168,7 +174,6 @@ export default {
|
|||||||
...record,
|
...record,
|
||||||
/** 在此处添加默认数据转换 */
|
/** 在此处添加默认数据转换 */
|
||||||
/** ... */
|
/** ... */
|
||||||
visible: record.visible == 'Y',
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -184,7 +189,6 @@ export default {
|
|||||||
|
|
||||||
/** 验证通过后可以对数据进行转换得到想要提交的格式 */
|
/** 验证通过后可以对数据进行转换得到想要提交的格式 */
|
||||||
/** ... */
|
/** ... */
|
||||||
record.visible = record.visible ? 'Y' : 'N';
|
|
||||||
|
|
||||||
reslove(record);
|
reslove(record);
|
||||||
} else {
|
} else {
|
||||||
@@ -209,6 +213,9 @@ export default {
|
|||||||
onResetFields() {
|
onResetFields() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$refs.form.resetFields();
|
this.$refs.form.resetFields();
|
||||||
|
this.form = {
|
||||||
|
...defaultValue,
|
||||||
|
};
|
||||||
|
|
||||||
/** 在这里可以初始化当前组件中其他属性 */
|
/** 在这里可以初始化当前组件中其他属性 */
|
||||||
/** ... */
|
/** ... */
|
||||||
@@ -220,13 +227,26 @@ export default {
|
|||||||
* 必要方法
|
* 必要方法
|
||||||
* 加载当前表单中所需要的异步数据
|
* 加载当前表单中所需要的异步数据
|
||||||
*/
|
*/
|
||||||
async onInit() {
|
async onInit(record) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
/** 可以在这里await获取一些异步数据 */
|
/** 可以在这里await获取一些异步数据 */
|
||||||
/** ...BEGIN */
|
/** ...BEGIN */
|
||||||
this.codes = await this.onLoadCodes();
|
this.codes = await this.onLoadCodes();
|
||||||
this.appList = await this.onLoadSysApplist();
|
this.appList = await this.onLoadSysApplist();
|
||||||
|
if (record) {
|
||||||
|
const treeData = await this.onLoadMenuTree(record.application);
|
||||||
|
this.parentTreeData = [
|
||||||
|
{
|
||||||
|
id: EMPTY_ID,
|
||||||
|
parentId: undefined,
|
||||||
|
title: '顶级',
|
||||||
|
value: EMPTY_ID,
|
||||||
|
pid: undefined,
|
||||||
|
children: treeData,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
/** ...END */
|
/** ...END */
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
@@ -255,6 +275,12 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLoadMenuTree(app) {
|
||||||
|
return this.$api.getMenuTree({ application: app }).then(({ data }) => {
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onTypeChangeGroup() {
|
onTypeChangeGroup() {
|
||||||
const { type, openType } = this.form;
|
const { type, openType } = this.form;
|
||||||
if (type == 1 && openType == 2) {
|
if (type == 1 && openType == 2) {
|
||||||
@@ -279,14 +305,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onChangeApplication(value) {
|
onChangeApplication(value) {
|
||||||
this.$api.getMenuTree({ application: value }).then(({ data }) => {
|
this.onLoadMenuTree(value).then((data) => {
|
||||||
this.parentTreeData = [
|
this.parentTreeData = [
|
||||||
{
|
{
|
||||||
id: -1,
|
id: EMPTY_ID,
|
||||||
parentId: 0,
|
parentId: undefined,
|
||||||
title: '顶级',
|
title: '顶级',
|
||||||
value: 0,
|
value: EMPTY_ID,
|
||||||
pid: 0,
|
pid: undefined,
|
||||||
children: data,
|
children: data,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user