fix(系统设置): 修复只启用测试跟踪模块后,测试计划仍可以关联别的模块的缺陷

--bug=1032032 --user=王孝刚 【系统设置】项目配额管理中仅启用了测试跟踪模块,测试计划中可以关联其他模块的用例
https://www.tapd.cn/55049933/s/1427478
This commit is contained in:
wxg0103 2023-10-18 10:43:57 +08:00 committed by 刘瑞斌
parent 68ecf04503
commit c9bf47b03d
1 changed files with 17 additions and 5 deletions

View File

@ -1,7 +1,20 @@
function enableModules(...modules) {
for (let module of modules) {
let modules = JSON.parse(localStorage.getItem('modules'));
if (modules && modules[module] === 'DISABLE') {
let modules = JSON.parse(localStorage.getItem("modules"));
if (module === "project" || module === "setting") {
return modules && modules[module] === "ENABLE";
}
let projectModules = JSON.parse(sessionStorage.getItem("project_modules"));
if (projectModules && projectModules.length > 0) {
return (
modules[module] === "ENABLE" && projectModules.indexOf(modules) > -1
);
}
let workModules = JSON.parse(sessionStorage.getItem("workspace_modules"));
if (workModules && workModules.length > 0) {
return modules[module] === "ENABLE" && workModules.indexOf(modules) > -1;
}
if (modules && modules[module] === "DISABLE") {
return false;
}
}
@ -9,7 +22,7 @@ function enableModules(...modules) {
}
function checkModule(el, binding) {
const {value} = binding;
const { value } = binding;
if (value && value instanceof Array && value.length > 0) {
let v = enableModules(...value);
if (!v) {
@ -21,6 +34,5 @@ function checkModule(el, binding) {
export default {
inserted(el, binding) {
checkModule(el, binding);
}
},
};