style: 修改模具管理中模具管理的新增/编辑弹框样式

main
zhongwenkai 1 week ago
parent 772cbdbb32
commit 951a851d1a

@ -1,12 +1,18 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="120px"
v-loading="formLoading"
>
<div class="mold-panel">
<div class="mold-panel__header">
<div class="mold-panel__title">{{ dialogTitle }}</div>
<el-button text @click="closeForm">
<Icon icon="ep:close" />
</el-button>
</div>
<div class="mold-dialog" v-loading="formLoading">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="120px"
>
<el-form-item :label="t('MoldManagement.Mold.code')" prop="code">
<el-row :gutter="10" style="width: 100%">
<el-col :xs="24" :sm="18" :md="16" :lg="14" :xl="12">
@ -128,13 +134,14 @@
<UploadFile v-model="formData.fileUrl" :limit="1" :isShowTip="false"/>
</el-form-item>
</el-form>
<template #footer>
</div>
<div class="mold-footer">
<el-button @click="closeForm">{{ t('dialog.close') }}</el-button>
<el-button @click="submitForm" type="primary" :disabled="formLoading">
{{ t('action.save') }}
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</div>
</div>
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE, getBoolDictOptions } from '@/utils/dict'
@ -146,7 +153,6 @@ const unitList = ref<ProductUnitVO[]>([]) // 产品单位列表
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
@ -203,7 +209,6 @@ const formRef = ref() // 表单 Ref
/** 打开弹窗 */
const open = async (type: string, id?: number, brandId: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
@ -270,7 +275,7 @@ const handleQrcodeRefreshSuccess = async (data: any) => {
}
/** 提交表单 */
const emit = defineEmits(['success']) // success
const emit = defineEmits(['success', 'closed']) // success closed
const submitForm = async () => {
//
await formRef.value.validate()
@ -286,7 +291,7 @@ const submitForm = async () => {
await MoldBrandApi.updateMold(updateData)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
closeForm()
//
emit('success')
} finally {
@ -294,6 +299,10 @@ const submitForm = async () => {
}
}
const closeForm = () => {
emit('closed')
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
@ -316,5 +325,58 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
</script>
<style scoped lang="scss"></style>
<style lang="scss" scoped>
.mold-panel {
background: #fff;
border-radius: 12px;
box-shadow: var(--el-box-shadow-light);
}
.mold-panel__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid #ebeef5;
}
.mold-panel__title {
color: #1f2937;
font-size: 18px;
font-weight: 600;
}
.mold-dialog {
max-height: calc(100vh - 220px);
padding: 20px 20px 0;
padding-right: 16px;
overflow-y: auto;
}
.mold-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
padding: 16px 20px 20px;
border-top: 1px solid #ebeef5;
}
@media (max-width: 768px) {
.mold-panel__header {
padding: 14px 16px;
}
.mold-dialog {
max-height: none;
padding: 16px 16px 0;
overflow-y: visible;
}
.mold-footer {
padding: 16px;
}
}
</style>

@ -1,5 +1,5 @@
<template>
<div class="device-ledger-layout">
<div v-show="!formVisible" class="device-ledger-layout">
<ContentWrap class="device-ledger-left">
<el-tree
v-loading="typeTreeLoading" :data="brandTreeData" node-key="id" highlight-current :props="typeTreeProps"
@ -101,9 +101,8 @@ type="success" plain @click="handleExport" :loading="exportLoading"
</div>
</div>
<!-- 表单弹窗添加/修改 -->
<!-- 表单弹窗添加/修改 -->
<MoldForm ref="formRef" @success="getList" />
<!-- 表单添加/修改 -->
<MoldForm v-show="formVisible" ref="formRef" @success="getList" @closed="formVisible = false" />
<!-- 表单弹窗添加/修改 -->
<MoldRecordForm ref="recordFormRef" @success="getList" />
@ -223,11 +222,14 @@ const resetQuery = () => {
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
const formVisible = ref(false)
const openForm = async (type: string, id?: number) => {
if (type == 'create' && !queryParams.brand) {
message.error('请选择一个模具型号')
return
}
formVisible.value = true
await nextTick()
formRef.value.open(type, id, queryParams.brand)
}

Loading…
Cancel
Save