diff --git a/src/api/home/alarm/count.ts b/src/api/home/alarm/count.ts index 1f4b59a..d5d9244 100644 --- a/src/api/home/alarm/count.ts +++ b/src/api/home/alarm/count.ts @@ -34,3 +34,11 @@ data, }) } +// 报警趋势分析 +export function getAlarmTrend(data: any) { + return request({ + url: '/statics/alarmRecords/alarmTrend', + method: 'post', + data, + }) +} diff --git a/src/api/home/alarm/count.ts b/src/api/home/alarm/count.ts index 1f4b59a..d5d9244 100644 --- a/src/api/home/alarm/count.ts +++ b/src/api/home/alarm/count.ts @@ -34,3 +34,11 @@ data, }) } +// 报警趋势分析 +export function getAlarmTrend(data: any) { + return request({ + url: '/statics/alarmRecords/alarmTrend', + method: 'post', + data, + }) +} diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts index ec20f64..ac3387f 100644 --- a/src/api/home/alarm/current.ts +++ b/src/api/home/alarm/current.ts @@ -57,3 +57,13 @@ }, }) } +// 批量删除 +export function batchDelete(ids: any) { + return request({ + url: '/system/alarmRecords/batchDelete', + method: 'post', + data: { + ids, + }, + }) +} diff --git a/src/api/home/alarm/count.ts b/src/api/home/alarm/count.ts index 1f4b59a..d5d9244 100644 --- a/src/api/home/alarm/count.ts +++ b/src/api/home/alarm/count.ts @@ -34,3 +34,11 @@ data, }) } +// 报警趋势分析 +export function getAlarmTrend(data: any) { + return request({ + url: '/statics/alarmRecords/alarmTrend', + method: 'post', + data, + }) +} diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts index ec20f64..ac3387f 100644 --- a/src/api/home/alarm/current.ts +++ b/src/api/home/alarm/current.ts @@ -57,3 +57,13 @@ }, }) } +// 批量删除 +export function batchDelete(ids: any) { + return request({ + url: '/system/alarmRecords/batchDelete', + method: 'post', + data: { + ids, + }, + }) +} diff --git a/src/api/home/alarm/history.ts b/src/api/home/alarm/history.ts index 5f55e82..44cf851 100644 --- a/src/api/home/alarm/history.ts +++ b/src/api/home/alarm/history.ts @@ -11,3 +11,13 @@ data, }) } +// 详情 +export function getAlarmDetail(id: any) { + return request({ + url: '/system/alarmRecords/historyAlarmDetail', + method: 'post', + data: { + id, + }, + }) +} diff --git a/src/api/home/alarm/count.ts b/src/api/home/alarm/count.ts index 1f4b59a..d5d9244 100644 --- a/src/api/home/alarm/count.ts +++ b/src/api/home/alarm/count.ts @@ -34,3 +34,11 @@ data, }) } +// 报警趋势分析 +export function getAlarmTrend(data: any) { + return request({ + url: '/statics/alarmRecords/alarmTrend', + method: 'post', + data, + }) +} diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts index ec20f64..ac3387f 100644 --- a/src/api/home/alarm/current.ts +++ b/src/api/home/alarm/current.ts @@ -57,3 +57,13 @@ }, }) } +// 批量删除 +export function batchDelete(ids: any) { + return request({ + url: '/system/alarmRecords/batchDelete', + method: 'post', + data: { + ids, + }, + }) +} diff --git a/src/api/home/alarm/history.ts b/src/api/home/alarm/history.ts index 5f55e82..44cf851 100644 --- a/src/api/home/alarm/history.ts +++ b/src/api/home/alarm/history.ts @@ -11,3 +11,13 @@ data, }) } +// 详情 +export function getAlarmDetail(id: any) { + return request({ + url: '/system/alarmRecords/historyAlarmDetail', + method: 'post', + data: { + id, + }, + }) +} diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue index 2733161..b811f29 100644 --- a/src/components/Echart/LineChart.vue +++ b/src/components/Echart/LineChart.vue @@ -207,7 +207,7 @@ }, }, valueFormatter: (value: string | number) => { - return value ? value + props.unit : '' + return value ? value + props.unit : value === 0 ? '0' : '' }, }, // 提示框 xAxis: [ diff --git a/src/api/home/alarm/count.ts b/src/api/home/alarm/count.ts index 1f4b59a..d5d9244 100644 --- a/src/api/home/alarm/count.ts +++ b/src/api/home/alarm/count.ts @@ -34,3 +34,11 @@ data, }) } +// 报警趋势分析 +export function getAlarmTrend(data: any) { + return request({ + url: '/statics/alarmRecords/alarmTrend', + method: 'post', + data, + }) +} diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts index ec20f64..ac3387f 100644 --- a/src/api/home/alarm/current.ts +++ b/src/api/home/alarm/current.ts @@ -57,3 +57,13 @@ }, }) } +// 批量删除 +export function batchDelete(ids: any) { + return request({ + url: '/system/alarmRecords/batchDelete', + method: 'post', + data: { + ids, + }, + }) +} diff --git a/src/api/home/alarm/history.ts b/src/api/home/alarm/history.ts index 5f55e82..44cf851 100644 --- a/src/api/home/alarm/history.ts +++ b/src/api/home/alarm/history.ts @@ -11,3 +11,13 @@ data, }) } +// 详情 +export function getAlarmDetail(id: any) { + return request({ + url: '/system/alarmRecords/historyAlarmDetail', + method: 'post', + data: { + id, + }, + }) +} diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue index 2733161..b811f29 100644 --- a/src/components/Echart/LineChart.vue +++ b/src/components/Echart/LineChart.vue @@ -207,7 +207,7 @@ }, }, valueFormatter: (value: string | number) => { - return value ? value + props.unit : '' + return value ? value + props.unit : value === 0 ? '0' : '' }, }, // 提示框 xAxis: [ diff --git a/src/router/modules/pc.ts b/src/router/modules/pc.ts index 9b058fa..f3edac9 100644 --- a/src/router/modules/pc.ts +++ b/src/router/modules/pc.ts @@ -94,6 +94,19 @@ }, }, { + path: '/history/detail', + component: () => import('@/views/home/alarm/current/components/detail.vue'), + name: 'AlarmHistoryDetail', + meta: { + title: '报警详情', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/alarm/history', + auth: '/alarm/history', + }, + }, + { path: 'count', component: () => import('@/views/home/alarm/count/index.vue'), name: 'AlarmCount', diff --git a/src/api/home/alarm/count.ts b/src/api/home/alarm/count.ts index 1f4b59a..d5d9244 100644 --- a/src/api/home/alarm/count.ts +++ b/src/api/home/alarm/count.ts @@ -34,3 +34,11 @@ data, }) } +// 报警趋势分析 +export function getAlarmTrend(data: any) { + return request({ + url: '/statics/alarmRecords/alarmTrend', + method: 'post', + data, + }) +} diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts index ec20f64..ac3387f 100644 --- a/src/api/home/alarm/current.ts +++ b/src/api/home/alarm/current.ts @@ -57,3 +57,13 @@ }, }) } +// 批量删除 +export function batchDelete(ids: any) { + return request({ + url: '/system/alarmRecords/batchDelete', + method: 'post', + data: { + ids, + }, + }) +} diff --git a/src/api/home/alarm/history.ts b/src/api/home/alarm/history.ts index 5f55e82..44cf851 100644 --- a/src/api/home/alarm/history.ts +++ b/src/api/home/alarm/history.ts @@ -11,3 +11,13 @@ data, }) } +// 详情 +export function getAlarmDetail(id: any) { + return request({ + url: '/system/alarmRecords/historyAlarmDetail', + method: 'post', + data: { + id, + }, + }) +} diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue index 2733161..b811f29 100644 --- a/src/components/Echart/LineChart.vue +++ b/src/components/Echart/LineChart.vue @@ -207,7 +207,7 @@ }, }, valueFormatter: (value: string | number) => { - return value ? value + props.unit : '' + return value ? value + props.unit : value === 0 ? '0' : '' }, }, // 提示框 xAxis: [ diff --git a/src/router/modules/pc.ts b/src/router/modules/pc.ts index 9b058fa..f3edac9 100644 --- a/src/router/modules/pc.ts +++ b/src/router/modules/pc.ts @@ -94,6 +94,19 @@ }, }, { + path: '/history/detail', + component: () => import('@/views/home/alarm/current/components/detail.vue'), + name: 'AlarmHistoryDetail', + meta: { + title: '报警详情', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/alarm/history', + auth: '/alarm/history', + }, + }, + { path: 'count', component: () => import('@/views/home/alarm/count/index.vue'), name: 'AlarmCount', diff --git a/src/views/home/alarm/count/components/alarmStatistics.vue b/src/views/home/alarm/count/components/alarmStatistics.vue index b088de2..7aa930f 100644 --- a/src/views/home/alarm/count/components/alarmStatistics.vue +++ b/src/views/home/alarm/count/components/alarmStatistics.vue @@ -34,13 +34,12 @@ value: '3', }, ]) -const xAxisData = ref([]) -const data = ref([]) +const xAxisData = ref([]) +const data = ref([]) const list = ref([]) const loading = ref(true) // 开始结束时间 const datetimerange = ref() -// 默认当天 watch(() => datetimerange.value, (newVal) => { listQuery.value.begTime = '' listQuery.value.endTime = '' @@ -51,6 +50,35 @@ } } }) +const shortcuts = [ + { + text: '近一周', + value: () => { + const end = new Date() + const start = new Date() + start.setDate(start.getDate() - 7) + return [start, end] + }, + }, + { + text: '近一个月', + value: () => { + const end = new Date() + const start = new Date() + start.setMonth(start.getMonth() - 1) + return [start, end] + }, + }, + { + text: '近三个月', + value: () => { + const end = new Date() + const start = new Date() + start.setMonth(start.getMonth() - 3) + return [start, end] + }, + }, +] // setTimeout(() => { // xAxisData.value = [ // '闸井浓度超限', '场站浓度超限', '场站火焰报警', '疑似第三方破坏', '场站烟雾报警', @@ -66,10 +94,25 @@ // value: data.value[0].data[index], // })) // }, 1000) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { loading.value = true getAlarmType(listQuery.value).then((res) => { - console.log(res.data, '各类报警统计') + // console.log(res.data, '各类报警统计') + xAxisData.value = res.data.map((item: any) => item.name) + data.value = [ + { + name: '报警数量', + data: res.data.map((item: any) => item.value), + }, + ] + list.value = res.data + resizePage loading.value = false }).catch(() => { loading.value = false @@ -105,8 +148,8 @@ style="width: 220px;margin: 0 5px;" /> @@ -118,8 +161,8 @@
- +
diff --git a/src/api/home/alarm/count.ts b/src/api/home/alarm/count.ts index 1f4b59a..d5d9244 100644 --- a/src/api/home/alarm/count.ts +++ b/src/api/home/alarm/count.ts @@ -34,3 +34,11 @@ data, }) } +// 报警趋势分析 +export function getAlarmTrend(data: any) { + return request({ + url: '/statics/alarmRecords/alarmTrend', + method: 'post', + data, + }) +} diff --git a/src/api/home/alarm/current.ts b/src/api/home/alarm/current.ts index ec20f64..ac3387f 100644 --- a/src/api/home/alarm/current.ts +++ b/src/api/home/alarm/current.ts @@ -57,3 +57,13 @@ }, }) } +// 批量删除 +export function batchDelete(ids: any) { + return request({ + url: '/system/alarmRecords/batchDelete', + method: 'post', + data: { + ids, + }, + }) +} diff --git a/src/api/home/alarm/history.ts b/src/api/home/alarm/history.ts index 5f55e82..44cf851 100644 --- a/src/api/home/alarm/history.ts +++ b/src/api/home/alarm/history.ts @@ -11,3 +11,13 @@ data, }) } +// 详情 +export function getAlarmDetail(id: any) { + return request({ + url: '/system/alarmRecords/historyAlarmDetail', + method: 'post', + data: { + id, + }, + }) +} diff --git a/src/components/Echart/LineChart.vue b/src/components/Echart/LineChart.vue index 2733161..b811f29 100644 --- a/src/components/Echart/LineChart.vue +++ b/src/components/Echart/LineChart.vue @@ -207,7 +207,7 @@ }, }, valueFormatter: (value: string | number) => { - return value ? value + props.unit : '' + return value ? value + props.unit : value === 0 ? '0' : '' }, }, // 提示框 xAxis: [ diff --git a/src/router/modules/pc.ts b/src/router/modules/pc.ts index 9b058fa..f3edac9 100644 --- a/src/router/modules/pc.ts +++ b/src/router/modules/pc.ts @@ -94,6 +94,19 @@ }, }, { + path: '/history/detail', + component: () => import('@/views/home/alarm/current/components/detail.vue'), + name: 'AlarmHistoryDetail', + meta: { + title: '报警详情', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/alarm/history', + auth: '/alarm/history', + }, + }, + { path: 'count', component: () => import('@/views/home/alarm/count/index.vue'), name: 'AlarmCount', diff --git a/src/views/home/alarm/count/components/alarmStatistics.vue b/src/views/home/alarm/count/components/alarmStatistics.vue index b088de2..7aa930f 100644 --- a/src/views/home/alarm/count/components/alarmStatistics.vue +++ b/src/views/home/alarm/count/components/alarmStatistics.vue @@ -34,13 +34,12 @@ value: '3', }, ]) -const xAxisData = ref([]) -const data = ref([]) +const xAxisData = ref([]) +const data = ref([]) const list = ref([]) const loading = ref(true) // 开始结束时间 const datetimerange = ref() -// 默认当天 watch(() => datetimerange.value, (newVal) => { listQuery.value.begTime = '' listQuery.value.endTime = '' @@ -51,6 +50,35 @@ } } }) +const shortcuts = [ + { + text: '近一周', + value: () => { + const end = new Date() + const start = new Date() + start.setDate(start.getDate() - 7) + return [start, end] + }, + }, + { + text: '近一个月', + value: () => { + const end = new Date() + const start = new Date() + start.setMonth(start.getMonth() - 1) + return [start, end] + }, + }, + { + text: '近三个月', + value: () => { + const end = new Date() + const start = new Date() + start.setMonth(start.getMonth() - 3) + return [start, end] + }, + }, +] // setTimeout(() => { // xAxisData.value = [ // '闸井浓度超限', '场站浓度超限', '场站火焰报警', '疑似第三方破坏', '场站烟雾报警', @@ -66,10 +94,25 @@ // value: data.value[0].data[index], // })) // }, 1000) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { loading.value = true getAlarmType(listQuery.value).then((res) => { - console.log(res.data, '各类报警统计') + // console.log(res.data, '各类报警统计') + xAxisData.value = res.data.map((item: any) => item.name) + data.value = [ + { + name: '报警数量', + data: res.data.map((item: any) => item.value), + }, + ] + list.value = res.data + resizePage loading.value = false }).catch(() => { loading.value = false @@ -105,8 +148,8 @@ style="width: 220px;margin: 0 5px;" /> @@ -118,8 +161,8 @@
- +
diff --git a/src/views/home/alarm/count/components/deptCount.vue b/src/views/home/alarm/count/components/deptCount.vue index 1ca5482..798bfd2 100644 --- a/src/views/home/alarm/count/components/deptCount.vue +++ b/src/views/home/alarm/count/components/deptCount.vue @@ -5,40 +5,123 @@ -->