fix(工作台): 修复工作台项目概览默认选中全部bug

This commit is contained in:
xinxin.wu 2024-11-25 19:23:08 +08:00 committed by Craftsman
parent d4f300266a
commit 36f6a41288
2 changed files with 13 additions and 18 deletions

View File

@ -349,6 +349,15 @@ export default defineComponent(
} }
}); });
watch(
() => props.defaultAllSelect,
(val) => {
if (val) {
handleSelectAllChange(true);
}
}
);
// 检测全选状态变化,全选时需要覆盖选择器的输入框内容,展示文本 ‘全部’;非全选时则移除文本 ‘全部’ // 检测全选状态变化,全选时需要覆盖选择器的输入框内容,展示文本 ‘全部’;非全选时则移除文本 ‘全部’
watchEffect(() => { watchEffect(() => {
const innerDom = selectRef.value?.$el.nextElementSibling.querySelector('.arco-select-view-inner') as HTMLElement; const innerDom = selectRef.value?.$el.nextElementSibling.querySelector('.arco-select-view-inner') as HTMLElement;

View File

@ -19,7 +19,7 @@
:prefix="t('workbench.homePage.project')" :prefix="t('workbench.homePage.project')"
:multiple="true" :multiple="true"
:has-all-select="true" :has-all-select="true"
:default-all-select="innerSelectAll" :default-all-select="props.item.selectAll"
:at-least-one="true" :at-least-one="true"
@change="changeProject" @change="changeProject"
> >
@ -195,6 +195,7 @@
options.value.yAxis[0].max = maxAxis < 100 ? 100 : maxAxis + 50; options.value.yAxis[0].max = maxAxis < 100 ? 100 : maxAxis + 50;
} }
const showSkeleton = ref(false); const showSkeleton = ref(false);
const selectAll = computed(() => appStore.projectList.length === innerProjectIds.value.length);
async function initOverViewDetail() { async function initOverViewDetail() {
try { try {
@ -210,7 +211,7 @@
projectIds: innerProjectIds.value, projectIds: innerProjectIds.value,
organizationId: appStore.currentOrgId, organizationId: appStore.currentOrgId,
handleUsers: [], handleUsers: [],
selectAll: innerSelectAll.value, selectAll: selectAll.value,
}; };
let detail; let detail;
if (props.item.key === WorkCardEnum.PROJECT_VIEW) { if (props.item.key === WorkCardEnum.PROJECT_VIEW) {
@ -232,6 +233,7 @@
function changeProject() { function changeProject() {
if (isInit.value) return; if (isInit.value) return;
nextTick(() => { nextTick(() => {
innerSelectAll.value = selectAll.value;
emit('change'); emit('change');
}); });
} }
@ -241,13 +243,6 @@
initOverViewDetail(); initOverViewDetail();
}); });
watch(
() => innerProjectIds.value,
(val) => {
innerSelectAll.value = val.length === appStore.projectList.length;
}
);
watch( watch(
() => timeForm.value, () => timeForm.value,
(val) => { (val) => {
@ -260,15 +255,6 @@
} }
); );
watch(
() => props.refreshKey,
(val) => {
if (val) {
initOverViewDetail();
}
}
);
watch([() => props.refreshKey, () => innerProjectIds.value], async () => { watch([() => props.refreshKey, () => innerProjectIds.value], async () => {
await nextTick(); await nextTick();
initOverViewDetail(); initOverViewDetail();