|
|
|
|
@ -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) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
|
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>
|
|
|
|
|
|