日历优化一次字典数据

This commit is contained in:
XaoLi717 2024-12-10 15:16:28 +08:00
parent ac3d70f44f
commit 1178f84422

View File

@ -46,13 +46,13 @@
<template #reference> <template #reference>
<div @click="handleSelect(data)" :class="{ 'holidayWork': holidayDate[data.day]?.isWorkday }"> <div @click="handleSelect(data)" :class="{ 'holidayWork': holidayDate[data.day]?.isWorkday }">
<span style="font-size: 12px"> <span style="font-size: 12px">
{{ formatDate2(data.date) === current? data.date.getDate()+'(今天)':data.date.getDate() }} {{ formatDate2(data.date) === current? `${data.date.getDate()}(今天)`:data.date.getDate() }}
</span> </span>
<span <span
v-if="holidayDate[data.day]?.content !== ''&&holidayDate[data.day]?.content !== null&&holidayDate[data.day]?.content !== undefined" v-if="holidayDate[data.day]?.content !== ''&&holidayDate[data.day]?.content !== null&&holidayDate[data.day]?.content !== undefined"
style="font-size: 12px" style="font-size: 12px"
> >
{{'('+getIntDictOptions(DICT_TYPE.CALENDAR_CONTENT)[holidayDate[data.day]?.content].label+')'}} ({{dictData[holidayDate[data.day]?.content].label}})
</span> </span>
</div> </div>
</template> </template>
@ -107,7 +107,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {CalendarInstance} from "element-plus"; import {CalendarInstance} from "element-plus";
import {CalendarApi, CalendarVO} from "@/api/home/calendar"; import {CalendarApi, CalendarVO} from "@/api/home/calendar";
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import {getIntDictOptions, DICT_TYPE, NumberDictDataType} from '@/utils/dict'
import {Close} from "@element-plus/icons-vue"; import {Close} from "@element-plus/icons-vue";
defineOptions({ name: 'CalendarAgendaIndex' }) defineOptions({ name: 'CalendarAgendaIndex' })
@ -285,8 +285,16 @@ const toYear = () => {
currentYear.value = new Date().getFullYear() currentYear.value = new Date().getFullYear()
} }
//
let dictData:NumberDictDataType[] = [];
//
const getDict = async ()=> {
dictData = getIntDictOptions(DICT_TYPE.CALENDAR_CONTENT);
}
// //
onMounted( async ()=> { onMounted( async ()=> {
await getDict()
await getListDate() await getListDate()
}) })