diff --git a/src/views/mes/taskManagement/index.vue b/src/views/mes/taskManagement/index.vue index b3f2246c..6974a430 100644 --- a/src/views/mes/taskManagement/index.vue +++ b/src/views/mes/taskManagement/index.vue @@ -38,6 +38,25 @@ + + + + + @@ -86,6 +105,16 @@ prop="name" min-width="200" sortable /> + + + ([]) +const deviceOptions = ref<{ id: number; label: string; raw?: DeviceLedgerVO }[]>([]) const queryParams = reactive({ pageNo: 1, pageSize: 10, name: undefined as string | undefined, taskType: undefined as number | undefined, - projectForm: [] as string[] + projectForm: [] as string[], + deviceIds: [] as number[] }) const queryFormRef = ref() @@ -263,6 +295,30 @@ const ensurePlanOptionsLoaded = async () => { planOptions.value = (planRes?.list ?? []) as PlanOption[] } +const ensureDeviceOptionsLoaded = async () => { + const deviceRes = await DeviceLedgerApi.getDeviceLedgerList() + const rows = (Array.isArray(deviceRes) ? deviceRes : deviceRes?.list ?? deviceRes?.data ?? []) as DeviceLedgerVO[] + deviceOptions.value = rows + .filter((item) => typeof item?.id === 'number') + .map((item) => ({ + id: item.id, + label: `${item.deviceCode ?? ''} ${item.deviceName ?? ''}`.trim() || String(item.id), + raw: item + })) +} + +const getDeviceNames = (value: any) => { + const ids = parseIdsValue(value) + if (!ids.length) return '-' + const names = ids + .map((id) => { + const option = deviceOptions.value.find((item) => String(item.id) === id) + return option?.raw?.deviceName ?? option?.label?.split(' ').slice(1).join(' ') ?? id + }) + .filter(Boolean) + return names.length ? names.join(',') : '-' +} + const buildQueryParams = () => { return { ...queryParams, @@ -370,6 +426,6 @@ const handleExport = async () => { } onMounted(() => { - Promise.all([ensurePlanOptionsLoaded(), getList()]) + Promise.all([ensurePlanOptionsLoaded(), ensureDeviceOptionsLoaded(), getList()]) })