From 4790b2ec0ec94d74b53d62c74a664d97e2d6e3f1 Mon Sep 17 00:00:00 2001 From: lxd <1004405501@qq.com> Date: Tue, 9 Jul 2024 21:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BD=AC=E6=8D=A2=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=A0=BC=E5=BC=8F=E6=96=B9=E6=B3=95=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9examDate=5Fradio=5Fchange=20=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/tblist/patientexamlist/index.vue | 39 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/views/tblist/patientexamlist/index.vue b/src/views/tblist/patientexamlist/index.vue index 6bdfad5b..1ed3a3ff 100644 --- a/src/views/tblist/patientexamlist/index.vue +++ b/src/views/tblist/patientexamlist/index.vue @@ -432,9 +432,28 @@ const examDate_radio_value = ref(1); const examDate_radio_change = ()=>{ if([1,2,3,4].includes(examDate_radio_value.value)) { - //switch case - queryParams.examDate=['2024-07-01 00:00:00','2024-07-09 23:59:59']; - + let timesta = new Date() + let timeend = new Date() + //判断当前选择的是那个时间 + if (examDate_radio_value.value===1) { + + queryParams.examDate=[nowDate(timesta),nowDate(timeend)]; + } else if (examDate_radio_value.value===2) + { + timesta.setDate(timesta.getDate() - 1) + queryParams.examDate=[nowDate(timesta),nowDate(timeend)]; + } + else if(examDate_radio_value.value===3) + { + timesta.setDate(timesta.getDate() - 3) + queryParams.examDate=[nowDate(timesta),nowDate(timeend)]; + } + else if(examDate_radio_value.value===4) + { + timesta.setDate(timesta.getDate() - 7) + queryParams.examDate=[nowDate(timesta),nowDate(timeend)]; + } + handleQuery(); }else if(5===examDate_radio_value.value) { @@ -442,6 +461,20 @@ const examDate_radio_change = ()=>{ } } +///转换时间格式 +function nowDate(time) { + var year = time.getFullYear(); // 年 + var month = (time.getMonth() + 1).toString().padStart(2, '0'); // 月 + var date = time.getDate().toString().padStart(2, '0'); // 日 + var hour = time.getHours().toString().padStart(2, '0'); // 时 + var minute = time.getMinutes().toString().padStart(2, '0'); // 分 + var second = time.getSeconds().toString().padStart(2, '0'); // 秒 + return ( + year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second + ) + } + + /** 查询列表 */ const getList = async () => {