|
|
@@ -279,7 +279,9 @@ export default {
|
|
|
this.handleClick({ name: this.processId });
|
|
|
}
|
|
|
console.log(this.processList, '工序列表');
|
|
|
- } catch (err) {}
|
|
|
+ } catch (err) {
|
|
|
+ console.warn(err);
|
|
|
+ }
|
|
|
},
|
|
|
// 选择工作中心
|
|
|
async changeWork(e) {
|
|
|
@@ -420,6 +422,35 @@ export default {
|
|
|
.map((item) => this.normalizeDeviceSnapshotCode(item))
|
|
|
.filter(Boolean);
|
|
|
},
|
|
|
+ isDeviceSnapshotCodeMatched(row, snapshotCodes) {
|
|
|
+ if (!row || !snapshotCodes) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return this.getDeviceSnapshotCandidateCodes(row).some(
|
|
|
+ (code) => snapshotCodes[code]
|
|
|
+ );
|
|
|
+ },
|
|
|
+ isDeviceSnapshotRestrictionEnabled(process = null) {
|
|
|
+ const taskId = process?.id || this.processId;
|
|
|
+ const requestKey = this.getDeviceSnapshotRequestKey(taskId);
|
|
|
+ if (
|
|
|
+ !requestKey ||
|
|
|
+ !Object.prototype.hasOwnProperty.call(
|
|
|
+ this.deviceSnapshotMap,
|
|
|
+ requestKey
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const snapshotCodes = this.deviceSnapshotMap[requestKey] || {};
|
|
|
+ if (Object.keys(snapshotCodes).length === 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const list = Array.isArray(process?.list) ? process.list : [];
|
|
|
+ return list.some((row) =>
|
|
|
+ this.isDeviceSnapshotCodeMatched(row, snapshotCodes)
|
|
|
+ );
|
|
|
+ },
|
|
|
isDeviceSnapshotLocked(row, process = null) {
|
|
|
if (!row) {
|
|
|
return false;
|
|
|
@@ -436,14 +467,15 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
const snapshotCodes = this.deviceSnapshotMap[requestKey] || {};
|
|
|
- return !this.getDeviceSnapshotCandidateCodes(row).some(
|
|
|
- (code) => snapshotCodes[code]
|
|
|
- );
|
|
|
+ if (!this.isDeviceSnapshotRestrictionEnabled(process)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return !this.isDeviceSnapshotCodeMatched(row, snapshotCodes);
|
|
|
},
|
|
|
getDeviceSnapshotLockTip() {
|
|
|
return '该工序已制定设备类型';
|
|
|
},
|
|
|
- getDeviceSnapshotLockedCodes(process) {
|
|
|
+ getDeviceSnapshotAllowedCodes(process) {
|
|
|
const requestKey = this.getDeviceSnapshotRequestKey(
|
|
|
process?.id || this.processId
|
|
|
);
|
|
|
@@ -612,7 +644,7 @@ export default {
|
|
|
}
|
|
|
if (item.quantity == 0) {
|
|
|
this.$message.warning('请检查所选数据的数量不能为0');
|
|
|
- digit = false;
|
|
|
+ flag = false;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -706,7 +738,8 @@ export default {
|
|
|
index,
|
|
|
1,
|
|
|
this.form.teamId,
|
|
|
- this.getDeviceSnapshotLockedCodes(item)
|
|
|
+ this.getDeviceSnapshotAllowedCodes(item),
|
|
|
+ this.isDeviceSnapshotRestrictionEnabled(item)
|
|
|
);
|
|
|
},
|
|
|
|