|
|
@@ -38,7 +38,7 @@
|
|
|
width="50%"
|
|
|
:confirm-loading="confirmLoading"
|
|
|
>
|
|
|
- <a-form :layout="formLayout">
|
|
|
+ <a-form :layout="formLayout" :form="form">
|
|
|
<a-form-item
|
|
|
label="菜单类型"
|
|
|
v-bind="formItemLayout"
|
|
|
@@ -60,8 +60,18 @@
|
|
|
v-show="!authType"
|
|
|
>
|
|
|
<a-input
|
|
|
- v-model="dataForm.name"
|
|
|
:placeholder="menuTypeList[dataForm.type] + '名称'"
|
|
|
+ v-decorator="[
|
|
|
+ 'name',
|
|
|
+ {
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入' + menuTypeList[dataForm.type] + '名称',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
@@ -102,7 +112,20 @@
|
|
|
v-bind="formItemLayout"
|
|
|
v-show="dataForm.type != 2 && !authType"
|
|
|
>
|
|
|
- <a-input placeholder="请输入菜单路由" v-model="dataForm.url" />
|
|
|
+ <a-input
|
|
|
+ placeholder="请输入菜单路由"
|
|
|
+ v-decorator="[
|
|
|
+ 'url',
|
|
|
+ {
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入菜单名称',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ />
|
|
|
</a-form-item>
|
|
|
<a-form-item
|
|
|
label="排序编号"
|
|
|
@@ -230,6 +253,7 @@ export default {
|
|
|
title: "name",
|
|
|
key: "id",
|
|
|
},
|
|
|
+ form: this.$form.createForm(this, { name: "dynamic_rule" }),
|
|
|
dataForm: {
|
|
|
id: 0,
|
|
|
type: 1,
|
|
|
@@ -410,45 +434,49 @@ export default {
|
|
|
this.dataForm = { ...this.resetForm };
|
|
|
},
|
|
|
handleOk() {
|
|
|
- // this.visible = false;
|
|
|
- // this.confirmLoading = true;
|
|
|
- if (this.authType) {
|
|
|
- // console.log(this.authPermissions);
|
|
|
- this.$API.sysManage
|
|
|
- .setMenuAuth({
|
|
|
- customScriptFlag: this.authPermissions.customScriptFlag ? 1 : 0,
|
|
|
- dataPermissionId:
|
|
|
- this.authPermissions.customScriptFlag == 0
|
|
|
- ? this.authPermissions.dataPermissionId
|
|
|
- : undefined,
|
|
|
- id: this.authPermissions.id,
|
|
|
- menuId: this.authPermissions.menuId,
|
|
|
- scriptContent: this.authPermissions.customScriptFlag
|
|
|
- ? this.authPermissions.scriptContent
|
|
|
- : undefined,
|
|
|
- url: this.authPermissions.url,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.data.code === 200) {
|
|
|
- this.$message.success("操作成功");
|
|
|
- this.confirmLoading = false;
|
|
|
- this.visible = false;
|
|
|
- this.getList();
|
|
|
- }
|
|
|
- });
|
|
|
- } else
|
|
|
- this.$API.sysManage
|
|
|
- .setMenuItem({
|
|
|
- ...this.dataForm,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.data.code === 200) {
|
|
|
- this.$message.success("操作成功");
|
|
|
- this.confirmLoading = false;
|
|
|
- this.visible = false;
|
|
|
- this.getList();
|
|
|
- }
|
|
|
- });
|
|
|
+ this.form.validateFields((err, values) => {
|
|
|
+ if (!err) {
|
|
|
+ // console.log(values, this.dataForm);
|
|
|
+ if (this.authType) {
|
|
|
+ this.$API.sysManage
|
|
|
+ .setMenuAuth({
|
|
|
+ customScriptFlag: this.authPermissions.customScriptFlag ? 1 : 0,
|
|
|
+ dataPermissionId:
|
|
|
+ this.authPermissions.customScriptFlag == 0
|
|
|
+ ? this.authPermissions.dataPermissionId
|
|
|
+ : undefined,
|
|
|
+ id: this.authPermissions.id,
|
|
|
+ menuId: this.authPermissions.menuId,
|
|
|
+ scriptContent: this.authPermissions.customScriptFlag
|
|
|
+ ? this.authPermissions.scriptContent
|
|
|
+ : undefined,
|
|
|
+ url: this.authPermissions.url,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ this.confirmLoading = false;
|
|
|
+ this.visible = false;
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else
|
|
|
+ this.$API.sysManage
|
|
|
+ .setMenuItem({
|
|
|
+ ...this.dataForm,
|
|
|
+ name: values.name,
|
|
|
+ url: values.url,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ this.confirmLoading = false;
|
|
|
+ this.visible = false;
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
};
|