feat(personal-center): 重构个人事项详情并复用任务工作日志组件

This commit is contained in:
caozehui
2026-05-22 10:46:46 +08:00
parent 62859bfc38
commit ab882e085b
13 changed files with 547 additions and 1207 deletions

View File

@@ -1,9 +1,12 @@
<script setup lang="ts">
import { computed } from 'vue';
import { computed, watch } from 'vue';
import { useDictStore } from '@/store/modules/dict';
import { useDict } from '@/hooks/business/dict';
defineOptions({ name: 'DictSelect' });
const ensuredEmptyDictCodes = new Set<string>();
interface Props {
dictCode: string;
placeholder?: string;
@@ -34,6 +37,7 @@ const model = defineModel<string | number | Array<string | number> | null | unde
default: undefined
});
const dictStore = useDictStore();
const { enabledDictData, dictData } = useDict(() => props.dictCode);
const dictOptions = computed(() => {
@@ -53,6 +57,19 @@ const selectedColorType = computed<string | null>(() => {
if (value === null || value === undefined || value === '') return null;
return dictOptions.value.find(opt => opt.value === value)?.colorType ?? null;
});
watch(
() => [props.dictCode, dictOptions.value.length, dictStore.initialized, dictStore.loading] as const,
async ([dictCode, optionCount, initialized, loading]) => {
if (!dictCode || optionCount > 0 || !initialized || loading || ensuredEmptyDictCodes.has(dictCode)) {
return;
}
ensuredEmptyDictCodes.add(dictCode);
await dictStore.ensureDictData(dictCode, true);
},
{ immediate: true }
);
</script>
<template>