fix(权限): 导入权限联动创建权限

This commit is contained in:
baiqi 2024-08-14 14:00:45 +08:00 committed by 刘瑞斌
parent ba1a23b8f6
commit aca18a4057
1 changed files with 14 additions and 7 deletions

View File

@ -370,24 +370,31 @@
const existRead = record.perChecked.some(
(item: string) => item.split(':')[0] === preStr && item.split(':')[1] === 'READ'
);
const existCreate = record.perChecked.some(
(item: string) => item.split(':')[0] === preStr && item.split(':')[1] === 'ADD'
);
if (!existRead && postStr !== 'READ') {
record.perChecked.push(`${preStr}:READ`);
}
if (!existCreate && lastEditStr === 'IMPORT') {
if (lastEditStr === 'IMPORT') {
//
record.perChecked.push(`${preStr}:ADD`);
record.perChecked.push(`${preStr}:READ+UPDATE`);
if (!record.perChecked.includes(`${preStr}:READ+ADD`)) {
record.perChecked.push(`${preStr}:READ+ADD`);
}
if (!record.perChecked.includes(`${preStr}:READ+UPDATE`)) {
record.perChecked.push(`${preStr}:READ+UPDATE`);
}
}
} else {
//
const preStr = currentValue.split(':')[0];
const postStr = currentValue.split(':')[1];
const lastEditStr = currentValue.split('+')[1]; // +
if (postStr === 'READ') {
//
//
record.perChecked = record.perChecked.filter((item: string) => !item.includes(preStr));
} else if (['ADD', 'UPDATE'].includes(lastEditStr)) {
//
record.perChecked = record.perChecked.filter(
(item: string) => !item.includes('IMPORT') && item !== currentValue
);
} else {
record.perChecked.splice(record.perChecked.indexOf(currentValue), 1);
}