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 () => {