export const FLOW_STEP_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
|
}
|
|
export function createFlowStepLogSearchState() {
|
return {
|
condition: '',
|
timeStart: '',
|
timeEnd: '',
|
flowInstanceId: '',
|
stepInstanceId: '',
|
logType: '',
|
logLevel: '',
|
logContent: '',
|
requestData: '',
|
responseData: '',
|
memo: '',
|
status: ''
|
}
|
}
|
|
export function getFlowStepLogPaginationKey() {
|
return {
|
current: 'current',
|
size: 'pageSize'
|
}
|
}
|
|
export function buildFlowStepLogSearchParams(params = {}) {
|
const result = {}
|
|
;['condition', 'logType', 'logLevel', 'logContent', 'requestData', 'responseData', 'memo'].forEach((key) => {
|
const value = normalizeText(params[key])
|
if (value) {
|
result[key] = value
|
}
|
})
|
|
;['timeStart', 'timeEnd'].forEach((key) => {
|
if (params[key]) {
|
result[key] = params[key]
|
}
|
})
|
|
;['flowInstanceId', 'stepInstanceId', 'status'].forEach((key) => {
|
const value = normalizeNumber(params[key])
|
if (value !== null) {
|
result[key] = value
|
}
|
})
|
|
return {
|
condition: '',
|
...result
|
}
|
}
|
|
export function buildFlowStepLogPageQueryParams(params = {}) {
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...buildFlowStepLogSearchParams(params)
|
}
|
}
|
|
export function normalizeFlowStepLogRow(record = {}) {
|
return {
|
...record,
|
id: record.id ?? '--',
|
flowInstanceId: record.flowInstanceId ?? '--',
|
stepInstanceId: record.stepInstanceId ?? '--',
|
logType: normalizeText(record.logType) || '--',
|
logLevel: normalizeText(record.logLevel) || '--',
|
logContent: normalizeText(record.logContent) || '--',
|
requestData: normalizeText(record.requestData) || '--',
|
responseData: normalizeText(record.responseData) || '--',
|
createTimeText: normalizeText(record['createTime$'] || record.createTimeText || record.createTime) || '--',
|
memo: normalizeText(record.memo) || '--'
|
}
|
}
|
|
export function getFlowStepLogReportColumns() {
|
return [
|
{ prop: 'flowInstanceId', label: '流程实例ID' },
|
{ prop: 'stepInstanceId', label: '步骤实例ID' },
|
{ prop: 'logType', label: '日志类型' },
|
{ prop: 'logLevel', label: '日志级别' },
|
{ prop: 'logContent', label: '日志内容' },
|
{ prop: 'requestData', label: '请求数据' },
|
{ prop: 'responseData', label: '响应数据' },
|
{ prop: 'createTimeText', label: '创建时间' },
|
{ prop: 'memo', label: '备注' }
|
]
|
}
|
|
export function buildFlowStepLogPrintRows(records = []) {
|
return (Array.isArray(records) ? records : []).map((record) => {
|
const row = normalizeFlowStepLogRow(record)
|
return {
|
flowInstanceId: row.flowInstanceId,
|
stepInstanceId: row.stepInstanceId,
|
logType: row.logType,
|
logLevel: row.logLevel,
|
logContent: row.logContent,
|
requestData: row.requestData,
|
responseData: row.responseData,
|
createTimeText: row.createTimeText,
|
memo: row.memo
|
}
|
})
|
}
|