Browse Source

feat: b2 接口对接

wjc 3 days ago
parent
commit
1ccbeb9b79

+ 2 - 2
src/api/hui-jia.js

@@ -2,7 +2,7 @@
  * @Author: wjc
  * @Date: 2025-11-21 10:08:08
  * @LastEditors: wjc
- * @LastEditTime: 2025-11-26 15:40:49
+ * @LastEditTime: 2025-12-01 10:28:17
  * @Description:
  */
 import axios from "../assets/js/api.request"
@@ -22,7 +22,7 @@ export default {
    */
   getFaceDeviceData(data) {
     return axios.request({
-      url: "/platform/bigData/faceDeviceManage/statistics",
+      url: "/platform/bigData/faceDeviceManage/faceDoorPassRecordSnapshotSta",
       params: data,
       method: "get",
     })

+ 1 - 1
src/route/white-list.js

@@ -2,7 +2,7 @@
  * @Author: WangQiBiao
  * @Date: 2019-09-18 09:40:26
  * @LastEditors: wjc
- * @LastEditTime: 2025-11-19 16:16:33
+ * @LastEditTime: 2025-12-01 10:03:17
  * @Description: 白名单菜单
  */
 import _import from './_import'

+ 15 - 57
src/views/hui-jia/components/hardware.vue

@@ -105,71 +105,29 @@
       return {
         electricState: {
           deviceCount: 8921, // 设备数量
-          annualUsage: 428921, // 年度用量 近12月的用量之和
+          annualUsage: 42891, // 年度用量 近12月的用量之和
           monthlyAvgUsage: 18921, // 月均用量 近12月用量月平均数
           dailyAvgUsage: 8921, // 日均用量 近12月用量日平均数
           switchCount: 887, // 开关次数 近12月成功开启、关闭次数
-          list: [
-            {
-              statData: "2024-01", // 时间段
-              count: 8921, // 总数
-            },
-            {
-              statData: "2024-02", // 时间段
-              count: 7891, // 总数
-            },
-            {
-              statData: "2024-03", // 时间段
-              count: 8931, // 总数
-            },
-            {
-              statData: "2024-04", // 时间段
-              count: 6131, // 总数
-            },
-            {
-              statData: "2024-05", // 时间段
-              count: 1891, // 总数
-            },
-          ],
+          monthStatisticsList: [],
         },
         waterState: {
           deviceCount: 8921, // 设备数量
-          annualUsage: 428921, // 年度用量 近12月的用量之和
+          annualUsage: 42891, // 年度用量 近12月的用量之和
           monthlyAvgUsage: 18921, // 月均用量 近12月用量月平均数
           dailyAvgUsage: 8921, // 日均用量 近12月用量日平均数
           switchCount: 887, // 开关次数 近12月成功开启、关闭次数
-          list: [
-            {
-              statData: "2024-01", // 时间段
-              count: 8921, // 总数
-            },
-            {
-              statData: "2024-02", // 时间段
-              count: 7891, // 总数
-            },
-            {
-              statData: "2024-03", // 时间段
-              count: 8931, // 总数
-            },
-            {
-              statData: "2024-04", // 时间段
-              count: 6131, // 总数
-            },
-            {
-              statData: "2024-05", // 时间段
-              count: 1891, // 总数
-            },
-          ],
+          list: [],
         },
         powerChartInstance: null,
         waterChartInstance: null,
       }
     },
     mounted() {
+      this.getData()
       this.initPowerChart()
       this.initWaterChart()
       window.addEventListener("resize", this.handleResize)
-      this.getData()
     },
     beforeDestroy() {
       window.removeEventListener("resize", this.handleResize)
@@ -184,15 +142,15 @@
       getData() {
         huiJiaApi.getElectricData().then((res) => {
           if (res && res.data) {
-            this.state = res.data.data
+            this.electricState = res.data.data
+            this.initPowerChart()
           }
-          console.log("业务数据----", res.data.data)
         })
         huiJiaApi.getWaterData().then((res) => {
           if (res && res.data) {
-            this.state = res.data.data
+            this.waterState = res.data.data
+            this.initWaterChart()
           }
-          console.log("业务数据----", res.data.data)
         })
       },
       // 初始化用电量柱状图
@@ -226,7 +184,7 @@
           },
           xAxis: {
             type: "category",
-            data: this.electricState.list.map((item) => item.statData),
+            data: this.electricState.monthStatisticsList.map((item) => item.staData),
             axisLine: {
               lineStyle: {
                 color: "rgba(160, 179, 214, 0.3)",
@@ -253,7 +211,7 @@
           yAxis: {
             type: "value",
             min: 0,
-            max: 40000,
+            max: 4000,
             axisLine: {
               show: false,
             },
@@ -276,7 +234,7 @@
             {
               name: "用电量",
               type: "bar",
-              data: this.electricState.list.map((item) => item.count),
+              data: this.electricState.monthStatisticsList.map((item) => item.count),
               barWidth: "30%",
               itemStyle: {
                 color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [
@@ -334,7 +292,7 @@
           },
           xAxis: {
             type: "category",
-            data: this.waterState.list.map((item) => item.statData),
+            data: this.waterState.monthStatisticsList.map((item) => item.staData),
             axisLine: {
               lineStyle: {
                 color: "rgba(160, 179, 214, 0.3)",
@@ -362,7 +320,7 @@
           yAxis: {
             type: "value",
             // 反转 y 轴的 min 和 max,实现“倒立”
-            min: 40000,
+            min: 4000,
             max: 0,
             axisLine: {
               show: false,
@@ -386,7 +344,7 @@
             {
               name: "用水量",
               type: "bar",
-              data: this.waterState.list.map((item) => item.count),
+              data: this.waterState.monthStatisticsList.map((item) => item.count),
               barWidth: "30%",
               itemStyle: {
                 color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [

+ 143 - 143
src/views/hui-jia/components/smart.vue

@@ -33,162 +33,162 @@
 </template>
 
 <script>
-import { huiJiaApi } from "@/api"
+  import { huiJiaApi } from "@/api"
 
-export default {
-  name: 'SmartDoor',
-  data () {
-    return {
-      state: {
-        count: '921',
-        accessControlProjectCount: '92',
-        openCount: '900000',
-        chartInstance: null,
-        // 模拟的通行流量数据
-        list: [
-          { statData: '01:00', count: 150 },
-          { statData: '04:00', count: 250 },
-          { statData: '07:00', count: 420 },
-          { statData: '10:00', count: 380 },
-          { statData: '13:00', count: 320 },
-          { statData: '16:00', count: 230 },
-          { statData: '19:00', count: 220 },
-          { statData: '22:00', count: 300 }
-        ]
+  export default {
+    name: "SmartDoor",
+    data() {
+      return {
+        state: {
+          count: "921",
+          accessControlProjectCount: "92",
+          openCount: "900000",
+          chartInstance: null,
+          // 模拟的通行流量数据
+          list: [
+            { statData: "01:00", count: 150 },
+            { statData: "04:00", count: 250 },
+            { statData: "07:00", count: 420 },
+            { statData: "10:00", count: 380 },
+            { statData: "13:00", count: 320 },
+            { statData: "16:00", count: 230 },
+            { statData: "19:00", count: 220 },
+            { statData: "22:00", count: 300 },
+          ],
+        },
       }
-    }
-  },
-  mounted () {
-    this.initChart()
-    window.addEventListener('resize', this.handleResize)
-    this.getData()
-  },
-  beforeDestroy () {
-    window.removeEventListener('resize', this.handleResize)
-    if (this.chartInstance) {
-      this.chartInstance.dispose()
-    }
-  },
-  methods: {
-    getData () {
-      huiJiaApi.getFaceDeviceData().then((res) => {
-        if (res && res.data) {
-          this.state = res.data.data
-        }
-        console.log("业务数据----", res.data.data)
-      })
     },
-    initChart () {
-      const echarts = require('echarts')
-      this.chartInstance = echarts.init(this.$refs.trafficChart)
-
-      const option = {
-        tooltip: {
-          trigger: 'axis',
-          backgroundColor: 'rgba(0, 0, 0, 0.8)',
-          borderColor: 'rgba(64, 158, 255, 0.3)',
-          textStyle: {
-            color: '#fff'
-          },
-          formatter: (params) => {
-            return `${params[0].name}<br/>${params[0].seriesName}: ${params[0].value}`
+    mounted() {
+      this.getData()
+      this.initChart()
+      window.addEventListener("resize", this.handleResize)
+    },
+    beforeDestroy() {
+      window.removeEventListener("resize", this.handleResize)
+      if (this.chartInstance) {
+        this.chartInstance.dispose()
+      }
+    },
+    methods: {
+      getData() {
+        huiJiaApi.getFaceDeviceData().then((res) => {
+          if (res && res.data) {
+            this.state = res.data.data
+            this.initChart()
           }
-        },
-        legend: {
-          data: ['开门次数'],
-          textStyle: {
-            color: '#fff'
-          },
-          top: '0%',
-          right: '0%'
-        },
-        grid: {
-          left: '3%',
-          right: '4%',
-          bottom: '10%',
-          top: '20%',
-          containLabel: true
-        },
-        xAxis: {
-          type: 'category',
-          data: this.state.list.map((item) => item.statData),
-          axisLine: {
-            lineStyle: {
-              color: 'rgba(160, 179, 214, 0.6)'
-            }
-          },
-          axisLabel: {
-            color: 'rgba(160, 179, 214, 0.7)',
-            fontSize: 14
+        })
+      },
+      initChart() {
+        const echarts = require("echarts")
+        this.chartInstance = echarts.init(this.$refs.trafficChart)
+
+        const option = {
+          tooltip: {
+            trigger: "axis",
+            backgroundColor: "rgba(0, 0, 0, 0.8)",
+            borderColor: "rgba(64, 158, 255, 0.3)",
+            textStyle: {
+              color: "#fff",
+            },
+            formatter: (params) => {
+              return `${params[0].name}<br/>${params[0].seriesName}: ${params[0].value}`
+            },
           },
-          axisTick: {
-            show: false
+          legend: {
+            data: ["开门次数"],
+            textStyle: {
+              color: "#fff",
+            },
+            top: "0%",
+            right: "0%",
           },
-          splitLine: {
-            show: true,
-            // 将坐标轴内的线设置为虚线
-            lineStyle: {
-              color: 'rgba(160, 179, 214, 0.3)',
-              type: 'dashed'
-            }
-          }
-        },
-        yAxis: {
-          type: 'value',
-          axisLine: {
-            show: false
+          grid: {
+            left: "3%",
+            right: "4%",
+            bottom: "10%",
+            top: "20%",
+            containLabel: true,
           },
-          axisLabel: {
-            color: 'rgba(160, 179, 214, 0.7)',
-            fontSize: 12
+          xAxis: {
+            type: "category",
+            data: this.state.list.map((item) => item.staData),
+            axisLine: {
+              lineStyle: {
+                color: "rgba(160, 179, 214, 0.6)",
+              },
+            },
+            axisLabel: {
+              color: "rgba(160, 179, 214, 0.7)",
+              fontSize: 14,
+            },
+            axisTick: {
+              show: false,
+            },
+            splitLine: {
+              show: true,
+              // 将坐标轴内的线设置为虚线
+              lineStyle: {
+                color: "rgba(160, 179, 214, 0.3)",
+                type: "dashed",
+              },
+            },
           },
-          axisTick: {
-            show: false
+          yAxis: {
+            type: "value",
+            axisLine: {
+              show: false,
+            },
+            axisLabel: {
+              color: "rgba(160, 179, 214, 0.7)",
+              fontSize: 12,
+            },
+            axisTick: {
+              show: false,
+            },
+            splitLine: {
+              // 将坐标轴内的线设置为虚线
+              lineStyle: {
+                color: "rgba(160, 179, 214, 0.3)",
+                type: "dashed",
+              },
+            },
           },
-          splitLine: {
-            // 将坐标轴内的线设置为虚线
-            lineStyle: {
-              color: 'rgba(160, 179, 214, 0.3)',
-              type: 'dashed'
-            }
-          }
-        },
-        series: [
-          {
-            name: '开门次数',
-            type: 'bar',
-            data: this.state.list.map((item) => item.count),
-            barWidth: '30%',
-            // 添加标签配置,设置颜色为白色
-            label: {
-              show: true,
-              position: 'top',
-              color: '#fff',
-              fontSize: 14
+          series: [
+            {
+              name: "开门次数",
+              type: "bar",
+              data: this.state.list.map((item) => item.count),
+              barWidth: "30%",
+              // 添加标签配置,设置颜色为白色
+              label: {
+                show: true,
+                position: "top",
+                color: "#fff",
+                fontSize: 14,
+              },
+              itemStyle: {
+                color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
+                  { offset: 0, color: "#F6688B" },
+                  { offset: 1, color: "#F89877" },
+                ]),
+              },
             },
-            itemStyle: {
-              color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
-                { offset: 0, color: '#F6688B' },
-                { offset: 1, color: '#F89877' }
-              ])
-            }
-          }
-        ]
-      }
+          ],
+        }
 
-      this.chartInstance.setOption(option)
-    },
-    handleResize () {
-      if (this.chartInstance) {
-        this.chartInstance.resize()
-      }
+        this.chartInstance.setOption(option)
+      },
+      handleResize() {
+        if (this.chartInstance) {
+          this.chartInstance.resize()
+        }
+      },
+      // 模拟数据更新方法
+      updateData() {
+        // 这里可以根据实际需求从API获取数据
+      },
     },
-    // 模拟数据更新方法
-    updateData () {
-      // 这里可以根据实际需求从API获取数据
-    }
   }
-}
 </script>
 
 <style lang="scss" scoped>

+ 0 - 1
src/views/hui-jia/components/work-card.vue

@@ -104,7 +104,6 @@ export default {
         if (res && res.data) {
           this.state = res.data.data
         }
-        console.log("业务数据----", res.data.data)
       })
     },
     // 格式化数字显示

+ 1 - 1
vue.config.js

@@ -3,7 +3,7 @@
  * @LastEditors: wjc
  * @Description: 配置文件
  * @Date: 2019-03-02 14:21:27
- * @LastEditTime: 2024-05-11 11:00:00
+ * @LastEditTime: 2025-12-01 10:00:14
  */
 const path = require('path')