You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

202 lines
5.8 KiB

<template>
<div class="monitor-warning">
<div class="flex justify-between mt-12">
<div class="flex items-center">
<el-select
class="w-150"
size="mini"
v-model="dateRange"
@change="handleChangeDate"
>
<el-option label="近1月" value="0"></el-option>
<el-option label="近1日" value="1"></el-option>
<el-option label="近7日" value="2"></el-option>
<el-option label="近3月" value="3"></el-option>
<el-option label="近1年" value="4"></el-option>
</el-select>
<span class="ml-10 mr-6">开始日期</span>
<el-date-picker
class="w-150"
size="mini"
type="date"
v-model="startDate"
placeholder="选择日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
></el-date-picker>
<span class="ml-10 mr-6">结束日期</span>
<el-date-picker
class="w-150"
size="mini"
type="date"
v-model="endDate"
placeholder="选择日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
></el-date-picker>
</div>
<div class="flex items-center">
<el-button type="primary" size="mini" @click="handleSearch"
>查询</el-button
>
<el-button size="mini" @click="handleReset">重置</el-button>
</div>
</div>
<div class="mt-10">
<el-table :data="tableData" border>
<el-table-column label="测站名称">
<template slot-scope="scope">
<span>{{ scope.row.stnm }}</span>
</template>
</el-table-column>
<el-table-column label="测站编码">
<template slot-scope="scope">
<span>{{ scope.row.stcd }}</span>
</template>
</el-table-column>
<el-table-column label="测站类型">
<template slot-scope="scope">
<span>{{ scope.row.sttp }}</span>
</template>
</el-table-column>
<el-table-column label="预警类型">
<template slot-scope="scope">
<span>{{ scope.row.alarmType }}</span>
</template>
</el-table-column>
<el-table-column label="监测数据">
<template slot-scope="scope">
<span>{{ scope.row.monitorData }}</span>
</template>
</el-table-column>
<el-table-column label="监测时间">
<template slot-scope="scope">
<span>{{ scope.row.monitorTime }}</span>
</template>
</el-table-column>
<el-table-column label="预警值" width="100">
<template slot-scope="scope">
<span>{{ scope.row.alarmValue }}</span>
</template>
</el-table-column>
<el-table-column label="预警时间">
<template slot-scope="scope">
<span>{{ scope.row.alarmTime }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="操作" width="120">
<template slot-scope="scope">
<el-button type="text" size="mini">告警处置</el-button>
<el-button type="text" size="mini">解除本次预警</el-button>
</template>
</el-table-column> -->
</el-table>
</div>
</div>
</template>
<script>
import dayjs from "dayjs";
import { getReservoirCZAlarmPageData } from "@/api/reservoir";
export default {
props: {
resCode: {
type: String,
default: "",
},
},
data() {
return {
dateRange: "0",
startDate: dayjs().subtract(1, "month").format("YYYY-MM-DD HH:mm:ss"),
endDate: dayjs().format("YYYY-MM-DD HH:mm:ss"),
paramsData: {
pageSize: 10,
pageNum: 1,
total: 0,
},
tableData: [],
};
},
watch: {
resCode: {
handler(val) {
console.log("resCode-watch >>>>> ", val);
this.getTableData();
},
immediate: true,
},
},
created() {
this.getTableData();
},
methods: {
getTableData() {
getReservoirCZAlarmPageData({
startDate: this.startDate,
endDate: this.endDate,
pageSize: this.paramsData.pageSize,
pageNum: this.paramsData.pageNum,
}).then((res) => {
console.log("res >>>>> ", res);
this.tableData = res.records || [];
this.paramsData.total = res.total;
});
},
handleChangeDate(value) {
switch (value) {
case "0":
this.startDate = dayjs()
.subtract(1, "month")
.format("YYYY-MM-DD HH:mm:ss");
this.endDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
break;
case "1":
this.startDate = dayjs()
.subtract(1, "day")
.format("YYYY-MM-DD HH:mm:ss");
this.endDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
break;
case "2":
this.startDate = dayjs()
.subtract(7, "day")
.format("YYYY-MM-DD HH:mm:ss");
this.endDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
break;
case "3":
this.startDate = dayjs()
.subtract(3, "month")
.format("YYYY-MM-DD HH:mm:ss");
this.endDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
break;
case "4":
this.startDate = dayjs()
.subtract(1, "year")
.format("YYYY-MM-DD HH:mm:ss");
this.endDate = dayjs().format("YYYY-MM-DD HH:mm:ss");
break;
default:
break;
}
},
handleSearch() {
this.tableData = [];
this.getTableData();
},
handleReset() {
this.dateRange = null;
this.startDate = null;
this.endDate = null;
this.paramsData.pageNum = 1;
this.tableData = [];
this.getTableData();
},
},
};
</script>
<style scoped lang="scss">
.monitor-warning {
}
</style>