|
@@ -704,9 +704,15 @@
|
|
|
const code = this.getRowDeviceCode(row);
|
|
const code = this.getRowDeviceCode(row);
|
|
|
return !!code && codes.has(code);
|
|
return !!code && codes.has(code);
|
|
|
},
|
|
},
|
|
|
|
|
+ hasDeviceCodeMatch(list = [], codes = new Set()) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ !!codes.size &&
|
|
|
|
|
+ (list || []).some((item) => this.isDeviceCodeAllowed(item, codes))
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
isDeviceTypeLimitedSelection(item, process) {
|
|
isDeviceTypeLimitedSelection(item, process) {
|
|
|
const codes = this.getDeviceAllowedCodes(process?.id || this.processId);
|
|
const codes = this.getDeviceAllowedCodes(process?.id || this.processId);
|
|
|
- if (!codes.size) return false;
|
|
|
|
|
|
|
+ if (!this.hasDeviceCodeMatch(process?.list || [], codes)) return false;
|
|
|
if (item && typeof item === 'object') {
|
|
if (item && typeof item === 'object') {
|
|
|
return !this.isDeviceCodeAllowed(item, codes);
|
|
return !this.isDeviceCodeAllowed(item, codes);
|
|
|
}
|
|
}
|
|
@@ -723,7 +729,12 @@
|
|
|
applyDeviceLimitToList(list = [], dataRow) {
|
|
applyDeviceLimitToList(list = [], dataRow) {
|
|
|
if (!dataRow || dataRow.assignType != 1) return list;
|
|
if (!dataRow || dataRow.assignType != 1) return list;
|
|
|
const codes = this.getDeviceAllowedCodes(dataRow?.id || this.processId);
|
|
const codes = this.getDeviceAllowedCodes(dataRow?.id || this.processId);
|
|
|
- if (!codes.size) return list;
|
|
|
|
|
|
|
+ if (!this.hasDeviceCodeMatch(list, codes)) {
|
|
|
|
|
+ return (list || []).map((item) => ({
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ __deviceTypeLimited: false
|
|
|
|
|
+ }));
|
|
|
|
|
+ }
|
|
|
return (list || []).map((item) => ({
|
|
return (list || []).map((item) => ({
|
|
|
...item,
|
|
...item,
|
|
|
__deviceTypeLimited: !this.isDeviceCodeAllowed(item, codes)
|
|
__deviceTypeLimited: !this.isDeviceCodeAllowed(item, codes)
|
|
@@ -732,7 +743,7 @@
|
|
|
clearDeviceLimitedSelection(process) {
|
|
clearDeviceLimitedSelection(process) {
|
|
|
if (!process) return;
|
|
if (!process) return;
|
|
|
const codes = this.getDeviceAllowedCodes(process.id || this.processId);
|
|
const codes = this.getDeviceAllowedCodes(process.id || this.processId);
|
|
|
- if (!codes.size) return;
|
|
|
|
|
|
|
+ if (!this.hasDeviceCodeMatch(process.list || [], codes)) return;
|
|
|
const nextSelection = (process.selection || []).filter((item) => {
|
|
const nextSelection = (process.selection || []).filter((item) => {
|
|
|
return !this.isDeviceTypeLimitedSelection(item, process);
|
|
return !this.isDeviceTypeLimitedSelection(item, process);
|
|
|
});
|
|
});
|