fix(工作台): 修复工作台卡片项目切换人员偶发性bug
This commit is contained in:
parent
82fc924888
commit
dd0c8e2295
|
@ -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]) => {
|
||||
watch(
|
||||
() => props.refreshKey,
|
||||
(refreshKey) => {
|
||||
handleProjectChange(!!refreshKey);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
handleProjectChange(false);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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]) => {
|
||||
watch(
|
||||
() => props.refreshKey,
|
||||
(refreshKey) => {
|
||||
handleProjectChange(!!refreshKey);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
handleProjectChange(false);
|
||||
|
|
Loading…
Reference in New Issue