const STATUS_META = {
|
1: { text: '正常', type: 'success' },
|
0: { text: '冻结', type: 'info' }
|
}
|
|
export const SUBSYSTEM_FLOW_TEMPLATE_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 normalizeBoolText(value) {
|
const numericValue = Number(value)
|
if (numericValue === 1) return '是'
|
if (numericValue === 0) return '否'
|
return '--'
|
}
|
|
export function createSubsystemFlowTemplateSearchState() {
|
return {
|
condition: '',
|
timeStart: '',
|
timeEnd: '',
|
flowCode: '',
|
flowName: '',
|
systemCode: '',
|
systemName: '',
|
nodeType: '',
|
version: '',
|
isCurrent: '',
|
effectiveTime: '',
|
timeoutStrategy: '',
|
timeoutSeconds: '',
|
maxRetryTimes: '',
|
needNotify: '',
|
notifyTemplate: '',
|
remark: '',
|
memo: '',
|
status: ''
|
}
|
}
|
|
export function getSubsystemFlowTemplatePaginationKey() {
|
return {
|
current: 'current',
|
size: 'pageSize'
|
}
|
}
|
|
export function buildSubsystemFlowTemplateSearchParams(params = {}) {
|
const result = {}
|
|
;[
|
'condition',
|
'flowCode',
|
'flowName',
|
'systemCode',
|
'systemName',
|
'nodeType',
|
'effectiveTime',
|
'timeoutStrategy',
|
'notifyTemplate',
|
'remark',
|
'memo'
|
].forEach((key) => {
|
const value = normalizeText(params[key])
|
if (value) {
|
result[key] = value
|
}
|
})
|
|
;['timeStart', 'timeEnd'].forEach((key) => {
|
if (params[key]) {
|
result[key] = params[key]
|
}
|
})
|
|
;['version', 'isCurrent', 'timeoutSeconds', 'maxRetryTimes', 'needNotify', 'status'].forEach((key) => {
|
const value = normalizeNumber(params[key])
|
if (value !== null) {
|
result[key] = value
|
}
|
})
|
|
return {
|
condition: '',
|
...result
|
}
|
}
|
|
export function buildSubsystemFlowTemplatePageQueryParams(params = {}) {
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...buildSubsystemFlowTemplateSearchParams(params)
|
}
|
}
|
|
export function normalizeSubsystemFlowTemplateRow(record = {}) {
|
const statusMeta = STATUS_META[Number(record.status)] || STATUS_META[0]
|
return {
|
...record,
|
id: record.id ?? '--',
|
flowCode: normalizeText(record.flowCode) || '--',
|
flowName: normalizeText(record.flowName) || '--',
|
systemCode: normalizeText(record.systemCode) || '--',
|
systemName: normalizeText(record.systemName) || '--',
|
nodeType: normalizeText(record.nodeType) || '--',
|
version: record.version ?? '--',
|
isCurrentText: normalizeBoolText(record.isCurrent),
|
timeoutStrategy: normalizeText(record.timeoutStrategy) || '--',
|
timeoutSeconds: record.timeoutSeconds ?? '--',
|
maxRetryTimes: record.maxRetryTimes ?? '--',
|
statusText: record['status$'] || statusMeta.text,
|
statusType: statusMeta.type,
|
memo: normalizeText(record.memo) || '--'
|
}
|
}
|
|
export function getSubsystemFlowTemplateReportColumns() {
|
return [
|
{ prop: 'flowCode', label: '流程编码' },
|
{ prop: 'flowName', label: '流程名称' },
|
{ prop: 'systemCode', label: '系统编码' },
|
{ prop: 'systemName', label: '系统名称' },
|
{ prop: 'nodeType', label: '节点类型' },
|
{ prop: 'version', label: '版本' },
|
{ prop: 'isCurrentText', label: '当前版本' },
|
{ prop: 'timeoutStrategy', label: '超时策略' },
|
{ prop: 'timeoutSeconds', label: '超时(秒)' },
|
{ prop: 'maxRetryTimes', label: '最大重试次数' },
|
{ prop: 'statusText', label: '状态' },
|
{ prop: 'memo', label: '备注' }
|
]
|
}
|
|
export function buildSubsystemFlowTemplatePrintRows(records = []) {
|
return (Array.isArray(records) ? records : []).map((record) => {
|
const row = normalizeSubsystemFlowTemplateRow(record)
|
return {
|
flowCode: row.flowCode,
|
flowName: row.flowName,
|
systemCode: row.systemCode,
|
systemName: row.systemName,
|
nodeType: row.nodeType,
|
version: row.version,
|
isCurrentText: row.isCurrentText,
|
timeoutStrategy: row.timeoutStrategy,
|
timeoutSeconds: row.timeoutSeconds,
|
maxRetryTimes: row.maxRetryTimes,
|
statusText: row.statusText,
|
memo: row.memo
|
}
|
})
|
}
|