From 0d93ec4c10d146ffe287e7f4430ee66ad5832a17 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 10 四月 2026 16:08:20 +0800
Subject: [PATCH] #页面优化
---
rsf-design/src/views/basic-info/bas-station/basStationPage.helpers.js | 267 ++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 230 insertions(+), 37 deletions(-)
diff --git a/rsf-design/src/views/basic-info/bas-station/basStationPage.helpers.js b/rsf-design/src/views/basic-info/bas-station/basStationPage.helpers.js
index 6750a27..b8a49d8 100644
--- a/rsf-design/src/views/basic-info/bas-station/basStationPage.helpers.js
+++ b/rsf-design/src/views/basic-info/bas-station/basStationPage.helpers.js
@@ -91,9 +91,14 @@
stationId: '',
type: '',
useStatus: '',
+ inAble: '',
+ outAble: '',
area: '',
isCrossZone: '',
+ crossZoneArea: '',
isWcs: '',
+ wcsData: '',
+ containerType: '',
barcode: '',
autoTransfer: '',
status: '',
@@ -122,6 +127,25 @@
outAble: 0,
status: 1,
memo: ''
+ }
+}
+
+export function createBasStationInitState() {
+ return {
+ type: 0,
+ useStatus: '',
+ areaIds: [],
+ containerTypes: [],
+ inAble: 0,
+ outAble: 0,
+ rows: [createBasStationInitRow()]
+ }
+}
+
+export function createBasStationInitRow() {
+ return {
+ stationName: '',
+ stationId: ''
}
}
@@ -203,6 +227,14 @@
? Number(params.type)
: void 0,
useStatus: normalizeText(params.useStatus),
+ inAble:
+ params.inAble !== undefined && params.inAble !== null && params.inAble !== ''
+ ? Number(params.inAble)
+ : void 0,
+ outAble:
+ params.outAble !== undefined && params.outAble !== null && params.outAble !== ''
+ ? Number(params.outAble)
+ : void 0,
area:
params.area !== undefined && params.area !== null && params.area !== ''
? Number(params.area)
@@ -211,13 +243,23 @@
params.isCrossZone !== undefined && params.isCrossZone !== null && params.isCrossZone !== ''
? Number(params.isCrossZone)
: void 0,
+ crossZoneArea: normalizeText(params.crossZoneArea),
isWcs:
params.isWcs !== undefined && params.isWcs !== null && params.isWcs !== ''
? Number(params.isWcs)
: void 0,
+ wcsData: normalizeText(params.wcsData),
+ containerType:
+ params.containerType !== undefined &&
+ params.containerType !== null &&
+ params.containerType !== ''
+ ? Number(params.containerType)
+ : void 0,
barcode: normalizeText(params.barcode),
autoTransfer:
- params.autoTransfer !== undefined && params.autoTransfer !== null && params.autoTransfer !== ''
+ params.autoTransfer !== undefined &&
+ params.autoTransfer !== null &&
+ params.autoTransfer !== ''
? Number(params.autoTransfer)
: void 0,
status:
@@ -230,7 +272,9 @@
}
return Object.fromEntries(
- Object.entries(searchParams).filter(([, value]) => value !== '' && value !== void 0 && value !== null)
+ Object.entries(searchParams).filter(
+ ([, value]) => value !== '' && value !== void 0 && value !== null
+ )
)
}
@@ -238,6 +282,7 @@
return {
current: params.current || 1,
pageSize: params.pageSize || params.size || 20,
+ orderBy: normalizeText(params.orderBy) || 'create_time desc',
...buildBasStationSearchParams(params)
}
}
@@ -256,10 +301,14 @@
? { area: Number(formData.area) }
: {}),
useStatus: normalizeText(formData.useStatus) || '',
- ...(formData.isCrossZone !== void 0 && formData.isCrossZone !== null && formData.isCrossZone !== ''
+ ...(formData.isCrossZone !== void 0 &&
+ formData.isCrossZone !== null &&
+ formData.isCrossZone !== ''
? { isCrossZone: Number(formData.isCrossZone) }
: {}),
- ...(normalizeIdArray(formData.areaIds).length ? { areaIds: normalizeIdArray(formData.areaIds).map((item) => item.id) } : {}),
+ ...(normalizeIdArray(formData.areaIds).length
+ ? { areaIds: normalizeIdArray(formData.areaIds).map((item) => item.id) }
+ : {}),
...(formData.isWcs !== void 0 && formData.isWcs !== null && formData.isWcs !== ''
? { isWcs: Number(formData.isWcs) }
: {}),
@@ -268,7 +317,9 @@
? { containerTypes: normalizePlainIdArray(formData.containerTypes) }
: {}),
barcode: normalizeText(formData.barcode) || '',
- ...(formData.autoTransfer !== void 0 && formData.autoTransfer !== null && formData.autoTransfer !== ''
+ ...(formData.autoTransfer !== void 0 &&
+ formData.autoTransfer !== null &&
+ formData.autoTransfer !== ''
? { autoTransfer: Number(formData.autoTransfer) }
: {}),
...(formData.inAble !== void 0 && formData.inAble !== null && formData.inAble !== ''
@@ -288,7 +339,9 @@
export function createBasStationDialogModel(record = {}) {
return {
...createBasStationFormState(),
- ...(record.id !== void 0 && record.id !== null && record.id !== '' ? { id: Number(record.id) } : {}),
+ ...(record.id !== void 0 && record.id !== null && record.id !== ''
+ ? { id: Number(record.id) }
+ : {}),
stationName: normalizeText(record.stationName || ''),
stationId: normalizeText(record.stationId || ''),
type:
@@ -310,13 +363,18 @@
? Number(record.isWcs)
: 0,
wcsData: normalizeText(record.wcsData || ''),
- containerTypes: normalizePlainIdArray(record.containerTypes ?? record.containerType ?? record.containerTypes$ ?? []),
+ containerTypes: normalizePlainIdArray(
+ record.containerTypes ?? record.containerType ?? record.containerTypes$ ?? []
+ ),
barcode: normalizeText(record.barcode || ''),
autoTransfer:
record.autoTransfer !== void 0 && record.autoTransfer !== null && record.autoTransfer !== ''
? Number(record.autoTransfer)
: 0,
- inAble: record.inAble !== void 0 && record.inAble !== null && record.inAble !== '' ? Number(record.inAble) : 0,
+ inAble:
+ record.inAble !== void 0 && record.inAble !== null && record.inAble !== ''
+ ? Number(record.inAble)
+ : 0,
outAble:
record.outAble !== void 0 && record.outAble !== null && record.outAble !== ''
? Number(record.outAble)
@@ -327,6 +385,74 @@
}
export const buildBasStationDialogModel = createBasStationDialogModel
+
+export function buildBasStationInitModel(record = {}) {
+ const initialRows = Array.isArray(record.rows) ? record.rows : record.pairs
+ const rows =
+ Array.isArray(initialRows) && initialRows.length
+ ? initialRows
+ .map((item) => ({
+ stationName: normalizeText(item?.stationName || ''),
+ stationId: normalizeText(item?.stationId || '')
+ }))
+ .filter((item) => item.stationName || item.stationId)
+ : [createBasStationInitRow()]
+
+ return {
+ ...createBasStationInitState(),
+ type:
+ record.type !== void 0 && record.type !== null && record.type !== ''
+ ? Number(record.type)
+ : 0,
+ useStatus: normalizeText(record.useStatus || ''),
+ areaIds: normalizePlainIdArray(record.areaIds || []),
+ containerTypes: normalizePlainIdArray(record.containerTypes || []),
+ inAble:
+ record.inAble !== void 0 && record.inAble !== null && record.inAble !== ''
+ ? Number(record.inAble)
+ : 0,
+ outAble:
+ record.outAble !== void 0 && record.outAble !== null && record.outAble !== ''
+ ? Number(record.outAble)
+ : 0,
+ rows
+ }
+}
+
+export function buildBasStationInitPayloadList(formData = {}) {
+ const useStatus = normalizeText(formData.useStatus)
+ const basePayload = {
+ ...(formData.type !== void 0 && formData.type !== null && formData.type !== ''
+ ? { type: Number(formData.type) }
+ : {}),
+ ...(useStatus ? { useStatus } : {}),
+ ...(normalizePlainIdArray(formData.areaIds).length
+ ? { areaIds: normalizePlainIdArray(formData.areaIds) }
+ : {}),
+ ...(normalizePlainIdArray(formData.containerTypes).length
+ ? { containerTypes: normalizePlainIdArray(formData.containerTypes) }
+ : {}),
+ ...(formData.inAble !== void 0 && formData.inAble !== null && formData.inAble !== ''
+ ? { inAble: Number(formData.inAble) }
+ : {}),
+ ...(formData.outAble !== void 0 && formData.outAble !== null && formData.outAble !== ''
+ ? { outAble: Number(formData.outAble) }
+ : {})
+ }
+
+ const rows = Array.isArray(formData.rows) ? formData.rows : []
+ return rows
+ .map((item) => ({
+ stationName: normalizeText(item?.stationName || ''),
+ stationId: normalizeText(item?.stationId || '')
+ }))
+ .filter((item) => item.stationName && item.stationId)
+ .map((item) => ({
+ ...basePayload,
+ stationName: item.stationName,
+ stationId: item.stationId
+ }))
+}
export function resolveBasStationAreaOptions(records = []) {
if (!Array.isArray(records)) {
@@ -344,7 +470,9 @@
}
return {
value: Number(value),
- label: normalizeText(item.name || item.areaName || item.code || item.areaCode || `搴撳尯 ${value}`)
+ label: normalizeText(
+ item.name || item.areaName || item.code || item.areaCode || `搴撳尯 ${value}`
+ )
}
})
.filter(Boolean)
@@ -403,7 +531,7 @@
if (item === null || item === undefined || item === '') {
return ''
}
- const id = typeof item === 'object' ? item.id ?? item.areaId ?? item.value : item
+ const id = typeof item === 'object' ? (item.id ?? item.areaId ?? item.value) : item
if (typeof resolveLabel === 'function') {
const resolvedLabel = normalizeText(resolveLabel(id))
if (resolvedLabel) {
@@ -411,7 +539,9 @@
}
}
if (typeof item === 'object') {
- return normalizeText(item.name || item.areaName || item.label || item.code || item.areaCode || id)
+ return normalizeText(
+ item.name || item.areaName || item.label || item.code || item.areaCode || id
+ )
}
return normalizeText(`${fallbackPrefix} ${id}`)
})
@@ -425,7 +555,7 @@
}
return records
.map((item) => {
- const id = typeof item === 'object' ? item.id ?? item.value : item
+ const id = typeof item === 'object' ? (item.id ?? item.value) : item
if (typeof resolveLabel === 'function') {
const resolved = normalizeText(resolveLabel(id))
if (resolved) {
@@ -441,55 +571,108 @@
.join('銆�')
}
-export function normalizeBasStationDetailRecord(record = {}, resolveAreaLabel, resolveContainerTypeLabel) {
+export function normalizeBasStationDetailRecord(
+ record = {},
+ resolveAreaLabel,
+ resolveContainerTypeLabel
+) {
const areaIds = normalizeIdArray(record.areaIds ?? record.crossZoneArea ?? [])
- const containerTypes = normalizePlainIdArray(record.containerTypes ?? record.containerType ?? record.containerTypes$ ?? [])
+ const containerTypes = normalizePlainIdArray(
+ record.containerTypes ?? record.containerType ?? record.containerTypes$ ?? []
+ )
const statusMeta = getBasStationStatusMeta(record.statusBool ?? record.status)
const typeMeta = getBasStationTypeMeta(record.type)
const useStatusMeta = getBasStationUseStatusMeta(record.useStatus$ || record.useStatus)
+ const crossZoneAreaItems = areaIds
+ .map((item, index) => {
+ const label = normalizeText(
+ resolveAreaLabel?.(item.id) ||
+ item.name ||
+ item.areaName ||
+ item.label ||
+ item.code ||
+ item.areaCode ||
+ ''
+ )
+ return {
+ id: item.id,
+ sort: item.sort ?? index + 1,
+ label: label || `搴撳尯 ${item.id}`
+ }
+ })
+ .filter((item) => item.id !== void 0 && item.id !== null && item.id !== '')
+ const containerTypeItems = containerTypes
+ .map((item) => {
+ const label = normalizeText(resolveContainerTypeLabel?.(item) || '')
+ return {
+ value: item,
+ label: label || `瀹瑰櫒绫诲瀷 ${item}`
+ }
+ })
+ .filter((item) => item.value !== void 0 && item.value !== null && item.value !== '')
return {
...record,
stationName: normalizeText(record.stationName || ''),
stationId: normalizeText(record.stationId || ''),
- type: record.type !== void 0 && record.type !== null && record.type !== '' ? Number(record.type) : void 0,
+ type:
+ record.type !== void 0 && record.type !== null && record.type !== ''
+ ? Number(record.type)
+ : void 0,
typeText: typeMeta.text,
useStatus: normalizeText(record.useStatus || record.useStatus$ || ''),
useStatusText: useStatusMeta.text,
- area: record.area !== void 0 && record.area !== null && record.area !== '' ? Number(record.area) : void 0,
- areaText: normalizeText(resolveAreaLabel?.(record.area) || record.area$ || record.areaName || ''),
+ area:
+ record.area !== void 0 && record.area !== null && record.area !== ''
+ ? Number(record.area)
+ : void 0,
+ areaText: normalizeText(
+ resolveAreaLabel?.(record.area) || record.area$ || record.areaName || ''
+ ),
areaIds,
+ crossZoneAreaItems,
crossZoneAreaText: buildIdLabelText(areaIds, resolveAreaLabel, '搴撳尯'),
- isCrossZone: record.isCrossZone !== void 0 && record.isCrossZone !== null && record.isCrossZone !== ''
- ? Number(record.isCrossZone)
- : void 0,
+ isCrossZone:
+ record.isCrossZone !== void 0 && record.isCrossZone !== null && record.isCrossZone !== ''
+ ? Number(record.isCrossZone)
+ : void 0,
isCrossZoneText: getBasStationBooleanMeta(record.isCrossZone).text,
- isWcs: record.isWcs !== void 0 && record.isWcs !== null && record.isWcs !== ''
- ? Number(record.isWcs)
- : void 0,
+ isWcs:
+ record.isWcs !== void 0 && record.isWcs !== null && record.isWcs !== ''
+ ? Number(record.isWcs)
+ : void 0,
isWcsText: getBasStationBooleanMeta(record.isWcs).text,
wcsData: normalizeText(record.wcsData || ''),
containerTypes,
+ containerTypeItems,
containerTypesText: buildArrayText(containerTypes, resolveContainerTypeLabel, '瀹瑰櫒绫诲瀷'),
barcode: normalizeText(record.barcode || ''),
- autoTransfer: record.autoTransfer !== void 0 && record.autoTransfer !== null && record.autoTransfer !== ''
- ? Number(record.autoTransfer)
- : void 0,
+ autoTransfer:
+ record.autoTransfer !== void 0 && record.autoTransfer !== null && record.autoTransfer !== ''
+ ? Number(record.autoTransfer)
+ : void 0,
autoTransferText: getBasStationBooleanMeta(record.autoTransfer).text,
- inAble: record.inAble !== void 0 && record.inAble !== null && record.inAble !== ''
- ? Number(record.inAble)
- : void 0,
+ inAble:
+ record.inAble !== void 0 && record.inAble !== null && record.inAble !== ''
+ ? Number(record.inAble)
+ : void 0,
inAbleText: getBasStationBooleanMeta(record.inAble).text,
- outAble: record.outAble !== void 0 && record.outAble !== null && record.outAble !== ''
- ? Number(record.outAble)
- : void 0,
+ outAble:
+ record.outAble !== void 0 && record.outAble !== null && record.outAble !== ''
+ ? Number(record.outAble)
+ : void 0,
outAbleText: getBasStationBooleanMeta(record.outAble).text,
statusText: statusMeta.text,
statusType: statusMeta.type,
statusBool: record.statusBool !== void 0 ? Boolean(record.statusBool) : statusMeta.bool,
- stationAlias: Array.isArray(record.stationAlias) ? [...record.stationAlias] : record.stationAlias,
+ stationAlias: Array.isArray(record.stationAlias)
+ ? [...record.stationAlias]
+ : record.stationAlias,
stationAliasText: Array.isArray(record.stationAlias)
- ? record.stationAlias.map((item) => normalizeText(item)).filter(Boolean).join('銆�')
+ ? record.stationAlias
+ .map((item) => normalizeText(item))
+ .filter(Boolean)
+ .join('銆�')
: normalizeText(record.stationAlias || record.stationAlias$ || ''),
productionLineCode: normalizeText(record.productionLineCode || ''),
productionLineName: normalizeText(record.productionLineName || ''),
@@ -501,15 +684,25 @@
}
}
-export function normalizeBasStationListRow(record = {}, resolveAreaLabel, resolveContainerTypeLabel) {
+export function normalizeBasStationListRow(
+ record = {},
+ resolveAreaLabel,
+ resolveContainerTypeLabel
+) {
return normalizeBasStationDetailRecord(record, resolveAreaLabel, resolveContainerTypeLabel)
}
-export function buildBasStationPrintRows(records = [], resolveAreaLabel, resolveContainerTypeLabel) {
+export function buildBasStationPrintRows(
+ records = [],
+ resolveAreaLabel,
+ resolveContainerTypeLabel
+) {
if (!Array.isArray(records)) {
return []
}
- return records.map((record) => normalizeBasStationListRow(record, resolveAreaLabel, resolveContainerTypeLabel))
+ return records.map((record) =>
+ normalizeBasStationListRow(record, resolveAreaLabel, resolveContainerTypeLabel)
+ )
}
export function buildBasStationReportMeta({
--
Gitblit v1.9.1