fix(material): 修复物料管理中的字典类型和表单验证问题

This commit is contained in:
zxy 2026-05-07 17:02:24 +08:00
parent 97008f1d5d
commit a9e6b2eb28
3 changed files with 15 additions and 10 deletions

View File

@ -114,8 +114,8 @@ const formData = ref({
schemeId: undefined, schemeId: undefined,
}) })
const validateSafeStock = (rule: any, value: number, callback: any) => { const validateSafeStock = (_rule: any, value: number, callback: any) => {
if (value === undefined || value === null || value === '') { if (value === undefined || value === null ) {
callback() callback()
return return
} }
@ -149,20 +149,25 @@ const open = async (type: string, id?: number) => {
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
resetForm() //
//
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await MaterialApi.getMaterial(id) const data = await MaterialApi.getMaterial(id)
// //
if (formData.value.schemeId) { if (data.schemeId) {
const inspPlan = await InspPlanApi.getInspPlan(formData.value.schemeId) const inspPlan = await InspPlanApi.getInspPlan(data.schemeId)
schemeName.value = inspPlan.schemeName schemeName.value = inspPlan.schemeName
} }
//
resetForm()
formData.value = data
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
} else {
//
resetForm()
} }
} }
/** 打开质检方案选择弹窗 */ /** 打开质检方案选择弹窗 */

View File

@ -34,7 +34,7 @@
class="!w-240px" class="!w-240px"
> >
<el-option <el-option
v-for="dict in getStrDictOptions(DICT_TYPE.MAT_TYPE)" v-for="dict in getIntDictOptions(DICT_TYPE.MAT_TYPE)"
:key="dict.value" :key="dict.value"
:label="dict.label" :label="dict.label"
:value="dict.value" :value="dict.value"
@ -85,7 +85,7 @@
<el-table-column label="单位" align="center" prop="unit" > <el-table-column label="单位" align="center" prop="unit" >
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.UNIT" :value="scope.row.unit" /> <dict-tag :type="DICT_TYPE.MAT_UNIT" :value="scope.row.unit" />
</template> </template>
</el-table-column> </el-table-column>

View File

@ -98,7 +98,7 @@ import { dateFormatter } from '@/utils/formatTime'
import * as ProLineApi from '@/api/biz/proline' import * as ProLineApi from '@/api/biz/proline'
import ProLineForm from './ProLineForm.vue' import ProLineForm from './ProLineForm.vue'
defineOptions({ name: 'Proline' }) defineOptions({ name: 'ProLine' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //