From ea48f387b8cd0037e6bb84707da403e4542465b4 Mon Sep 17 00:00:00 2001 From: XaoLi717 <144221124+XaoLi717@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:03:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E5=AF=BC=E6=97=A5=E7=A8=8B=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E4=BC=9A=E8=AE=AE=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=20=E6=9B=B4=E6=96=B0=20=E6=82=AC=E6=B5=AE=E6=98=BE=E7=A4=BA=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=87=E6=8D=A2=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home/hygl/hyinfo/index.vue | 118 +++++++++++++++++-------- src/views/Home/rcgl/rcglInfo/index.vue | 75 ++++++++++++---- 2 files changed, 137 insertions(+), 56 deletions(-) diff --git a/src/views/Home/hygl/hyinfo/index.vue b/src/views/Home/hygl/hyinfo/index.vue index 9bb391f..d229009 100644 --- a/src/views/Home/hygl/hyinfo/index.vue +++ b/src/views/Home/hygl/hyinfo/index.vue @@ -1,29 +1,34 @@ @@ -46,30 +65,32 @@ import { CalendarInstance} from 'element-plus'; import { HyglApi, HyglVO } from '@/api/home/hygl' import HyInfoForm from "@/views/Home/hygl/hyinfo/HyInfoForm.vue"; +import {DICT_TYPE, getIntDictOptions} from "@/utils/dict"; defineOptions({ name: 'HyInfo' }) - +//获取年月日自定义当前时间 const currentDay = ref(new Date().getDate()) // 获取当前天份 const currentMonth = ref(new Date().getMonth()) // 获取当前年份 const currentYear = ref(new Date().getFullYear()) // 获取当前年份 -//改变月份 +//改变根据相应按钮传过来的值改变月份 const selectDate = (val:number) => { if (!val){ return } currentMonth.value+=val - console.log("today",currentYear.value,currentMonth.value,currentDay.value) } -//回到今天 +//年日是不变的只改变月 所以我只需要拿到今天月的信息就好了 const today = () => { currentMonth.value = new Date().getMonth() // 获取当前月份 } + /** 添加/修改操作 */ const formRef = ref() -//根据id获取数据 +//根据id打开详情表单获取数据查看详情 const getHygl = async (id:number)=>{ formRef.value.open(id) } +//日历组件对应的数据对象 const calendar = ref() // 获取当前日期和14天前的日期 @@ -77,7 +98,7 @@ const endDate2 = new Date(); const startDate2 = new Date(); startDate2.setDate(endDate2.getDate() - 14); // 设置14天前的日期 -//获取详细日期时间 +//获取详细日期时间 年月日时分秒 function formatDate(date: Date,time:boolean) { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以加1 @@ -87,25 +108,16 @@ function formatDate(date: Date,time:boolean) { const seconds =time? '59' : '00'; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; } -// 获取日期 -function formatDate2(dat: number) { +// 获取日期时间 年月日 +function formatDate2(dat: number|Date) { const date = new Date(dat) const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以加1 const day = String(date.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; } -// function formatDate(date: Date,time:boolean) { -// const year = date.getFullYear(); -// const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以加1 -// const day = String(date.getDate()).padStart(2, '0'); -// const hours =time? String(date.getHours()).padStart(2, '0') : '00'; -// const minutes =time? String(date.getMinutes()).padStart(2, '0') : '00'; -// const seconds =time? String(date.getSeconds()).padStart(2, '0') : '00'; -// return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; -// } -/** 获取数据 */ +/** 获取数据 我默认设置获取50条数据 不够可以调整 */ const handleQuery = () => { queryParamsHygl.pageNo = 1 queryParamsHygl.createTime = [formatDate(startDate2,false),formatDate(endDate2,true)]//设置时间区域 @@ -113,6 +125,7 @@ const handleQuery = () => { } const listHygl = ref([]) // 列表的数据 +//对应的搜索模型 const queryParamsHygl = reactive({ pageNo: 1, pageSize: 50, @@ -142,6 +155,7 @@ const queryParamsHygl = reactive({ processInstanceId: undefined, createTime: [] as string[], }) +//储存获取到的数值信息 const holidays2 = reactive({}); /** 查询列表 */ const getList = async () => { @@ -155,14 +169,32 @@ const getList = async () => { if (!Array.isArray(holidays2[formattedDate])) { holidays2[formattedDate] = []; } - // 将 title 添加到数组中 - holidays2[formattedDate].push({id:item.id,title:item.title}); + // 将自己想要的或去掉的数据有的内容 添加到数组中 最好添加处理好的数值 不要再渲染时去处理 + holidays2[formattedDate].push({ + id:item.id, + title:item.title, + time:formatDate2(item.time), + theme:item.theme, + type:getStatus(item.type), + organizer:item.organizer, + number:item.number, + } + ); } // console.log("holidays2",holidays2) } finally { } } - +//获取字典值的方法 看看这样获取到的值的内容就知道了 +const getStatus = (status:number)=>{ + const dict = getIntDictOptions(DICT_TYPE.HYGL_TYPE); + for (let item of dict){ + if (item.value === status){ + return item.label + } + } +} +//初始化拿一下数据列表的值来渲染日历表 onMounted(()=> { handleQuery() }) @@ -177,6 +209,7 @@ onMounted(()=> { height: 100%; font-size: 16px; } +/*设置日历表最大使用边框 还有来个小圆角*/ .custom-calendar { width: 100%; height: 100%; @@ -188,6 +221,12 @@ onMounted(()=> { }