fix(工作台): 修复工作台卡片项目切换人员偶发性bug

This commit is contained in:
xinxin.wu 2024-11-27 16:42:22 +08:00 committed by 刘瑞斌
parent 82fc924888
commit dd0c8e2295
3 changed files with 34 additions and 20 deletions

View File

@ -22,7 +22,6 @@
<MsSelect
v-model:model-value="innerHandleUsers"
:options="memberOptions"
allow-clear
allow-search
:search-keys="['label']"
class="!w-[220px]"
@ -176,19 +175,26 @@
label: e.text,
value: e.value,
}));
innerHandleUsers.value = memberOptions.value.map((e) => e.value);
}
async function handleProjectChange(isRefreshKey: boolean = false) {
async function handleProjectChange(isRefreshKey: boolean = false, setAll = false) {
await nextTick();
if (!isRefreshKey) {
await getMemberOptions();
if (setAll) {
innerHandleUsers.value = [...memberOptions.value.map((e) => e.value)];
} else {
innerHandleUsers.value = innerHandleUsers.value.filter((id: string) =>
memberOptions.value.some((member) => member.value === id)
);
}
}
await getDefectMemberDetail();
await nextTick();
getDefectMemberDetail();
}
async function changeProject() {
await handleProjectChange(false);
await handleProjectChange(false, true);
emit('change');
}
@ -234,9 +240,12 @@
}
);
watch([() => props.refreshKey, () => projectId.value], ([refreshKey]) => {
handleProjectChange(!!refreshKey);
});
watch(
() => props.refreshKey,
(refreshKey) => {
handleProjectChange(!!refreshKey);
}
);
onMounted(() => {
handleProjectChange(false);

View File

@ -10,7 +10,6 @@
<MsSelect
v-model:model-value="innerProjectIds"
:options="appStore.projectList"
allow-clear
allow-search
value-key="id"
label-key="name"
@ -172,7 +171,6 @@
}
function handleProjectChange(shouldEmit = false) {
//
nextTick(() => {
innerSelectAll.value = selectAll.value;
initOverViewDetail();

View File

@ -19,13 +19,10 @@
@change="changeProject"
>
</MsSelect>
<MsSelect
v-model:model-value="innerHandleUsers"
:options="memberOptions"
allow-search
allow-clear
:placeholder="t('ms.case.associate.allData')"
value-key="value"
label-key="label"
:search-keys="['label']"
@ -146,19 +143,26 @@
label: e.name,
value: e.id,
}));
innerHandleUsers.value = memberOptions.value.map((e) => e.value);
}
async function handleProjectChange(isRefreshKey: boolean = false) {
async function handleProjectChange(isRefreshKey: boolean = false, setAll = false) {
await nextTick();
if (!isRefreshKey) {
await getMemberOptions();
if (setAll) {
innerHandleUsers.value = [...memberOptions.value.map((e) => e.value)];
} else {
innerHandleUsers.value = innerHandleUsers.value.filter((id: string) =>
memberOptions.value.some((member) => member.value === id)
);
}
}
await initOverViewMemberDetail();
await nextTick();
initOverViewMemberDetail();
}
async function changeProject() {
await handleProjectChange(false);
await handleProjectChange(false, true);
emit('change');
}
@ -204,9 +208,12 @@
}
);
watch([() => props.refreshKey, () => projectId.value], ([refreshKey]) => {
handleProjectChange(!!refreshKey);
});
watch(
() => props.refreshKey,
(refreshKey) => {
handleProjectChange(!!refreshKey);
}
);
onMounted(() => {
handleProjectChange(false);