const STATUS_META = {
|
1: { text: '正常', type: 'success' },
|
0: { text: '冻结', type: 'info' }
|
}
|
|
export const TASK_ITEM_LOG_REPORT_TITLE = '任务工作历史档报表'
|
|
function normalizeText(value) {
|
return String(value ?? '').trim()
|
}
|
|
function normalizeNumber(value) {
|
if (value === '' || value === null || value === undefined) {
|
return null
|
}
|
const numericValue = Number(value)
|
return Number.isFinite(numericValue) ? numericValue : null
|
}
|
|
function normalizeReportText(value) {
|
return value === null || value === undefined || value === '' ? '--' : value
|
}
|
|
export function createTaskItemLogSearchState() {
|
return {
|
condition: '',
|
timeStart: '',
|
timeEnd: '',
|
logId: '',
|
taskId: '',
|
taskItemId: '',
|
matnrId: '',
|
maktx: '',
|
platItemId: '',
|
platOrderCode: '',
|
platWorkCode: '',
|
projectCode: '',
|
source: '',
|
sourceCode: '',
|
sourceId: '',
|
matnrCode: '',
|
unit: '',
|
anfme: '',
|
batch: '',
|
spec: '',
|
model: '',
|
fieldsIndex: '',
|
memo: '',
|
status: '',
|
baseUnit: '',
|
useOrgId: '',
|
useOrgName: '',
|
erpClsId: '',
|
priceUnitId: '',
|
inStockType: '',
|
ownerTypeId: '',
|
ownerId: '',
|
ownerName: '',
|
keeperTypeId: '',
|
keeperId: '',
|
keeperName: '',
|
targetWarehouseId: '',
|
sourceWarehouseId: ''
|
}
|
}
|
|
export function getTaskItemLogPaginationKey() {
|
return {
|
current: 'current',
|
size: 'pageSize'
|
}
|
}
|
|
export function buildTaskItemLogSearchParams(params = {}) {
|
const result = {}
|
|
;[
|
'condition',
|
'maktx',
|
'platItemId',
|
'platOrderCode',
|
'platWorkCode',
|
'projectCode',
|
'sourceCode',
|
'matnrCode',
|
'unit',
|
'batch',
|
'spec',
|
'model',
|
'fieldsIndex',
|
'memo',
|
'baseUnit',
|
'useOrgId',
|
'useOrgName',
|
'erpClsId',
|
'priceUnitId',
|
'inStockType',
|
'ownerTypeId',
|
'ownerId',
|
'ownerName',
|
'keeperTypeId',
|
'keeperId',
|
'keeperName',
|
'targetWarehouseId',
|
'sourceWarehouseId'
|
].forEach((key) => {
|
const value = normalizeText(params[key])
|
if (value) {
|
result[key] = value
|
}
|
})
|
|
;['timeStart', 'timeEnd'].forEach((key) => {
|
if (params[key]) {
|
result[key] = params[key]
|
}
|
})
|
|
;['logId', 'taskId', 'taskItemId', 'matnrId', 'source', 'sourceId', 'anfme', 'status'].forEach(
|
(key) => {
|
const value = normalizeNumber(params[key])
|
if (value !== null) {
|
result[key] = value
|
}
|
}
|
)
|
|
return {
|
condition: '',
|
...result
|
}
|
}
|
|
export function buildTaskItemLogPageQueryParams(params = {}) {
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...buildTaskItemLogSearchParams(params)
|
}
|
}
|
|
export function getTaskItemLogStatusMeta(value) {
|
return STATUS_META[Number(value)] || { text: '-', type: 'info' }
|
}
|
|
export function normalizeTaskItemLogRow(record = {}) {
|
const statusMeta = getTaskItemLogStatusMeta(record.status)
|
return {
|
...record,
|
logId: record.logId ?? '--',
|
taskId: record.taskId ?? '--',
|
taskItemId: record.taskItemId ?? '--',
|
matnrId: record.matnrId ?? '--',
|
maktx: normalizeReportText(record.maktx),
|
platItemId: normalizeReportText(record.platItemId),
|
platOrderCode: normalizeReportText(record.platOrderCode),
|
platWorkCode: normalizeReportText(record.platWorkCode),
|
projectCode: normalizeReportText(record.projectCode),
|
source: record.source ?? '--',
|
sourceCode: normalizeReportText(record.sourceCode),
|
sourceId: record.sourceId ?? '--',
|
matnrCode: normalizeReportText(record.matnrCode),
|
unit: normalizeReportText(record.unit),
|
anfme: record.anfme ?? '--',
|
batch: normalizeReportText(record.batch),
|
spec: normalizeReportText(record.spec),
|
model: normalizeReportText(record.model),
|
fieldsIndex: normalizeReportText(record.fieldsIndex),
|
baseUnit: normalizeReportText(record.baseUnit),
|
useOrgId: normalizeReportText(record.useOrgId),
|
useOrgName: normalizeReportText(record.useOrgName),
|
erpClsId: normalizeReportText(record.erpClsId),
|
priceUnitId: normalizeReportText(record.priceUnitId),
|
inStockType: normalizeReportText(record.inStockType),
|
ownerTypeId: normalizeReportText(record.ownerTypeId),
|
ownerId: normalizeReportText(record.ownerId),
|
ownerName: normalizeReportText(record.ownerName),
|
keeperTypeId: normalizeReportText(record.keeperTypeId),
|
keeperId: normalizeReportText(record.keeperId),
|
keeperName: normalizeReportText(record.keeperName),
|
targetWarehouseId: normalizeReportText(record.targetWarehouseId),
|
sourceWarehouseId: normalizeReportText(record.sourceWarehouseId),
|
createByText: record['createBy$'] || record.createByText || '--',
|
createTimeText: record['createTime$'] || record.createTime || '--',
|
updateByText: record['updateBy$'] || record.updateByText || '--',
|
updateTimeText: record['updateTime$'] || record.updateTime || '--',
|
memo: normalizeReportText(record.memo),
|
statusText: record['status$'] || statusMeta.text,
|
statusType: statusMeta.type
|
}
|
}
|
|
export function getTaskItemLogReportColumns() {
|
return [
|
{ source: 'taskId', label: '任务ID' },
|
{ source: 'taskItemId', label: '任务明细ID' },
|
{ source: 'matnrId', label: '物料ID' },
|
{ source: 'maktx', label: '物料名称' },
|
{ source: 'platWorkCode', label: '工单号' },
|
{ source: 'platOrderCode', label: '客户订单号' },
|
{ source: 'projectCode', label: '项目号' },
|
{ source: 'source', label: '源编码' },
|
{ source: 'sourceCode', label: '源单号' },
|
{ source: 'matnrCode', label: '物料编码' },
|
{ source: 'unit', label: '库存单位' },
|
{ source: 'anfme', label: '数量' },
|
{ source: 'batch', label: '库存批次' },
|
{ source: 'spec', label: '规格' },
|
{ source: 'model', label: '型号' },
|
{ source: 'fieldsIndex', label: '字段索引' },
|
{ source: 'createByText', label: '创建人' },
|
{ source: 'createTimeText', label: '创建时间' },
|
{ source: 'updateByText', label: '更新人' },
|
{ source: 'updateTimeText', label: '更新时间' },
|
{ source: 'statusText', label: '状态' },
|
{ source: 'memo', label: '备注' }
|
]
|
}
|
|
export function buildTaskItemLogPrintRows(records = []) {
|
return records.map((record) => {
|
const row = normalizeTaskItemLogRow(record)
|
return {
|
taskId: row.taskId,
|
taskItemId: row.taskItemId,
|
matnrId: row.matnrId,
|
maktx: row.maktx,
|
platWorkCode: row.platWorkCode,
|
platOrderCode: row.platOrderCode,
|
projectCode: row.projectCode,
|
source: row.source,
|
sourceCode: row.sourceCode,
|
matnrCode: row.matnrCode,
|
unit: row.unit,
|
anfme: row.anfme,
|
batch: row.batch,
|
spec: row.spec,
|
model: row.model,
|
fieldsIndex: row.fieldsIndex,
|
createByText: row.createByText,
|
createTimeText: row.createTimeText,
|
updateByText: row.updateByText,
|
updateTimeText: row.updateTimeText,
|
statusText: row.statusText,
|
statusType: row.statusType,
|
memo: row.memo
|
}
|
})
|
}
|