feat: 报警管理 日期选择优化

This commit is contained in:
LokerL 2024-12-15 20:02:08 +08:00
parent 7389545496
commit 285df1f96b
2 changed files with 7 additions and 15 deletions

View File

@ -22,7 +22,7 @@
<el-form-item> <el-form-item>
<span>日期</span> <span>日期</span>
<el-date-picker v-model="dateList" type="daterange" range-separator="" start-placeholder="开始日期" <el-date-picker v-model="dateList" type="daterange" range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"> end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -160,6 +160,7 @@ import sendMsg from "@/views/demostrate/alarm/sendMsg";
import dealAlarm from "@/views/demostrate/alarm/dealAlarm"; import dealAlarm from "@/views/demostrate/alarm/dealAlarm";
import DeptTree from "@/components/DeptTree/index.vue"; import DeptTree from "@/components/DeptTree/index.vue";
import { BmlHeatmap } from "vue-baidu-map"; // import { BmlHeatmap } from "vue-baidu-map"; //
import moment from "moment";
export default { export default {
name: "alarm", name: "alarm",
components: { sendMsg, dealAlarm, DeptTree, BmlHeatmap }, components: { sendMsg, dealAlarm, DeptTree, BmlHeatmap },
@ -261,8 +262,8 @@ export default {
}, },
getList() { getList() {
if (this.dateList && this.dateList.length > 0) { if (this.dateList && this.dateList.length > 0) {
this.queryParams.startTime = this.dateList[0]; this.queryParams.startTime = moment(this.dateList[0]).format("YYYY-MM-DD 00:00:00");
this.queryParams.endTime = this.dateList[1]; this.queryParams.endTime = moment(this.dateList[1]).format("YYYY-MM-DD 23:59:59");
} else { } else {
this.queryParams.startTime = null; this.queryParams.startTime = null;
this.queryParams.endTime = null; this.queryParams.endTime = null;
@ -272,8 +273,8 @@ export default {
this.queryParams.name = this.queryParamsName; this.queryParams.name = this.queryParamsName;
} }
if (this.queryParamsDate && this.queryParamsDate.length > 0) { if (this.queryParamsDate && this.queryParamsDate.length > 0) {
this.queryParams.startTime = this.queryParamsDate[0]; this.queryParams.startTime = moment(this.queryParamsDate[0]).format("YYYY-MM-DD 00:00:00");
this.queryParams.endTime = this.queryParamsDate[1]; this.queryParams.endTime = moment(this.queryParamsDate[1]).format("YYYY-MM-DD 23:59:59");
} }
listAlarm(this.queryParams).then((response) => { listAlarm(this.queryParams).then((response) => {
this.dataList = response.rows; this.dataList = response.rows;
@ -307,15 +308,10 @@ export default {
this.queryParams.dealUser = null; this.queryParams.dealUser = null;
this.queryParams.startTime = null; this.queryParams.startTime = null;
this.queryParams.endTime = null; this.queryParams.endTime = null;
this.queryParamsName = null;
this.queryParamsDate = [];
this.getList(); this.getList();
}, },
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.queryParamsName = null;
this.queryParamsDate = [];
this.getList(); this.getList();
}, },
handleSizeChange(val) { handleSizeChange(val) {

View File

@ -167,11 +167,7 @@ export default {
clickAlarmTag(row) { clickAlarmTag(row) {
this.dialogAlarmVisible = true; this.dialogAlarmVisible = true;
this.queryParamsName = row.name; this.queryParamsName = row.name;
// 00:00:00 this.queryParamsDate = [...this.dateList];
this.queryParamsDate = [
moment(this.dateList[0]).format("YYYY-MM-DD 00:00:00"),
moment(this.dateList[1]).format("YYYY-MM-DD 23:59:59"),
];
}, },
dateChange() { dateChange() {
this.queryDebounce(); this.queryDebounce();