|
|
@@ -626,7 +626,8 @@
|
|
|
dispatchRowDraftMap: {},
|
|
|
dispatchAssignmentMap: {},
|
|
|
dispatchToolbarLoading: false,
|
|
|
- dispatchReportType: 1
|
|
|
+ dispatchReportType: 1,
|
|
|
+ suppressTaskListAssignReloadUntil: 0
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -815,6 +816,9 @@
|
|
|
if (!hasActive) {
|
|
|
this.activeTaskKey = this.dispatchTaskGroupKey(list[0]);
|
|
|
}
|
|
|
+ if (Date.now() < this.suppressTaskListAssignReloadUntil) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.$nextTick(() => {
|
|
|
this.loadDispatchAssignData();
|
|
|
});
|
|
|
@@ -1129,6 +1133,22 @@
|
|
|
'';
|
|
|
return String(rawId).replace(/^(workstation|person|team):/, '');
|
|
|
},
|
|
|
+ normalizeDispatchLongId(value) {
|
|
|
+ if (value === null || value === undefined || value === '') {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ const text = String(value).trim();
|
|
|
+ return /^\d+$/.test(text) ? text : '';
|
|
|
+ },
|
|
|
+ getDispatchDeviceId(row) {
|
|
|
+ return (
|
|
|
+ this.normalizeDispatchLongId(row?.assetId) ||
|
|
|
+ this.normalizeDispatchLongId(row?.extInfo?.assetId) ||
|
|
|
+ this.normalizeDispatchLongId(row?.deviceId) ||
|
|
|
+ this.normalizeDispatchLongId(row?.extInfo?.deviceId) ||
|
|
|
+ ''
|
|
|
+ );
|
|
|
+ },
|
|
|
getAssignmentTypeCode(value) {
|
|
|
if (value && typeof value === 'object') {
|
|
|
return value.code ?? value.value ?? value.id ?? '';
|
|
|
@@ -1329,6 +1349,10 @@
|
|
|
(item) => this.dispatchTaskGroupKey(item) === groupKey
|
|
|
);
|
|
|
},
|
|
|
+ emitDispatchTaskListChange(eventName, row) {
|
|
|
+ this.suppressTaskListAssignReloadUntil = Date.now() + 300;
|
|
|
+ this.$emit(eventName, row);
|
|
|
+ },
|
|
|
clearDispatchSelectionsByTaskKey(groupKey) {
|
|
|
if (!this.orderDispatchStyle || !groupKey) {
|
|
|
return;
|
|
|
@@ -1338,7 +1362,7 @@
|
|
|
return;
|
|
|
}
|
|
|
if (task._dispatchDraft) {
|
|
|
- this.$emit('remove-task-row', task);
|
|
|
+ this.emitDispatchTaskListChange('remove-task-row', task);
|
|
|
return;
|
|
|
}
|
|
|
this.$set(task, 'executionTeamId', '');
|
|
|
@@ -1363,7 +1387,7 @@
|
|
|
source
|
|
|
)}-${this.dispatchObjectRowKey(row)}`
|
|
|
};
|
|
|
- this.$emit('add-task-row', next);
|
|
|
+ this.emitDispatchTaskListChange('add-task-row', next);
|
|
|
return next;
|
|
|
},
|
|
|
clearDispatchObject(row, task = this.getDispatchRowTask(row)) {
|
|
|
@@ -1378,7 +1402,7 @@
|
|
|
row.executionStartTime = '';
|
|
|
row.executionEndTime = '';
|
|
|
if (task._dispatchDraft) {
|
|
|
- this.$emit('remove-task-row', task);
|
|
|
+ this.emitDispatchTaskListChange('remove-task-row', task);
|
|
|
return;
|
|
|
}
|
|
|
this.$set(task, 'quantity', '');
|
|
|
@@ -1397,7 +1421,7 @@
|
|
|
return;
|
|
|
}
|
|
|
if (task._dispatchDraft) {
|
|
|
- this.$emit('remove-task-row', task);
|
|
|
+ this.emitDispatchTaskListChange('remove-task-row', task);
|
|
|
return;
|
|
|
}
|
|
|
this.$set(task, 'quantity', '');
|
|
|
@@ -1489,7 +1513,7 @@
|
|
|
executionEndTime: row.executionEndTime || task.executionEndTime || ''
|
|
|
});
|
|
|
if (task._dispatchDraft) {
|
|
|
- this.$emit('remove-task-row', task);
|
|
|
+ this.emitDispatchTaskListChange('remove-task-row', task);
|
|
|
return;
|
|
|
}
|
|
|
this.$set(task, 'quantity', '');
|
|
|
@@ -1726,12 +1750,7 @@
|
|
|
assigneeName,
|
|
|
measuringUnit,
|
|
|
isNew: row.isNew ? row.isNew : '',
|
|
|
- deviceId:
|
|
|
- row.assetId ||
|
|
|
- row.deviceId ||
|
|
|
- row.extInfo?.assetId ||
|
|
|
- row.extInfo?.assetCode ||
|
|
|
- '',
|
|
|
+ deviceId: this.getDispatchDeviceId(row),
|
|
|
deviceName:
|
|
|
row.assetName || row.deviceName || row.extInfo?.assetName || '',
|
|
|
workStationId: assigneeId,
|
|
|
@@ -1830,7 +1849,10 @@
|
|
|
...item,
|
|
|
isNew: 1,
|
|
|
assetCode: item.assetCode || item.extInfo?.assetCode || '',
|
|
|
- assetId: item.assetId || item.extInfo?.assetId || '',
|
|
|
+ assetId:
|
|
|
+ this.normalizeDispatchLongId(item.assetId) ||
|
|
|
+ this.normalizeDispatchLongId(item.extInfo?.assetId) ||
|
|
|
+ '',
|
|
|
assetName: item.assetName || item.extInfo?.assetName || ''
|
|
|
}));
|
|
|
this.$emit('add-dispatch-stations', {
|