|
@@ -18,21 +18,21 @@
|
|
|
<el-card shadow="hover" class="mb-4">
|
|
<el-card shadow="hover" class="mb-4">
|
|
|
<template #header>
|
|
<template #header>
|
|
|
<div class="flex justify-between items-center">
|
|
<div class="flex justify-between items-center">
|
|
|
- <span class="font-bold">井盖统计</span>
|
|
|
|
|
|
|
+ <span class="font-bold">翻转报警统计</span>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
|
<div class="stat-card bg-blue-50 p-4 rounded-lg">
|
|
<div class="stat-card bg-blue-50 p-4 rounded-lg">
|
|
|
<div class="text-blue-500 text-lg font-medium">当年报警数</div>
|
|
<div class="text-blue-500 text-lg font-medium">当年报警数</div>
|
|
|
- <div class="text-2xl font-bold mt-2">1</div>
|
|
|
|
|
|
|
+ <div class="text-2xl font-bold mt-2">{{alarmStatis.currentYearAlarmCount}}</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="stat-card bg-green-50 p-4 rounded-lg">
|
|
<div class="stat-card bg-green-50 p-4 rounded-lg">
|
|
|
<div class="text-green-500 text-lg font-medium">当月报警数</div>
|
|
<div class="text-green-500 text-lg font-medium">当月报警数</div>
|
|
|
- <div class="text-2xl font-bold mt-2">1</div>
|
|
|
|
|
|
|
+ <div class="text-2xl font-bold mt-2">{{alarmStatis.currentMonthAlarmCount}}</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="stat-card bg-red-50 p-4 rounded-lg">
|
|
<div class="stat-card bg-red-50 p-4 rounded-lg">
|
|
|
<div class="text-red-500 text-lg font-medium">当天报警数</div>
|
|
<div class="text-red-500 text-lg font-medium">当天报警数</div>
|
|
|
- <div class="text-2xl font-bold mt-2">0</div>
|
|
|
|
|
|
|
+ <div class="text-2xl font-bold mt-2">{{alarmStatis.currentDayAlarmCount}}</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</el-card>
|
|
</el-card>
|
|
@@ -70,10 +70,10 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { onMounted, ref } from "vue";
|
|
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
|
|
-import { getflipalarmDataAll } from "@/api/ldzh/index";
|
|
|
|
|
-import { parseTime, parseTimeEnd } from "@/utils/ruoyi.js";
|
|
|
|
|
|
|
+import {onMounted, ref} from "vue";
|
|
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
|
|
+import {getflipalarmDataAll} from "@/api/ldzh/index";
|
|
|
|
|
+import {parseTime, parseTimeEnd} from "@/utils/ruoyi.js";
|
|
|
|
|
|
|
|
const tableData = ref([]);
|
|
const tableData = ref([]);
|
|
|
const totals = ref(0);
|
|
const totals = ref(0);
|
|
@@ -82,6 +82,12 @@ const tableLoading = ref(false);
|
|
|
const currentPage = ref(1);
|
|
const currentPage = ref(1);
|
|
|
const pageSize = ref(10);
|
|
const pageSize = ref(10);
|
|
|
|
|
|
|
|
|
|
+const alarmStatis = ref({
|
|
|
|
|
+ currentYearAlarmCount:1,
|
|
|
|
|
+ currentMonthAlarmCount:1,
|
|
|
|
|
+ currentDayAlarmCount:1
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
// 构建查询参数
|
|
// 构建查询参数
|
|
|
const buildQueryParams = () => {
|
|
const buildQueryParams = () => {
|
|
|
return {
|
|
return {
|
|
@@ -123,9 +129,6 @@ const getManholeAllData = async () => {
|
|
|
parseTime(dateRange.value[0]),
|
|
parseTime(dateRange.value[0]),
|
|
|
parseTimeEnd(dateRange.value[1])
|
|
parseTimeEnd(dateRange.value[1])
|
|
|
);
|
|
);
|
|
|
- if (totals.value === 0) {
|
|
|
|
|
- ElMessage.warning("暂无数据");
|
|
|
|
|
- }
|
|
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error("获取数据失败:", error);
|
|
console.error("获取数据失败:", error);
|
|
|
ElMessage.error("数据加载失败,请稍后重试");
|
|
ElMessage.error("数据加载失败,请稍后重试");
|
|
@@ -158,9 +161,6 @@ const getEchartsAllData = async () => {
|
|
|
ElMessage.error(res.msg);
|
|
ElMessage.error(res.msg);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (totals.value === 0) {
|
|
|
|
|
- ElMessage.warning("暂无数据");
|
|
|
|
|
- }
|
|
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error("获取数据失败:", error);
|
|
console.error("获取数据失败:", error);
|
|
|
ElMessage.error("数据加载失败,请稍后重试");
|
|
ElMessage.error("数据加载失败,请稍后重试");
|
|
@@ -176,8 +176,94 @@ const search = () => {
|
|
|
getManholeAllData();
|
|
getManholeAllData();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const getYearAlarm = async () => {
|
|
|
|
|
+ const startTime = parseTime(new Date(new Date().getFullYear(),0,1));
|
|
|
|
|
+ const EndTime = parseTimeEnd(new Date(new Date().getFullYear(),11,31));
|
|
|
|
|
+ const time = startTime+","+EndTime;
|
|
|
|
|
+ const query = {
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: -1 >>> 1,
|
|
|
|
|
+ query: [
|
|
|
|
|
+ { column: "alarm_status", type: "ne", value: "0" },
|
|
|
|
|
+ {
|
|
|
|
|
+ column: "create_time",
|
|
|
|
|
+ type: "orderByDesc"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ column: "create_time",
|
|
|
|
|
+ type: "between",
|
|
|
|
|
+ value: time,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ const res = await getflipalarmDataAll(query);
|
|
|
|
|
+ if(res.code !== 200){
|
|
|
|
|
+ ElMessage.error(res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ alarmStatis.value.currentYearAlarmCount = res.data.records.length;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const getDayAlarm = async () => {
|
|
|
|
|
+ const startTime = parseTime(new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()));
|
|
|
|
|
+ const EndTime = parseTimeEnd(new Date());
|
|
|
|
|
+ const time = startTime+","+EndTime;
|
|
|
|
|
+ const query = {
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: -1 >>> 1,
|
|
|
|
|
+ query: [
|
|
|
|
|
+ { column: "alarm_status", type: "ne", value: "0" },
|
|
|
|
|
+ {
|
|
|
|
|
+ column: "create_time",
|
|
|
|
|
+ type: "orderByDesc"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ column: "create_time",
|
|
|
|
|
+ type: "between",
|
|
|
|
|
+ value: time,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ const res = await getflipalarmDataAll(query);
|
|
|
|
|
+ if(res.code !== 200){
|
|
|
|
|
+ ElMessage.error(res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ alarmStatis.value.currentDayAlarmCount = res.data.records.length;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const getMonthAlarm = async () => {
|
|
|
|
|
+ const startTime = parseTime(new Date(new Date().getFullYear(),new Date().getMonth(),1));
|
|
|
|
|
+ const EndTime = parseTimeEnd(new Date(new Date().getFullYear(),new Date().getMonth()+1,0));
|
|
|
|
|
+ const time = startTime+","+EndTime;
|
|
|
|
|
+ const query = {
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: -1 >>> 1,
|
|
|
|
|
+ query: [
|
|
|
|
|
+ { column: "alarm_status", type: "ne", value: "0" },
|
|
|
|
|
+ {
|
|
|
|
|
+ column: "create_time",
|
|
|
|
|
+ type: "orderByDesc"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ column: "create_time",
|
|
|
|
|
+ type: "between",
|
|
|
|
|
+ value: time,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ const res = await getflipalarmDataAll(query);
|
|
|
|
|
+ if(res.code !== 200){
|
|
|
|
|
+ ElMessage.error(res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ alarmStatis.value.currentMonthAlarmCount = res.data.records.length;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 初始化加载
|
|
// 初始化加载
|
|
|
-onMounted(getManholeAllData);
|
|
|
|
|
|
|
+onMounted(()=>{
|
|
|
|
|
+ getManholeAllData();
|
|
|
|
|
+ getYearAlarm();
|
|
|
|
|
+ getMonthAlarm();
|
|
|
|
|
+ getDayAlarm();
|
|
|
|
|
+});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|