增加转换时间格式方法 修改examDate_radio_change 内容

This commit is contained in:
lxd 2024-07-09 21:27:53 +08:00
parent fc9010db2a
commit 4790b2ec0e

View File

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