From fb08302aa9f046815d7aa9ad437dc640b56cc74d Mon Sep 17 00:00:00 2001 From: hwj Date: Wed, 8 Jul 2026 14:25:08 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E7=94=9F=E4=BA=A7=E8=AE=A1?= =?UTF-8?q?=E5=88=92-=E8=AF=A6=E6=83=85-=E7=A9=BA=E5=80=BC=E5=B1=95?= =?UTF-8?q?=E7=A4=BA'-'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BaogongRecordList.vue | 20 ++- src/views/mes/baogongrecord/index.vue | 18 ++- src/views/mes/plan/components/PlanDetail.vue | 128 +++++++++--------- 3 files changed, 86 insertions(+), 80 deletions(-) diff --git a/src/views/mes/baogongrecord/components/BaogongRecordList.vue b/src/views/mes/baogongrecord/components/BaogongRecordList.vue index 334d1cf8..5db3a005 100644 --- a/src/views/mes/baogongrecord/components/BaogongRecordList.vue +++ b/src/views/mes/baogongrecord/components/BaogongRecordList.vue @@ -2,22 +2,22 @@ - - - + + + - + @@ -52,6 +52,12 @@ const { t } = useI18n() // 国际化 const loading = ref(true) // 列表的加载中 const list = ref([]) // 列表的数据 const total = ref(0) // 列表的总页数 +const emptyText = '-' +const isEmptyValue = (value: unknown) => value === undefined || value === null || value === '' +const emptyTableFormatter = (_row: unknown, _column: unknown, cellValue: unknown) => + isEmptyValue(cellValue) ? emptyText : String(cellValue) +const dateEmptyFormatter = (row: any, column: any, cellValue: unknown) => + isEmptyValue(cellValue) ? emptyText : dateFormatter(row, column, cellValue) const queryParams = reactive({ pageNo: 1, pageSize: 10, @@ -79,4 +85,4 @@ const getList = async () => { onMounted(() => { getList() }) - \ No newline at end of file + diff --git a/src/views/mes/baogongrecord/index.vue b/src/views/mes/baogongrecord/index.vue index 487ca68b..eab5ac53 100644 --- a/src/views/mes/baogongrecord/index.vue +++ b/src/views/mes/baogongrecord/index.vue @@ -75,21 +75,21 @@ - - - + + + @@ -141,6 +141,12 @@ const { t } = useI18n() // 国际化 const loading = ref(true) // 列表的加载中 const list = ref([]) // 列表的数据 const total = ref(0) // 列表的总页数 +const emptyText = '-' +const isEmptyValue = (value: unknown) => value === undefined || value === null || value === '' +const emptyTableFormatter = (_row: unknown, _column: unknown, cellValue: unknown) => + isEmptyValue(cellValue) ? emptyText : String(cellValue) +const dateEmptyFormatter = (row: any, column: any, cellValue: unknown) => + isEmptyValue(cellValue) ? emptyText : dateFormatter(row, column, cellValue) const tableRef = ref() const planTableMaxHeight = ref(520) const planPaginationRef = ref() @@ -233,4 +239,4 @@ onMounted(() => { onBeforeUnmount(() => { window.removeEventListener("resize", updatePlanTableMaxHeight) }) - \ No newline at end of file + diff --git a/src/views/mes/plan/components/PlanDetail.vue b/src/views/mes/plan/components/PlanDetail.vue index bc1709a7..84902fb4 100644 --- a/src/views/mes/plan/components/PlanDetail.vue +++ b/src/views/mes/plan/components/PlanDetail.vue @@ -17,23 +17,10 @@ v-loading="formLoading" > - + - - - + - + - + + {{ emptyText }} @@ -60,7 +48,6 @@ @@ -72,20 +59,22 @@ class="process-route-items-table" :empty-text="t('ProductionPlan.Plan.dialogProcessRouteEmptyText')" > - + - + - + - - - - - + + + + + import { LineChangeRecordBatchVO, PlanApi, PlanProcessRouteItemVO, PlanVO } from '@/api/mes/plan' import { TaskApi, TaskDetailVO } from '@/api/mes/task' -import { dateFormatter2 } from '@/utils/formatTime' import BaogongRecordList from '@/views/mes/baogongrecord/components/BaogongRecordList.vue' import dayjs from 'dayjs' @@ -213,6 +180,22 @@ const lineChangeRecordQueryParams = reactive({ pageSize: 10 }) +const emptyText = '-' + +const isEmptyValue = (value: unknown) => value === undefined || value === null || value === '' + +const formatEmptyText = (value: unknown) => (isEmptyValue(value) ? emptyText : String(value)) + +const formatDateText = (value: unknown) => { + if (isEmptyValue(value)) return emptyText + const date = dayjs(value) + if (!date.isValid()) return formatEmptyText(value) + return date.format('YYYY-MM-DD') +} + +const emptyTableFormatter = (_row: unknown, _column: unknown, cellValue: unknown) => formatEmptyText(cellValue) +const dateEmptyTableFormatter = (_row: unknown, _column: unknown, cellValue: unknown) => formatDateText(cellValue) + type PlanDetailFormData = Partial & { workerId?: number groupType?: number | string @@ -259,19 +242,23 @@ const formData = ref({ const deliveryDateText = computed(() => { const sourceValue = formData.value.deliveryDate ?? formData.value.finishDate - if (!sourceValue) return '' - const value = dayjs(sourceValue) - if (!value.isValid()) return String(sourceValue) - return value.format('YYYY-MM-DD') + return formatDateText(sourceValue) +}) +const taskDetailDisplayText = computed(() => { + const taskDetailId = formData.value.taskDetailId + if (isEmptyValue(taskDetailId)) return emptyText + const item = taskDetailList.value.find((detail) => String(detail.id) === String(taskDetailId)) + if (!item) return formatEmptyText(taskDetailId) + return `${formatEmptyText(item.productName)}-${t('ProductionPlan.Plan.dialogTaskDetailUnplannedPrefix')}${Number(item.number || 0) - Number(item.planNumber || 0)}` }) const processRouteDisplayName = computed(() => { - if (!formData.value.processRouteId) return '' - return formData.value.processRouteName || String(formData.value.processRouteId) + if (isEmptyValue(formData.value.processRouteId)) return emptyText + return formatEmptyText(formData.value.processRouteName || formData.value.processRouteId) }) const getRouteItemDeviceDisplay = (row: PlanProcessRouteItemVO) => { - if (!row?.deviceId) return '' - return row.deviceName || String(row.deviceId) + if (!row?.deviceId) return emptyText + return formatEmptyText(row.deviceName || row.deviceId) } const getLineChangeBatchRowKey = (row: LineChangeRecordBatchVO) => { @@ -372,4 +359,11 @@ const resetForm = () => { .plan-detail-drawer :deep(.el-drawer__body) { padding-top: 0; } - \ No newline at end of file + +.empty-inline-text { + display: inline-flex; + align-items: center; + min-height: 32px; + color: var(--el-disabled-text-color); +} +