style: 修改系统管理中菜单管理的新增/编辑弹框样式

main
zhongwenkai 1 week ago
parent 951a851d1a
commit 19ff5a4775

@ -1,13 +1,19 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="auto"
class="system-menu-form"
>
<div class="system-menu-panel">
<div class="system-menu-panel__header">
<div class="system-menu-panel__title">{{ dialogTitle }}</div>
<el-button text @click="closeForm">
<Icon icon="ep:close" />
</el-button>
</div>
<div class="system-menu-dialog" v-loading="formLoading">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="auto"
class="system-menu-form"
>
<el-form-item :label="t('SystemManagement.Menu.parent')">
<el-tree-select
v-model="formData.parentId"
@ -111,11 +117,12 @@
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
</div>
<div class="system-menu-footer">
<el-button @click="closeForm">{{ t('common.cancel') }}</el-button>
<el-button :disabled="formLoading" type="primary" @click="submitForm">{{ t('common.ok') }}</el-button>
<el-button @click="dialogVisible = false">{{ t('common.cancel') }}</el-button>
</template>
</Dialog>
</div>
</div>
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
@ -131,7 +138,6 @@ const { wsCache } = useCache()
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
@ -164,7 +170,6 @@ const formRef = ref() // 表单 Ref
/** 打开弹窗 */
const open = async (type: string, id?: number, parentId?: number, currentClientType?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
clientType.value = currentClientType ?? 1
@ -187,7 +192,7 @@ const open = async (type: string, id?: number, parentId?: number, currentClientT
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const emit = defineEmits(['success', 'closed']) // success closed
const submitForm = async () => {
//
if (!formRef) return
@ -219,7 +224,7 @@ const submitForm = async () => {
await MenuApi.updateMenu(data as unknown as MenuApi.MenuVO)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
closeForm()
//
emit('success')
} finally {
@ -239,6 +244,10 @@ const getTree = async () => {
menuTree.value.push(menu)
}
const closeForm = () => {
emit('closed')
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
@ -267,3 +276,57 @@ const isExternal = (path: string) => {
return /^(https?:|mailto:|tel:)/.test(path)
}
</script>
<style lang="scss" scoped>
.system-menu-panel {
background: #fff;
border-radius: 12px;
box-shadow: var(--el-box-shadow-light);
}
.system-menu-panel__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid #ebeef5;
}
.system-menu-panel__title {
color: #1f2937;
font-size: 18px;
font-weight: 600;
}
.system-menu-dialog {
max-height: calc(100vh - 220px);
padding: 20px 20px 0;
padding-right: 16px;
overflow-y: auto;
}
.system-menu-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
padding: 16px 20px 20px;
border-top: 1px solid #ebeef5;
}
@media (max-width: 768px) {
.system-menu-panel__header {
padding: 14px 16px;
}
.system-menu-dialog {
max-height: none;
padding: 16px 16px 0;
overflow-y: visible;
}
.system-menu-footer {
padding: 16px;
}
}
</style>

@ -1,4 +1,6 @@
<template>
<div class="system-menu-page">
<div v-show="!formVisible">
<!-- Tabs 切换 Web/APP -->
<ContentWrap>
<el-tabs v-model="activeClientType" @tab-change="handleClientTypeChange">
@ -134,9 +136,11 @@
</el-table-column>
</el-table>
</ContentWrap>
</div>
<!-- 表单弹窗添加/修改 -->
<MenuForm ref="formRef" @success="getList" />
<!-- 表单添加/修改 -->
<MenuForm v-show="formVisible" ref="formRef" @success="getList" @closed="formVisible = false" />
</div>
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
@ -195,7 +199,10 @@ const resetQuery = () => {
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number, parentId?: number) => {
const formVisible = ref(false)
const openForm = async (type: string, id?: number, parentId?: number) => {
formVisible.value = true
await nextTick()
formRef.value.open(type, id, parentId, activeClientType.value)
}

Loading…
Cancel
Save