diff --git a/src/api/dashboard.ts b/src/api/dashboard.ts index 10e7f4d..b3a70f6 100644 --- a/src/api/dashboard.ts +++ b/src/api/dashboard.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2025-03-07 15:09:18 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2025-03-14 11:14:15 + * @LastEditTime: 2025-08-26 16:54:54 * @FilePath: \5G-Loading-Bay-Web\src\api\dashboard.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -94,3 +94,14 @@ export const getVehiclManagementApi = (params: any) => { export const getBeforeMonitorDetailApi = (params: any) => { return request.get(`/api/v1/record/before_arrive_record_list/`, params); }; + + +// 图表统计1 type有appearance、pole、distance。dateType有day、hour分别对应日和时 +export const getRecordAmountDataApi = (params: any) => { + return request.get(`/api/v1/record/get_record_amount_data/`, params); +}; + +// 图表统计2 ?type=pole&dateType=day 这个是日异常类型的接口 +export const getRecordFaultTypeAmountDataApi = (params: any) => { + return request.get(`/api/v1/record/get_record_fault_type_amount_data/`, params); +}; \ No newline at end of file diff --git a/src/components/Charts/appearanceDailyAlertChart.vue b/src/components/Charts/appearanceDailyAlertChart.vue index e202adb..d6d95ce 100644 --- a/src/components/Charts/appearanceDailyAlertChart.vue +++ b/src/components/Charts/appearanceDailyAlertChart.vue @@ -2,95 +2,145 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2025-08-14 10:33:46 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2025-08-20 14:35:52 + * @LastEditTime: 2025-08-27 16:22:40 * @FilePath: \5G-Web\src\components\Charts\appearanceDailyAlertChart.vue * @Description: 外观日告警统计 --> diff --git a/src/components/Charts/appearanceDailyDetectionChart.vue b/src/components/Charts/appearanceDailyDetectionChart.vue index eb6bee0..a9e3c4a 100644 --- a/src/components/Charts/appearanceDailyDetectionChart.vue +++ b/src/components/Charts/appearanceDailyDetectionChart.vue @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2025-08-14 10:33:22 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2025-08-20 16:03:07 + * @LastEditTime: 2025-08-26 17:09:24 * @FilePath: \5G-Web\src\components\Charts\appearanceDailyDetectionChart.vue * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE --> @@ -11,79 +11,88 @@ import * as echarts from "echarts"; const props = defineProps({ datas: { - type: Array as PropType[]>, - default: () => [], + type: Object, + default: () => {}, }, }); function initChart() { const chartDom = document.getElementById("appearanceDailyDetectionChart"); const mainChart = echarts.init(chartDom); - const data1 = [ - { - name: "1日", - value: 175, - }, - { - name: "2日", - value: 148, - }, - { - name: "3日", - value: 195, - }, - { - name: "4日", - value: 115, - }, - { - name: "5日", - value: 148, - }, - { - name: "6日", - value: 95, - }, - { - name: "7日", - value: 56, - }, - { - name: "8日", - value: 45, - }, - { - name: "9日", - value: 15, - }, - { - name: "10日", - value: 48, - }, - { - name: "11日", - value: 95, - }, - { - name: "12日", - value: 128, - }, - { - name: "13日", - value: 34, - }, - { - name: "14日", - value: 123, - }, - { - name: "15日", - value: 175, - }, - { - name: "16日", - value: 148, - }, - ]; + let finalData = []; + + for (let key in props.datas) { + finalData.push({ + name: key + "日", + value: props.datas[key], + }); + } + // TODO 转移到mock数据中 + // const finalData = [ + // { + // name: "1日", + // value: 175, + // }, + // { + // name: "2日", + // value: 148, + // }, + // { + // name: "3日", + // value: 195, + // }, + // { + // name: "4日", + // value: 115, + // }, + // { + // name: "5日", + // value: 148, + // }, + // { + // name: "6日", + // value: 95, + // }, + // { + // name: "7日", + // value: 56, + // }, + // { + // name: "8日", + // value: 45, + // }, + // { + // name: "9日", + // value: 15, + // }, + // { + // name: "10日", + // value: 48, + // }, + // { + // name: "11日", + // value: 95, + // }, + // { + // name: "12日", + // value: 128, + // }, + // { + // name: "13日", + // value: 34, + // }, + // { + // name: "14日", + // value: 123, + // }, + // { + // name: "15日", + // value: 175, + // }, + // { + // name: "16日", + // value: 148, + // }, + // ]; const createSvg = (shadowColor, shadowBlur) => ` `; - const svgString = createSvg("rgba(7, 131, 250, 1)", 8); const svg = new Blob([svgString], { type: "image/svg+xml;charset=utf-8" }); const barWidth = 16; @@ -119,7 +127,7 @@ function initChart() { const insetShadowUrl = DOMURL.createObjectURL(svg); let xAxisData = []; let seriesData1 = []; - data1.forEach((item) => { + finalData.forEach((item) => { xAxisData.push(item.name); seriesData1.push(item.value); }); @@ -211,9 +219,17 @@ function initChart() { mainChart.setOption(option); } -onMounted(() => { - initChart(); -}); +watch( + () => props.datas, + (newVal) => { + if (newVal) { + initChart(); + } + }, + { + deep: true, + } +); diff --git a/src/components/Charts/diggerDailyDistanceChart.vue b/src/components/Charts/diggerDailyDistanceChart.vue index 76663d6..f74de54 100644 --- a/src/components/Charts/diggerDailyDistanceChart.vue +++ b/src/components/Charts/diggerDailyDistanceChart.vue @@ -1,79 +1,92 @@ diff --git a/src/components/Charts/diggerHourlyDistanceChart.vue b/src/components/Charts/diggerHourlyDistanceChart.vue index 7d2de45..e464fac 100644 --- a/src/components/Charts/diggerHourlyDistanceChart.vue +++ b/src/components/Charts/diggerHourlyDistanceChart.vue @@ -1,5 +1,11 @@ diff --git a/src/components/Charts/dvDeviceInfoChart.vue b/src/components/Charts/dvDeviceInfoChart.vue new file mode 100644 index 0000000..3c66c3d --- /dev/null +++ b/src/components/Charts/dvDeviceInfoChart.vue @@ -0,0 +1,231 @@ + + + diff --git a/src/components/Charts/poleDailyAlertChart.vue b/src/components/Charts/poleDailyAlertChart.vue index 5332c8c..11be35e 100644 --- a/src/components/Charts/poleDailyAlertChart.vue +++ b/src/components/Charts/poleDailyAlertChart.vue @@ -1,139 +1,71 @@ + diff --git a/src/components/Charts/poleDailyDetectionChart.vue b/src/components/Charts/poleDailyDetectionChart.vue index ae56d29..c6d352d 100644 --- a/src/components/Charts/poleDailyDetectionChart.vue +++ b/src/components/Charts/poleDailyDetectionChart.vue @@ -1,206 +1,222 @@ diff --git a/src/styles/common.scss b/src/styles/common.scss index 40c75a7..284da0c 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -233,7 +233,7 @@ padding-bottom: 1px; } .fg-footer-charts-content { - overflow: hidden; + // overflow: hidden; max-width: 100%; height: 195px; // background-color: red; diff --git a/src/views/dashboard/AppearanceMonitor.vue b/src/views/dashboard/AppearanceMonitor.vue index c34cbcb..3dcaf8d 100644 --- a/src/views/dashboard/AppearanceMonitor.vue +++ b/src/views/dashboard/AppearanceMonitor.vue @@ -11,6 +11,8 @@ import { getAppearanceMonitorApi, getAppearanceMonitorDetailApi, getBeforeMonitorDetailApi, + getRecordAmountDataApi, + getRecordFaultTypeAmountDataApi } from "@/api/dashboard"; import { isSuccessApi } from "@/utils/forApi"; import { useWebSocketStore } from "@/stores/websocketStore"; @@ -19,6 +21,8 @@ import { useWebSocketStore } from "@/stores/websocketStore"; const isAlarmOpen = ref(false); //详情弹窗 const isDeleteOpen = ref(false); //删除弹窗 const websocketStore = useWebSocketStore(); + + // 监听 messages 的变化 watch( () => websocketStore.messages, @@ -97,6 +101,10 @@ const searchForm = reactive({ }); const dataLoading = ref(true); +const recordAmountData = ref({}); // 日检出量记录数据 +const recordFaultData = ref({}); // 日告警分类记录数据 + + // 文件详情 const getFileList = async () => { try { @@ -173,6 +181,36 @@ const getList = async () => { console.error("获取数据失败:", error); } }; +// 图表统计1 +const fetchRecordAmountData = async () => { + try { + const res = await getRecordAmountDataApi({ + type: "appearance", + dateType: "day", + }); + console.log(res.data, "fetchRecordAmountData_data"); + if (isSuccessApi(res)) { + recordAmountData.value = res.data; + } + } catch (error) { + console.error("获取数据失败:", error); + } +} +// 图表统计2 +const fetchRecordFaultTypeAmountData = async () => { + try { + const res = await getRecordFaultTypeAmountDataApi({ + type: "appearance", + dateType: "day", + }); + console.log(res.data, "fetchRecordFaultTypeAmountData_data"); + if (isSuccessApi(res)) { + recordFaultData.value = res.data; + } + } catch (error) { + console.error("获取数据失败:", error); + } +} // 查询方法 const handleQuery = () => { @@ -231,6 +269,8 @@ onBeforeRouteLeave(() => { onMounted(() => { getList(); + fetchRecordAmountData() + fetchRecordFaultTypeAmountData() });