|
|
|
|
@ -232,19 +232,10 @@ const productOptions = ref<SelectOption<string>[]>([])
|
|
|
|
|
const deviceLoading = ref(false)
|
|
|
|
|
const deviceOptions = ref<SelectOption<string>[]>([])
|
|
|
|
|
const recipeTypeLoading = ref(false)
|
|
|
|
|
const recipeTypeOptions = ref<SelectOption<number>[]>([])
|
|
|
|
|
|
|
|
|
|
const recipeTypeLabelMap = computed<Record<number, string>>(() => {
|
|
|
|
|
return recipeTypeOptions.value.reduce((acc, cur) => {
|
|
|
|
|
acc[cur.value] = cur.label
|
|
|
|
|
return acc
|
|
|
|
|
}, {} as Record<number, string>)
|
|
|
|
|
})
|
|
|
|
|
const recipeTypeOptions = ref<SelectOption<string>[]>([])
|
|
|
|
|
|
|
|
|
|
const getRecipeTypeLabel = (value: unknown) => {
|
|
|
|
|
const num = Number(value)
|
|
|
|
|
if (!Number.isNaN(num) && recipeTypeLabelMap.value[num]) return recipeTypeLabelMap.value[num]
|
|
|
|
|
return (value as any) ?? ''
|
|
|
|
|
return value === undefined || value === null ? '' : String(value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getProductOptions = async () => {
|
|
|
|
|
@ -270,11 +261,8 @@ const getDeviceOptions = async () => {
|
|
|
|
|
const getRecipeTypeOptions = async () => {
|
|
|
|
|
recipeTypeLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await RecipeApi.getRecipePage(undefined)
|
|
|
|
|
recipeTypeOptions.value = (data?.list ?? []).map((item: any) => ({
|
|
|
|
|
label: item.name,
|
|
|
|
|
value: item.id
|
|
|
|
|
}))
|
|
|
|
|
const data = await RecipeApi.getRecipePage()
|
|
|
|
|
recipeTypeOptions.value = (data?.list ?? []).map((item: any) => ({ label: item.name, value: item.name }))
|
|
|
|
|
} finally {
|
|
|
|
|
recipeTypeLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
@ -296,7 +284,7 @@ const dialogForm = reactive({
|
|
|
|
|
id: undefined as number | undefined,
|
|
|
|
|
recipeCode: '',
|
|
|
|
|
name: '',
|
|
|
|
|
recipeType: undefined as number | undefined,
|
|
|
|
|
recipeType: '' as string | undefined,
|
|
|
|
|
productName: '' as string | undefined,
|
|
|
|
|
machineName: '' as string | undefined,
|
|
|
|
|
recipeDesc: ''
|
|
|
|
|
@ -319,7 +307,7 @@ const openDialog = async (mode: DialogMode, row?: RecipeConfigVO) => {
|
|
|
|
|
dialogForm.id = undefined
|
|
|
|
|
dialogForm.recipeCode = ''
|
|
|
|
|
dialogForm.name = ''
|
|
|
|
|
dialogForm.recipeType = undefined
|
|
|
|
|
dialogForm.recipeType = ''
|
|
|
|
|
dialogForm.productName = ''
|
|
|
|
|
dialogForm.machineName = ''
|
|
|
|
|
dialogForm.recipeDesc = ''
|
|
|
|
|
@ -329,7 +317,7 @@ const openDialog = async (mode: DialogMode, row?: RecipeConfigVO) => {
|
|
|
|
|
dialogForm.id = row?.id
|
|
|
|
|
dialogForm.recipeCode = row?.recipeCode ?? ''
|
|
|
|
|
dialogForm.name = row?.name ?? row?.recipeName ?? ''
|
|
|
|
|
dialogForm.recipeType = typeof row?.recipeType === 'number' ? row.recipeType : Number(row?.recipeType) || undefined
|
|
|
|
|
dialogForm.recipeType = row?.recipeType === undefined || row?.recipeType === null ? '' : String(row.recipeType)
|
|
|
|
|
dialogForm.productName = row?.productName ?? ''
|
|
|
|
|
dialogForm.machineName = row?.machineName ?? row?.deviceName ?? ''
|
|
|
|
|
dialogForm.recipeDesc = row?.recipeDesc ?? row?.remark ?? ''
|
|
|
|
|
|