处理system模块页面 menuManage tab页面中编辑弹窗的样式问题

This commit is contained in:
任珮宇 2023-10-08 14:01:47 +08:00
parent caabe0e6e9
commit ae1a1c393a

View File

@ -4,12 +4,11 @@
:width="drawerWidth"
@close="handleCancel"
:visible="visible"
:confirmLoading="confirmLoading">
<div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
:confirmLoading="confirmLoading"
>
<div :style="{ width: '100%', border: '1px solid #e9e9e9', padding: '10px 16px', background: '#fff' }">
<a-spin :spinning="confirmLoading">
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-model-item label="Menu Type" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group @change="onChangeMenuType" v-model="model.menuType">
<a-radio :value="0">First Level Menu</a-radio>
@ -18,16 +17,10 @@
</a-radio-group>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="menuLabel"
prop="name"
hasFeedback >
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="menuLabel" prop="name" hasFeedback>
<a-input v-model="model.name" :readOnly="disableSubmit" />
</a-form-model-item>
<a-form-model-item
v-show="model.menuType != 0"
label="Parent Menu"
@ -35,7 +28,8 @@
:wrapperCol="wrapperCol"
:validate-status="validateStatus"
:hasFeedback="true"
:required="true">
:required="true"
>
<span slot="help">{{ validateStatus == 'error' ? 'Please Select Parent Menu' : '&nbsp;&nbsp;' }}</span>
<a-tree-select
style="width: 100%"
@ -44,15 +38,12 @@
v-model="model.parentId"
placeholder="Please Select Parent Menu"
:disabled="disableSubmit"
@change="handleParentIdChange">
@change="handleParentIdChange"
>
</a-tree-select>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="url"
label="Menu Route">
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url" label="Menu Route">
<a-input v-model="model.url" :readOnly="disableSubmit" />
</a-form-model-item>
@ -61,7 +52,8 @@
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="component"
label="Component">
label="Component"
>
<a-input v-model="model.component" :readOnly="disableSubmit" />
</a-form-model-item>
@ -69,106 +61,58 @@
v-show="model.menuType == 0"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Redirect Params">
label="Redirect Params"
>
<a-input v-model="model.redirect" :readOnly="disableSubmit" />
</a-form-model-item>
<a-form-model-item
v-show="!show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="perms"
label="Perms">
<a-form-model-item v-show="!show" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="perms" label="Perms">
<a-input placeholder="Enter Perms, like: user:list" v-model="model.perms" :readOnly="disableSubmit" />
</a-form-model-item>
<a-form-model-item
v-show="!show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Auth Category">
<a-form-model-item v-show="!show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Auth Category">
<j-dict-select-tag v-model="model.permsType" :type="'radio'" dictCode="global_perms_type" />
</a-form-model-item>
<a-form-model-item
v-show="!show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Status">
<a-form-model-item v-show="!show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Status">
<j-dict-select-tag v-model="model.status" :type="'radio'" dictCode="valid_status" />
</a-form-model-item>
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Icon">
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Icon">
<a-input placeholder="Click Select Icon" v-model="model.icon" :readOnly="disableSubmit">
<a-icon slot="addonAfter" type="setting" @click="selectIcons" />
</a-input>
</a-form-model-item>
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="sortNo"
label="Sort">
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sortNo" label="Sort">
<a-input-number v-model="model.sortNo" style="width: 200px" :readOnly="disableSubmit" />
</a-form-model-item>
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Is Route Menu">
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Is Route Menu">
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.route" />
</a-form-model-item>
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Hidden">
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Hidden">
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.hidden" />
</a-form-model-item>
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Keep Alive">
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Keep Alive">
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.keepAlive" />
</a-form-model-item>
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Combine Route">
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Combine Route">
<a-switch checkedChildren="Yes" unCheckedChildren="No" v-model="model.alwaysShow" />
</a-form-model-item>
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="Open Type">
<a-form-model-item v-show="show" :labelCol="labelCol" :wrapperCol="wrapperCol" label="Open Type">
<a-switch checkedChildren="External" unCheckedChildren="Internal" v-model="model.internalOrExternal" />
</a-form-model-item>
</a-form-model>
<!-- 选择图标 -->
<icons @choose="handleIconChoose" @close="handleIconCancel" :iconChooseVisible="iconChooseVisible"></icons>
</a-spin>
<a-row :style="{ textAlign: 'right' }">
<a-button :style="{marginRight: '8px'}" @click="handleCancel" type="warn">
Cancel
</a-button>
<a-button :style="{ marginRight: '8px' }" @click="handleCancel" type="warn"> Cancel </a-button>
<a-button :disabled="disableSubmit" @click="handleOk" type="primary">Ok</a-button>
</a-row>
</div>
@ -180,13 +124,13 @@
import Icons from './icon/Icons'
export default {
name: "PermissionModal",
name: 'PermissionModal',
components: { Icons },
data() {
return {
drawerWidth: 700,
treeData: [],
title:"操作",
title: '操作',
visible: false,
disableSubmit: false,
model: {},
@ -202,7 +146,7 @@
},
confirmLoading: false,
iconChooseVisible: false,
validateStatus:""
validateStatus: '',
}
},
computed: {
@ -212,82 +156,83 @@
component: [{ required: this.show, message: 'Please Enter Component' }],
url: [{ required: this.show, message: 'Plaase Enter Route Path' }],
permsType: [{ required: true, message: 'Please Enter Auth Category' }],
perms:[{ required: false, message: 'Please Enter Perms' },{validator: this.validatePerms }]
}
perms: [{ required: false, message: 'Please Enter Perms' }, { validator: this.validatePerms }],
}
},
created () {
},
created() {},
methods: {
loadTree() {
var that = this;
var that = this
queryTreeList().then((res) => {
if (res.success) {
console.log(res)
that.treeData = [];
that.treeData = []
let treeList = res.result.treeList
for (let a = 0; a < treeList.length; a++) {
let temp = treeList[a];
temp.isLeaf = temp.leaf;
that.treeData.push(temp);
let temp = treeList[a]
temp.isLeaf = temp.leaf
that.treeData.push(temp)
}
}
});
})
},
add() {
//
this.edit({status:'1', permsType:'1', sortNo:1.0, route:true, menuType:0,component:'layouts/RouteView' });
this.edit({ status: '1', permsType: '1', sortNo: 1.0, route: true, menuType: 0, component: 'layouts/RouteView' })
},
edit(record) {
this.resetScreenSize(); // ,
this.model = Object.assign({}, record);
this.resetScreenSize() // ,
this.model = Object.assign({}, record)
//
console.log('record: ', record)
this.show = record.menuType==2?false:true;
this.menuLabel = record.menuType==2?'Button/Permission':'Menu Name';
this.show = record.menuType == 2 ? false : true
this.menuLabel = record.menuType == 2 ? 'Button/Permission' : 'Menu Name'
this.visible = true;
this.loadTree();
this.visible = true
this.loadTree()
},
close() {
this.$emit('close');
this.disableSubmit = false;
this.visible = false;
this.$refs.form.resetFields();
this.$emit('close')
this.disableSubmit = false
this.visible = false
this.$refs.form.resetFields()
},
handleOk() {
const that = this;
const that = this
//
this.$refs.form.validate(valid => {
this.$refs.form.validate((valid) => {
if (valid) {
if ((this.model.menuType == 1 || this.model.menuType == 2) && !this.model.parentId) {
that.validateStatus = 'error';
that.$message.error("Please Check The Form");
return;
that.validateStatus = 'error'
that.$message.error('Please Check The Form')
return
} else {
that.validateStatus = 'success';
that.validateStatus = 'success'
}
that.confirmLoading = true;
let obj;
that.confirmLoading = true
let obj
if (!this.model.id) {
obj = addPermission(this.model);
obj = addPermission(this.model)
} else {
obj = editPermission(this.model);
obj = editPermission(this.model)
}
obj.then((res) => {
obj
.then((res) => {
if (res.success) {
that.$message.success(res.message);
that.$emit('ok');
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message);
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false;
that.close();
});
})
.finally(() => {
that.confirmLoading = false
that.close()
})
} else {
return false;
return false
}
})
},
@ -296,9 +241,9 @@
},
validateNumber(rule, value, callback) {
if (!value || new RegExp(/^[0-9]*[1-9][0-9]*$/).test(value)) {
callback();
callback()
} else {
callback("Please Enter Positive Integer");
callback('Please Enter Positive Integer')
}
},
validatePerms(rule, value, callback) {
@ -308,13 +253,13 @@
tableName: 'sys_permission',
fieldName: 'perms',
fieldVal: value,
dataId: this.model.id
};
dataId: this.model.id,
}
duplicateCheck(params).then((res) => {
if (res.success) {
callback()
} else {
callback("Perms Already Exist")
callback('Perms Already Exist')
}
})
} else {
@ -323,24 +268,24 @@
},
onChangeMenuType(e) {
if (this.model.menuType == 2) {
this.show = false;
this.menuLabel = 'Menu/Permission';
this.show = false
this.menuLabel = 'Menu/Permission'
} else {
this.show = true;
this.menuLabel = 'Menu Name';
this.show = true
this.menuLabel = 'Menu Name'
}
//update-begin---author:wangshuai ---date:20220729 for[VUEN-1834]------------
if (!this.model.id) {
if (this.model.menuType === 1 && this.model.component === 'layouts/RouteView') {
this.model.component = ""
this.model.component = ''
}
}
//update-end---author:wangshuai ---date:20220729 for[VUEN-1834]--------------
this.$nextTick(() => {
this.$refs.form.validateField(['url','component']);
});
this.$refs.form.validateField(['url', 'component'])
})
},
selectIcons() {
this.iconChooseVisible = true
@ -355,24 +300,26 @@
},
// ,
resetScreenSize() {
let screenWidth = document.body.clientWidth;
let screenWidth = document.body.clientWidth
if (screenWidth < 500) {
this.drawerWidth = screenWidth;
this.drawerWidth = screenWidth
} else {
this.drawerWidth = 700;
this.drawerWidth = 700
}
},
handleParentIdChange(value) {
if (!value) {
this.validateStatus="error"
this.validateStatus = 'error'
} else {
this.validateStatus="success"
}
}
this.validateStatus = 'success'
}
},
},
}
</script>
<style scoped>
<style>
.ant-select-dropdown {
background-color: #03353f !important;
}
</style>