fix(工作台): 修复工作台首页卡片查询项目权限关闭后刷新bug

This commit is contained in:
xinxin.wu 2024-11-22 12:15:15 +08:00 committed by Craftsman
parent f991a3b2dd
commit 323f839b39
12 changed files with 112 additions and 142 deletions

View File

@ -296,16 +296,15 @@
}
function changeProject() {
nextTick(async () => {
await initApiOrScenarioCount();
nextTick(() => {
emit('change');
if (hasPermission.value) {
initApiCountRate();
}
});
}
const isInit = ref<boolean>(true);
onMounted(() => {
isInit.value = false;
initApiOrScenarioCount();
});
@ -330,13 +329,14 @@
);
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
}
}
},
{ immediate: true }
);
watch(
@ -360,14 +360,13 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
initApiOrScenarioCount();
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
await initApiOrScenarioCount();
if (hasPermission.value && !isInit.value) {
initApiCountRate();
}
}
);
});
</script>
<style scoped lang="less">

View File

@ -190,7 +190,6 @@
function changeProject() {
nextTick(() => {
initData();
emit('change');
});
}
@ -200,13 +199,14 @@
});
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
}
}
},
{ immediate: true }
);
watch(
@ -230,14 +230,10 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
initData();
}
}
);
});
</script>
<style scoped></style>

View File

@ -192,15 +192,13 @@
function changeProject() {
nextTick(async () => {
await initApiCount();
emit('change');
if (hasPermission.value) {
initApiCountRate();
}
});
}
const isInit = ref(true);
onMounted(() => {
isInit.value = false;
initApiCount();
emit('change');
});
@ -235,13 +233,14 @@
);
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
}
}
},
{ immediate: true }
);
watch(
@ -265,14 +264,13 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
initApiCount();
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
await initApiCount();
if (hasPermission.value && !isInit.value) {
initApiCountRate();
}
}
);
});
</script>
<style scoped lang="less">

View File

@ -157,7 +157,6 @@
function changeProject() {
nextTick(() => {
initCaseCount();
emit('change');
});
}
@ -167,21 +166,23 @@
});
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
}
}
},
{ immediate: true }
);
watch(
() => projectId.value,
(val) => {
if (val) {
innerProjectIds.value = [val];
}
},
{
immediate: true,
}
);
@ -197,14 +198,10 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
initCaseCount();
}
}
);
});
</script>
<style scoped lang="less"></style>

View File

@ -135,7 +135,6 @@
function changeProject() {
nextTick(() => {
initReviewCount();
emit('change');
});
}
@ -145,13 +144,14 @@
});
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
}
}
},
{ immediate: true }
);
watch(
@ -175,14 +175,10 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
initReviewCount();
}
}
);
});
</script>
<style scoped lang="less"></style>

View File

@ -168,7 +168,6 @@
function changeProject() {
nextTick(() => {
initCount();
emit('change');
});
}
@ -178,14 +177,14 @@
});
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
},
{
immediate: true,
}
},
{ immediate: true }
);
watch(
@ -210,14 +209,10 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
initCount();
}
}
);
});
</script>
<style scoped lang="less"></style>

View File

@ -80,8 +80,6 @@
required: true,
});
const memberIds = ref<string[]>(innerHandleUsers.value);
const timeForm = inject<Ref<TimeFormParams>>(
'timeForm',
ref({
@ -179,10 +177,8 @@
}
function changeProject() {
memberIds.value = [];
innerHandleUsers.value = [];
nextTick(() => {
getMemberOptions();
getDefectMemberDetail();
emit('change');
});
}
@ -195,13 +191,14 @@
}
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
}
}
},
{ immediate: true }
);
watch(
@ -225,15 +222,11 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
getMemberOptions();
getDefectMemberDetail();
}
}
);
});
onMounted(() => {
getMemberOptions();

View File

@ -223,7 +223,6 @@
function changeProject() {
if (isInit.value) return;
nextTick(() => {
initOverViewDetail();
emit('change');
});
}
@ -260,6 +259,11 @@
}
}
);
watch([() => props.refreshKey, () => innerProjectIds.value], async () => {
await nextTick();
initOverViewDetail();
});
</script>
<style scoped lang="less">

View File

@ -179,6 +179,7 @@
value: e.id,
}));
}
const isInit = ref(true);
function changeProject() {
innerHandleUsers.value = [];
@ -197,14 +198,14 @@
}
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
innerHandleUsers.value = [];
}
}
},
{ immediate: true }
);
watch(
@ -213,7 +214,8 @@
if (val) {
innerProjectIds.value = [val];
}
}
},
{ immediate: true }
);
watch(
@ -229,23 +231,20 @@
);
onMounted(() => {
isInit.value = false;
initOverViewMemberDetail();
if (props.item.projectIds.length) {
getMemberOptions();
}
});
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
initOverViewMemberDetail();
if (props.item.projectIds.length) {
getMemberOptions();
}
}
}
);
});
</script>
<style scoped lang="less"></style>

View File

@ -128,7 +128,6 @@
function changeProject() {
nextTick(() => {
getRelatedCaseCount();
emit('change');
});
}
@ -168,14 +167,12 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async ([refreshKey]) => {
if (refreshKey) {
await nextTick();
getRelatedCaseCount();
}
}
);
});
</script>
<style scoped lang="less"></style>

View File

@ -250,7 +250,6 @@
function changeProject() {
nextTick(() => {
initTestPlanCount();
emit('change');
});
}
@ -265,17 +264,19 @@
if (val) {
innerProjectIds.value = [val];
}
}
},
{ immediate: true }
);
watch(
() => innerProjectIds.value,
() => props.item.projectIds,
(val) => {
if (val) {
const [newProjectId] = val;
projectId.value = newProjectId;
}
}
},
{ immediate: true }
);
watch(
@ -290,14 +291,10 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
initTestPlanCount();
}
}
);
});
</script>
<style scoped lang="less">

View File

@ -205,6 +205,7 @@
handleUsers: [],
});
await loadList();
isNoPermission.value = false;
} catch (error) {
isNoPermission.value = error === 'no_project_permission';
// eslint-disable-next-line no-console
@ -217,7 +218,6 @@
function changeProject() {
nextTick(() => {
initData();
emit('change');
});
}
@ -227,12 +227,14 @@
});
watch(
() => projectId.value,
() => props.item.projectIds,
(val) => {
if (val) {
innerProjectIds.value = [val];
}
const [newProjectId] = val;
projectId.value = newProjectId;
}
},
{ immediate: true }
);
watch(
@ -241,7 +243,8 @@
if (val) {
innerProjectIds.value = [val];
}
}
},
{ immediate: true }
);
watch(
@ -256,14 +259,10 @@
}
);
watch(
() => props.refreshKey,
(val) => {
if (val) {
watch([() => props.refreshKey, () => projectId.value], async () => {
await nextTick();
initData();
}
}
);
});
</script>
<style scoped></style>