|
@@ -924,6 +924,12 @@
|
|
|
getDispatchAssignment(row) {
|
|
getDispatchAssignment(row) {
|
|
|
return this.dispatchAssignmentMap[this.getDispatchAssignmentKey(row)];
|
|
return this.dispatchAssignmentMap[this.getDispatchAssignmentKey(row)];
|
|
|
},
|
|
},
|
|
|
|
|
+ removeDispatchAssignment(row) {
|
|
|
|
|
+ const key = this.getDispatchAssignmentKey(row);
|
|
|
|
|
+ if (key) {
|
|
|
|
|
+ this.$delete(this.dispatchAssignmentMap, key);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
getDispatchWorkOrderId() {
|
|
getDispatchWorkOrderId() {
|
|
|
const plan = this.currentPlan || {};
|
|
const plan = this.currentPlan || {};
|
|
|
return plan.workOrderId || plan.orderId || plan.sourceWorkOrderId || '';
|
|
return plan.workOrderId || plan.orderId || plan.sourceWorkOrderId || '';
|
|
@@ -976,10 +982,23 @@
|
|
|
}
|
|
}
|
|
|
return '';
|
|
return '';
|
|
|
},
|
|
},
|
|
|
|
|
+ pickDispatchTeamId(groups = []) {
|
|
|
|
|
+ for (const group of groups) {
|
|
|
|
|
+ const source = group?.source || {};
|
|
|
|
|
+ const keys = Array.isArray(group?.keys) ? group.keys : [];
|
|
|
|
|
+ for (const key of keys) {
|
|
|
|
|
+ const value = this.normalizeDispatchSingleValue(source[key]);
|
|
|
|
|
+ if (value && !String(value).includes(':')) {
|
|
|
|
|
+ return value;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return '';
|
|
|
|
|
+ },
|
|
|
getDispatchTeamId() {
|
|
getDispatchTeamId() {
|
|
|
const plan = this.currentPlan || {};
|
|
const plan = this.currentPlan || {};
|
|
|
const task = this.activeTask || {};
|
|
const task = this.activeTask || {};
|
|
|
- return this.pickDispatchSingleValue([
|
|
|
|
|
|
|
+ return this.pickDispatchTeamId([
|
|
|
{ source: task, keys: DISPATCH_TEAM_ID_KEYS },
|
|
{ source: task, keys: DISPATCH_TEAM_ID_KEYS },
|
|
|
{ source: plan, keys: DISPATCH_TEAM_ID_KEYS }
|
|
{ source: plan, keys: DISPATCH_TEAM_ID_KEYS }
|
|
|
]);
|
|
]);
|
|
@@ -1001,11 +1020,10 @@
|
|
|
'teamIds',
|
|
'teamIds',
|
|
|
'executionTeamId'
|
|
'executionTeamId'
|
|
|
];
|
|
];
|
|
|
- const teamId = this.pickDispatchSingleValue([
|
|
|
|
|
|
|
+ return this.pickDispatchTeamId([
|
|
|
{ source: row || {}, keys: teamIdKeys },
|
|
{ source: row || {}, keys: teamIdKeys },
|
|
|
{ source: this.currentPlan || {}, keys: teamIdKeys }
|
|
{ source: this.currentPlan || {}, keys: teamIdKeys }
|
|
|
]);
|
|
]);
|
|
|
- return String(teamId).includes(':') ? '' : teamId;
|
|
|
|
|
},
|
|
},
|
|
|
getDispatchTaskLeaderId(row = this.activeTask) {
|
|
getDispatchTaskLeaderId(row = this.activeTask) {
|
|
|
const leaderKeys = [
|
|
const leaderKeys = [
|
|
@@ -1127,6 +1145,9 @@
|
|
|
return String(status);
|
|
return String(status);
|
|
|
},
|
|
},
|
|
|
canResetDispatchRow(row) {
|
|
canResetDispatchRow(row) {
|
|
|
|
|
+ if (!this.getDispatchToolbarPermissionState('reset').allowed) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
const data = this.getDispatchActionRowData(row);
|
|
const data = this.getDispatchActionRowData(row);
|
|
|
if (
|
|
if (
|
|
|
data.status === null ||
|
|
data.status === null ||
|
|
@@ -1618,6 +1639,9 @@
|
|
|
return !!row?.changeId && !!statusCode;
|
|
return !!row?.changeId && !!statusCode;
|
|
|
},
|
|
},
|
|
|
async handleDispatchRowReset(row) {
|
|
async handleDispatchRowReset(row) {
|
|
|
|
|
+ if (!this.validateDispatchToolbarPermission('reset')) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
const data = this.getDispatchActionRowData(row);
|
|
const data = this.getDispatchActionRowData(row);
|
|
|
if (!data.changeId) {
|
|
if (!data.changeId) {
|
|
|
this.$message.warning('只能对已撤回跟已保存的数据进行重置');
|
|
this.$message.warning('只能对已撤回跟已保存的数据进行重置');
|
|
@@ -1627,8 +1651,8 @@
|
|
|
try {
|
|
try {
|
|
|
const res = await resetAssignee(data.changeId);
|
|
const res = await resetAssignee(data.changeId);
|
|
|
if (res) {
|
|
if (res) {
|
|
|
|
|
+ this.removeDispatchAssignment(row);
|
|
|
this.clearDispatchObject(row);
|
|
this.clearDispatchObject(row);
|
|
|
- await this.loadDispatchAssignData();
|
|
|
|
|
this.$message.success('操作成功');
|
|
this.$message.success('操作成功');
|
|
|
this.$emit('dispatch-action-success', {
|
|
this.$emit('dispatch-action-success', {
|
|
|
type: 'reset',
|
|
type: 'reset',
|