日历-左上角年份,弹窗右上角x,优化打开多个弹窗可分别关闭对应.

This commit is contained in:
XaoLi717 2024-12-10 10:39:36 +08:00
parent f3bf65cbaf
commit 05a497c40a

View File

@ -1,13 +1,21 @@
<template>
<ContentWrap>
<el-row>
<el-col :span="4">
<span style="font-size: 24px">
{{currentYear}}&nbsp;
</span>
</el-col>
<el-col :span="20">
<el-button-group style="display: flex; justify-content: space-between;">
<el-button size="large" @click="selectDate(-1)">上年</el-button>
<el-button size="large" @click="toYear()">今年</el-button>
<el-button size="large" @click="selectDate(1)">下年</el-button>
<el-button size="large" @click="getListDate()">刷新</el-button>
<!-- <el-button size="small" @click="createDate()">创建</el-button>-->
<!-- <el-button size="small" @click="createDate()">创建</el-button>-->
</el-button-group>
</el-col>
</el-row>
<el-row v-if="loading" :gutter="10">
<el-col v-for="(month, index) in months" :key="index" :span="6" >
@ -40,9 +48,18 @@
</span>
</div>
</template>
<!-- 右上角关闭按钮 -->
<el-button
type="text"
style="position: absolute; top: 2px; right: 10px; padding: 0;"
@click="closePopover(data)"
>
<el-icon class="el-icon--right"><Close /></el-icon>
</el-button>
<el-form
ref="formRef"
:model="formDataCaln"
style="margin-top: 20px"
label-width="70px"
>
<el-form-item label="状态" >
@ -67,7 +84,7 @@
</el-select>
</el-form-item>
</el-form>
<el-button size="small" @click="submitForm();" type="primary">确定</el-button>
<el-button size="small" @click="submitForm(data);" type="primary">确定</el-button>
</el-popover>
</template>
@ -83,6 +100,7 @@
import {CalendarInstance} from "element-plus";
import {CalendarApi, CalendarVO} from "@/api/home/calendar";
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import {Close} from "@element-plus/icons-vue";
defineOptions({ name: 'CalendarAgendaIndex' })
@ -201,7 +219,9 @@ const handleSelect = async (date:any) => {
};
//
const submitForm = async ()=> {
const submitForm = async (date:any)=> {
//
await getDate(date);
const dataClan = formDataCaln.value as unknown as CalendarVO
//
try {
@ -219,7 +239,14 @@ const submitForm = async ()=> {
//
updatedHoliday.visible = false;
}
const closePopover = async (date:any)=> {
//
await getDate(date);
//
const updatedHoliday = holidayDate.value[sDate.value];
//
updatedHoliday.visible = false;
}
//
function formatDate2(dat: number|Date) {
const date = new Date(dat)