|
|
|
|
@ -155,9 +155,9 @@ ref="detailRef" :visible="detailVisible"
|
|
|
|
|
clearable
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeConfig.dialogRecipeTypeLabel')" prop="recipeType">
|
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeConfig.dialogRecipeTypeLabel')" prop="recipeTypeId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="dialogForm.recipeType"
|
|
|
|
|
v-model="dialogForm.recipeTypeId"
|
|
|
|
|
:placeholder="t('RecipeManagement.RecipeConfig.dialogRecipeTypePlaceholder')"
|
|
|
|
|
clearable
|
|
|
|
|
filterable
|
|
|
|
|
@ -167,9 +167,9 @@ ref="detailRef" :visible="detailVisible"
|
|
|
|
|
<el-option v-for="item in recipeTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeConfig.dialogProductNameLabel')" prop="productName">
|
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeConfig.dialogProductNameLabel')" prop="productId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="dialogForm.productName"
|
|
|
|
|
v-model="dialogForm.productId"
|
|
|
|
|
:placeholder="t('RecipeManagement.RecipeConfig.dialogProductNamePlaceholder')"
|
|
|
|
|
clearable
|
|
|
|
|
filterable
|
|
|
|
|
@ -179,9 +179,9 @@ ref="detailRef" :visible="detailVisible"
|
|
|
|
|
<el-option v-for="item in productOptions" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeConfig.dialogMachineNameLabel')" prop="machineName">
|
|
|
|
|
<el-form-item :label="t('RecipeManagement.RecipeConfig.dialogMachineNameLabel')" prop="machineId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="dialogForm.machineName"
|
|
|
|
|
v-model="dialogForm.machineId"
|
|
|
|
|
:placeholder="t('RecipeManagement.RecipeConfig.dialogMachineNamePlaceholder')"
|
|
|
|
|
clearable
|
|
|
|
|
filterable
|
|
|
|
|
@ -390,14 +390,18 @@ const recipeTypeLoading = ref(false)
|
|
|
|
|
const recipeTypeOptions = ref<SelectOption<string>[]>([])
|
|
|
|
|
|
|
|
|
|
const getRecipeTypeLabel = (value: unknown) => {
|
|
|
|
|
return value === undefined || value === null ? '' : String(value)
|
|
|
|
|
if (value === undefined || value === null || value === '') return ''
|
|
|
|
|
const matched = recipeTypeOptions.value.find(
|
|
|
|
|
(item) => item.value === value || String(item.value) === String(value) || item.label === value
|
|
|
|
|
)
|
|
|
|
|
return matched?.label ?? String(value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getProductOptions = async () => {
|
|
|
|
|
productLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await ProductApi.getProductSimpleList()
|
|
|
|
|
productOptions.value = (data ?? []).map((item: any) => ({ label: item.name, value: item.name }))
|
|
|
|
|
productOptions.value = (data ?? []).map((item: any) => ({ label: item.name, value: item.id }))
|
|
|
|
|
} finally {
|
|
|
|
|
productLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
@ -407,7 +411,7 @@ const getDeviceOptions = async () => {
|
|
|
|
|
deviceLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await DeviceApi.getDeviceList()
|
|
|
|
|
deviceOptions.value = (data ?? []).map((item: any) => ({ label: item.deviceName, value: item.deviceName }))
|
|
|
|
|
deviceOptions.value = (data ?? []).map((item: any) => ({ label: item.deviceName, value: item.id }))
|
|
|
|
|
} finally {
|
|
|
|
|
deviceLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
@ -417,7 +421,7 @@ const getRecipeTypeOptions = async () => {
|
|
|
|
|
recipeTypeLoading.value = true
|
|
|
|
|
try {
|
|
|
|
|
const data = await RecipeApi.getRecipePage({})
|
|
|
|
|
recipeTypeOptions.value = (data?.list ?? []).map((item: any) => ({ label: item.name, value: item.name }))
|
|
|
|
|
recipeTypeOptions.value = (data?.list ?? []).map((item: any) => ({ label: item.name, value: item.id }))
|
|
|
|
|
} finally {
|
|
|
|
|
recipeTypeLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
@ -443,9 +447,9 @@ const dialogForm = reactive({
|
|
|
|
|
id: undefined as number | undefined,
|
|
|
|
|
recipeCode: '',
|
|
|
|
|
name: '',
|
|
|
|
|
recipeType: '' as string | undefined,
|
|
|
|
|
productName: '' as string | undefined,
|
|
|
|
|
machineName: '' as string | undefined,
|
|
|
|
|
recipeTypeId: '' as string | number | undefined,
|
|
|
|
|
productId: '' as string | number | undefined,
|
|
|
|
|
machineId: '' as string | number | undefined,
|
|
|
|
|
recipeDesc: ''
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
@ -478,9 +482,9 @@ const openDialog = async (mode: DialogMode, row?: RecipeConfigVO) => {
|
|
|
|
|
dialogForm.id = undefined
|
|
|
|
|
dialogForm.recipeCode = ''
|
|
|
|
|
dialogForm.name = ''
|
|
|
|
|
dialogForm.recipeType = ''
|
|
|
|
|
dialogForm.productName = ''
|
|
|
|
|
dialogForm.machineName = ''
|
|
|
|
|
dialogForm.recipeTypeId = ''
|
|
|
|
|
dialogForm.productId = ''
|
|
|
|
|
dialogForm.machineId = ''
|
|
|
|
|
dialogForm.recipeDesc = ''
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
@ -488,9 +492,23 @@ const openDialog = async (mode: DialogMode, row?: RecipeConfigVO) => {
|
|
|
|
|
dialogForm.id = row?.id
|
|
|
|
|
dialogForm.recipeCode = row?.recipeCode ?? ''
|
|
|
|
|
dialogForm.name = row?.name ?? row?.recipeName ?? ''
|
|
|
|
|
dialogForm.recipeType = row?.recipeType === undefined || row?.recipeType === null ? '' : String(row.recipeType)
|
|
|
|
|
dialogForm.productName = row?.productName ?? ''
|
|
|
|
|
dialogForm.machineName = row?.machineName ?? row?.deviceName ?? ''
|
|
|
|
|
dialogForm.recipeTypeId =
|
|
|
|
|
(row as any)?.recipeTypeId ??
|
|
|
|
|
(row?.recipeType === undefined || row?.recipeType === null ? '' : (row as any).recipeType)
|
|
|
|
|
|
|
|
|
|
const findProductValueByName = (name: string | undefined) => {
|
|
|
|
|
if (!name) return ''
|
|
|
|
|
const matched = productOptions.value.find((o) => o.label === name || String(o.value) === String((row as any)?.productId))
|
|
|
|
|
return matched?.value ?? ''
|
|
|
|
|
}
|
|
|
|
|
const findDeviceValueByName = (name: string | undefined) => {
|
|
|
|
|
if (!name) return ''
|
|
|
|
|
const matched = deviceOptions.value.find((o) => o.label === name || String(o.value) === String((row as any)?.machineId ?? (row as any)?.deviceId))
|
|
|
|
|
return matched?.value ?? ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dialogForm.productId = (row as any)?.productId ?? findProductValueByName(row?.productName)
|
|
|
|
|
dialogForm.machineId = (row as any)?.machineId ?? (row as any)?.deviceId ?? findDeviceValueByName(row?.machineName ?? row?.deviceName)
|
|
|
|
|
dialogForm.recipeDesc = row?.recipeDesc ?? row?.remark ?? ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -503,9 +521,9 @@ const submitDialog = async () => {
|
|
|
|
|
id: dialogForm.id,
|
|
|
|
|
recipeCode: dialogForm.recipeCode,
|
|
|
|
|
name: dialogForm.name,
|
|
|
|
|
recipeType: dialogForm.recipeType,
|
|
|
|
|
productName: dialogForm.productName,
|
|
|
|
|
machineName: dialogForm.machineName,
|
|
|
|
|
recipeTypeId: dialogForm.recipeTypeId,
|
|
|
|
|
productId: dialogForm.productId,
|
|
|
|
|
machineId: dialogForm.machineId,
|
|
|
|
|
recipeDesc: dialogForm.recipeDesc
|
|
|
|
|
}
|
|
|
|
|
if (dialogMode.value === 'create') {
|
|
|
|
|
|