修复业务模块bug
This commit is contained in:
@@ -49,6 +49,16 @@ const parseJsonObject = value => {
|
||||
const parseProcessNodes = value => {
|
||||
const result = parseJsonArray(value);
|
||||
if (result.length) return result;
|
||||
if (typeof value === 'string' && value.trim()) {
|
||||
try {
|
||||
const parsed = JSON.parse(value);
|
||||
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
||||
return Array.isArray(parsed.nodes) ? parsed.nodes : [];
|
||||
}
|
||||
} catch (error) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) return [];
|
||||
return Array.isArray(value.nodes) ? value.nodes : [];
|
||||
};
|
||||
@@ -62,6 +72,75 @@ const requiresDriverAcceptConfirmation = processJson =>
|
||||
node.confirmDriver === true
|
||||
);
|
||||
|
||||
const getProcessConfigNodes = row => {
|
||||
const sources = [
|
||||
row.processJson,
|
||||
row.processConfigJson,
|
||||
row.projectProcessJson,
|
||||
row.processConfig,
|
||||
row.projectProcessConfig,
|
||||
];
|
||||
return sources.flatMap(source => {
|
||||
const nodes = parseProcessNodes(source);
|
||||
if (nodes.length || !source || typeof source !== 'object' || Array.isArray(source)) {
|
||||
return nodes;
|
||||
}
|
||||
const configuredNodes = parseProcessNodes(source.nodeConfigJson);
|
||||
const includedNodes = String(source.includedNodes || '')
|
||||
.split(',')
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean);
|
||||
return configuredNodes.filter(
|
||||
node =>
|
||||
!includedNodes.length ||
|
||||
includedNodes.includes(node.name) ||
|
||||
includedNodes.includes(node.key)
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const hasAcceptProcessNode = row =>
|
||||
getProcessConfigNodes(row).some(
|
||||
node => node.enabled !== false && (node.key === 'accept' || node.name === '接单')
|
||||
);
|
||||
|
||||
const hasDriverAcceptRecord = row => {
|
||||
const recordValues = [
|
||||
row.driverAcceptTime,
|
||||
row.driverAcceptedTime,
|
||||
row.acceptTime,
|
||||
row.driverAcceptId,
|
||||
row.driverAcceptedBy,
|
||||
row.acceptUserId,
|
||||
row.acceptUserName,
|
||||
];
|
||||
if (recordValues.some(value => value !== null && value !== undefined && value !== '')) {
|
||||
return true;
|
||||
}
|
||||
const statusValues = [
|
||||
row.driverAcceptStatus,
|
||||
row.driverAccepted,
|
||||
row.driverAccept,
|
||||
row.accepted,
|
||||
row.isAccepted,
|
||||
row.acceptStatus,
|
||||
];
|
||||
return statusValues.some(value => {
|
||||
if (value === true) return true;
|
||||
if (value === false || value === null || value === undefined || value === '') return false;
|
||||
return ['1', 'true', 'accepted', 'confirmed', 'success', '已接单', '已确认'].includes(
|
||||
String(value).toLowerCase()
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const isInProgressStatus = (row, defaultText) =>
|
||||
['processing', 'running', 'in_progress', 'inProgress'].includes(
|
||||
String(row.businessStatus || row.status || row.waybillStatus || '')
|
||||
) ||
|
||||
String(defaultText || '').includes('进行中') ||
|
||||
String(row.businessStatusName || row.statusName || '').includes('进行中');
|
||||
|
||||
const getFirstValue = (row, props) => {
|
||||
const prop = props.find(item => !isEmpty(row[item]));
|
||||
return prop ? row[prop] : '';
|
||||
@@ -222,6 +301,14 @@ export const config = {
|
||||
statusProp: 'businessStatus',
|
||||
statusTextProp: 'businessStatusName',
|
||||
formatStatus(row, prop, defaultText) {
|
||||
if (
|
||||
prop === 'businessStatus' &&
|
||||
hasAcceptProcessNode(row) &&
|
||||
isInProgressStatus(row, defaultText) &&
|
||||
!hasDriverAcceptRecord(row)
|
||||
) {
|
||||
return '待执行';
|
||||
}
|
||||
if (
|
||||
prop === 'businessStatus' &&
|
||||
row.businessStatus === 'pending' &&
|
||||
@@ -538,6 +625,19 @@ export const option = {
|
||||
viewDisplay: false,
|
||||
display: false,
|
||||
},
|
||||
{
|
||||
label: '关联单号',
|
||||
prop: 'relationNo',
|
||||
search: true,
|
||||
searchOrder: 2,
|
||||
span: 6,
|
||||
order: 820,
|
||||
minWidth: 140,
|
||||
hide: false,
|
||||
addDisplay: true,
|
||||
editDisplay: true,
|
||||
viewDisplay: true,
|
||||
},
|
||||
{
|
||||
label: '预计发货日期',
|
||||
prop: 'estimatedStartTime',
|
||||
@@ -684,16 +784,6 @@ export const option = {
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
},
|
||||
{
|
||||
label: '关联单号',
|
||||
prop: 'relationNo',
|
||||
search: true,
|
||||
searchOrder: 2,
|
||||
span: 6,
|
||||
order: 820,
|
||||
minWidth: 140,
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: '货物信息',
|
||||
prop: 'goodsJson',
|
||||
|
||||
Reference in New Issue
Block a user