|
|
@@ -669,6 +669,7 @@
|
|
|
import chooseStation from '@/views/workOrder/components/chooseStation.vue';
|
|
|
import {
|
|
|
checkAssignConfirm,
|
|
|
+ checkAssignSourceType,
|
|
|
listAssign,
|
|
|
listByPlanIdAndTaskId,
|
|
|
parameterGetByCode,
|
|
|
@@ -687,16 +688,14 @@
|
|
|
'teamId',
|
|
|
'firstTaskTeamId',
|
|
|
'firstTeamId',
|
|
|
- 'teamIds',
|
|
|
- 'executionTeamId'
|
|
|
+ 'teamIds'
|
|
|
];
|
|
|
const DISPATCH_TEAM_NAME_KEYS = [
|
|
|
'dispatchTeamName',
|
|
|
'teamName',
|
|
|
'firstTaskTeamName',
|
|
|
'firstTeamName',
|
|
|
- 'teamNames',
|
|
|
- 'executionTeamName'
|
|
|
+ 'teamNames'
|
|
|
];
|
|
|
|
|
|
export default {
|
|
|
@@ -2311,6 +2310,18 @@
|
|
|
assignees: this.buildDispatchAssignees(rows)
|
|
|
};
|
|
|
},
|
|
|
+ async validateDispatchSourceConflict(payload, type) {
|
|
|
+ if (!this.orderDispatchStyle || (type !== 1 && type !== 3)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ const checked = await checkAssignSourceType(payload);
|
|
|
+ if (checked && checked.result === true) {
|
|
|
+ this.$message.warning(
|
|
|
+ checked.message || '当前派单数据存在冲突,请调整后再操作'
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
validateFirstTaskConfirmReportType() {
|
|
|
if (this.reportTypeValue === 0 || this.reportTypeValue === 1) {
|
|
|
return true;
|
|
|
@@ -2444,6 +2455,9 @@
|
|
|
type === 1 ? taskAssignment : type === 2 ? taskRevoked : taskSave;
|
|
|
this.dispatchToolbarLoading = true;
|
|
|
try {
|
|
|
+ if (!(await this.validateDispatchSourceConflict(data, type))) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
await api(data);
|
|
|
await this.loadDispatchAssignData();
|
|
|
this.$message.success('操作成功');
|
|
|
@@ -2581,6 +2595,70 @@
|
|
|
String(this.dispatchObjectRowKey(row) || '')
|
|
|
);
|
|
|
},
|
|
|
+ ensureDispatchTeamSnapshot(task) {
|
|
|
+ if (!task) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const snapshot = {};
|
|
|
+ if (!task.dispatchTeamId) {
|
|
|
+ const teamId = this.pickDispatchTeamId([
|
|
|
+ {
|
|
|
+ source: task,
|
|
|
+ keys: [
|
|
|
+ 'teamId',
|
|
|
+ 'firstTaskTeamId',
|
|
|
+ 'firstTeamId',
|
|
|
+ 'teamIds',
|
|
|
+ 'executionTeamId'
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ { source: this.currentPlan || {}, keys: DISPATCH_TEAM_ID_KEYS }
|
|
|
+ ]);
|
|
|
+ if (teamId) {
|
|
|
+ snapshot.dispatchTeamId = teamId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!task.dispatchTeamName) {
|
|
|
+ const teamName = this.pickDispatchSingleValue([
|
|
|
+ {
|
|
|
+ source: task,
|
|
|
+ keys: [
|
|
|
+ 'teamName',
|
|
|
+ 'firstTaskTeamName',
|
|
|
+ 'firstTeamName',
|
|
|
+ 'teamNames',
|
|
|
+ 'executionTeamName'
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ { source: this.currentPlan || {}, keys: DISPATCH_TEAM_NAME_KEYS }
|
|
|
+ ]);
|
|
|
+ if (teamName) {
|
|
|
+ snapshot.dispatchTeamName = teamName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!task.dispatchTeamLeaderId) {
|
|
|
+ const leaderId = this.pickDispatchSingleValue([
|
|
|
+ {
|
|
|
+ source: task,
|
|
|
+ keys: [
|
|
|
+ 'teamLeaderUserId',
|
|
|
+ 'leaderUserId',
|
|
|
+ 'executionTeamLeaderId'
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ source: this.currentPlan || {},
|
|
|
+ keys: ['dispatchTeamLeaderId', 'teamLeaderUserId', 'leaderUserId']
|
|
|
+ }
|
|
|
+ ]);
|
|
|
+ if (leaderId) {
|
|
|
+ snapshot.dispatchTeamLeaderId = leaderId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Object.keys(snapshot).forEach((key) => {
|
|
|
+ this.$set(task, key, snapshot[key]);
|
|
|
+ });
|
|
|
+ },
|
|
|
isSelectedDispatchObject(row) {
|
|
|
const task = this.getDispatchRowTask(row);
|
|
|
return !!task;
|
|
|
@@ -2590,6 +2668,7 @@
|
|
|
if (!task || !row) {
|
|
|
return;
|
|
|
}
|
|
|
+ this.ensureDispatchTeamSnapshot(task);
|
|
|
this.$set(task, 'executionType', this.execType.HOMEMADE);
|
|
|
this.$set(task, 'executionTeamId', this.dispatchObjectRowKey(row));
|
|
|
this.$set(task, 'rawExecutionTeamId', row.rawId);
|