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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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