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

View File

@ -34,7 +34,7 @@
class="!w-240px"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.MAT_TYPE)"
v-for="dict in getIntDictOptions(DICT_TYPE.MAT_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -85,7 +85,7 @@
<el-table-column label="单位" align="center" prop="unit" >
<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>
</el-table-column>

View File

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