Browse Source

设备大屏接口联调

“wangyihan” 1 year ago
parent
commit
404b72c344

+ 59 - 0
src/api/system/equdata.js

@@ -0,0 +1,59 @@
+import request from '@/utils/request'
+
+// 查询设备总览1
+export function deviceView(query) {
+  return request({
+    url: '/system/display/deviceView',
+    method: 'get',
+    params: query
+  })
+}
+// 查询设备总览2
+export function deviceOver(query) {
+  return request({
+    url: '/system/display/deviceOver',
+    method: 'get',
+    params: query
+  })
+}
+// 查询报警总数
+export function count(query) {
+  return request({
+    url: '/system/display/count',
+    method: 'get',
+    params: query
+  })
+}
+// 查询月新增设备
+export function addDevice(data) {
+  return request({
+    url: '/system/display/addDevice',
+    method: 'get',
+    params: data
+  })
+}
+// 查询用户年龄总览
+export function userAgeAll(query) {
+  return request({
+    url: '/system/display/userAgeAll',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询月新增用户
+export function addUser(query) {
+  return request({
+    url: '/system/display/addUser',
+    method: 'get',
+    params: query
+  })
+}
+// 查询报警列表
+export function alarmStatusList(query) {
+  return request({
+    url: '/system/display/alarmStatusList',
+    method: 'get',
+    params: query
+  })
+}

+ 6 - 13
src/views/datav/LeftChart1.vue

@@ -9,7 +9,7 @@
     <div class="left-list">
       <div class="left-container">
         <div class="container-topdown">
-          <img src="./img/sos.png" alt="" />
+          <img src="./img/SOS.svg" alt="" />
           <div class="word">SOS告警</div>
         </div>
         <div class="container-topdown">
@@ -23,7 +23,7 @@
       </div>
       <div class="left-container">
         <div class="container-topdown">
-          <img src="./img/weilan.png" alt="" />
+          <img src="./img/weilan.svg" alt="" />
           <div class="word">围栏告警</div>
         </div>
         <div class="container-topdown">
@@ -37,7 +37,7 @@
       </div>
       <div class="left-container">
         <div class="container-topdown">
-          <img src="./img/xinlv.png" alt="" />
+          <img src="./img/xinlv.svg" alt="" />
           <div class="word">心率告警</div>
         </div>
         <div class="container-topdown">
@@ -51,7 +51,7 @@
       </div>
       <div class="left-container">
         <div class="container-topdown">
-          <img src="./img/diedao.png" alt="" />
+          <img src="./img/diedao.svg" alt="" />
           <div class="word">跌倒告警</div>
         </div>
         <div class="container-topdown">
@@ -65,7 +65,7 @@
       </div>
       <div class="left-container">
         <div class="container-topdown">
-          <img src="./img/didian.png" alt="" />
+          <img src="./img/didian.svg" alt="" />
           <div class="word">低电提醒</div>
         </div>
         <div class="container-topdown">
@@ -79,7 +79,7 @@
       </div>
       <div class="left-container">
         <div class="container-topdown">
-          <img src="./img/shebei.png" alt="" />
+          <img src="./img/shebei.svg" alt="" />
           <div class="word">设备状态</div>
         </div>
         <div class="container-topdown">
@@ -147,9 +147,6 @@ export default {
   },
   mounted() {
     this.initData();
-    setInterval(() => {
-      this.power(360);
-    }, 500);
     // this.flipToValue(this.number); // 初始化显示数字
     // this.startAnimation()
   },
@@ -170,10 +167,6 @@ export default {
       };
       console.log(typeof String(this.number),777);
     },
-    power(n) {
-      this.config1.number[0] = Math.floor(Math.random() * n + 1);
-      this.config1 = { ...this.config1 }; //对象解构,更新props
-    },
     // startAnimation() {
     //   this.animationInterval = setInterval(() => {
     //     const increment = this.number > this.currentValue ? 1 : -1;

+ 27 - 59
src/views/datav/LeftChart11.vue

@@ -2,7 +2,7 @@
   <div class="left-chart-11">
     <!-- <div class="lc1-header">张三收费站</div> -->
     <div class="under-title"><b>告警记录</b></div>
-    <div class="right-container" >
+    <div class="right-container">
       <div class="right-box" v-for="(item, index) in dataList">
         <div class="top">
           <div class="top-left">{{ item.alarmMessage }}</div>
@@ -12,7 +12,7 @@
         <div class="under">告警地址:{{ item.location }}</div>
       </div>
     </div>
-    <div class="page-box" v-show="queryParams.pageTotal ">
+    <div class="page-box" v-show="queryParams.pageTotal">
       <img src="./img/iconleft.png" alt="" @click="leftPage" />
       <div>{{ queryParams.pageNum }}/{{ queryParams.pageTotal }}</div>
       <img src="./img/iconright.png" alt="" @click="rightPage" />
@@ -26,60 +26,6 @@ export default {
   name: "LeftChart1",
   data() {
     return {
-      config: {
-        data: [
-          {
-            label: 222,
-            tel: 15202013072,
-            name: "王艺涵",
-            time: "2023-09-12 09:50:00",
-            type: "收费系统",
-            adr: "ncjdhfcudjchnd",
-          },
-          {
-            label: 222,
-            tel: 15202013072,
-            name: "王艺涵",
-            time: "2023-09-12 09:50:00",
-            type: "通信系统",
-            adr: "cdkojhfcndoj",
-          },
-          {
-            label: 222,
-            tel: 15202013072,
-            name: "王艺涵",
-            time: "2023-09-12 09:50:00",
-            type: "监控系统",
-            adr: "ncsojhkla",
-          },
-          {
-            label: 222,
-            tel: 15202013072,
-            name: "王艺涵",
-            time: "2023-09-12 09:50:00",
-            type: "供配系统",
-            adr: "ncjdokchnjsak",
-          },
-          {
-            label: 222,
-            tel: 15202013072,
-            name: "王艺涵",
-            time: "2023-09-12 09:50:00",
-            type: "其他",
-            adr: "cniskjojcnosakl",
-          },
-          {
-            label: 222,
-            tel: 15202013072,
-            name: "王艺涵",
-            time: "2023-09-12 09:50:00",
-            type: "其他",
-            adr: "cniskjojcnosakl",
-          },
-        ],
-        colors: ["#00baff", "#3de7c9", "#fff", "#ffc530", "#469f4b"],
-        unit: "件",
-      },
       dataList: [],
       queryParams: {
         pageNum: 1,
@@ -94,7 +40,21 @@ export default {
   methods: {
     initData() {
       list(this.queryParams).then((res) => {
-        this.dataList = res.rows;
+        this.dataList = res.rows.map((item) => {
+          let hideName = "";
+          let hideTel = "";
+          if (item.name.length >= 2) {
+            hideName = item.name[0] + "*" + item.name.substring(2);
+          }
+          if (item.telno && item.telno.length === 11) {
+            hideTel = this.hideMiddleDigits(item.telno);
+          }
+          return {
+            ...item,
+            name: hideName,
+            telno: hideTel,
+          };
+        });
         let pageTotal = res.total / this.queryParams.pageSize;
         if (String(pageTotal).indexOf(".") > -1) {
           pageTotal = parseInt(pageTotal) + 1;
@@ -104,6 +64,14 @@ export default {
         this.queryParams.pageTotal = pageTotal;
       });
     },
+    hideMiddleDigits(phoneNumber) {
+      if (phoneNumber && phoneNumber.length === 11) {
+        const prefix = phoneNumber.substring(0, 3);
+        const suffix = phoneNumber.substring(7);
+        return `${prefix}****${suffix}`;
+      }
+      return phoneNumber;
+    },
     leftPage() {
       if (this.queryParams.pageNum > 1) {
         this.queryParams.pageNum--;
@@ -146,7 +114,7 @@ export default {
     height: 90%;
     border: 1px solid #22659e;
     border-radius: 5px;
-    background: rgba(1,58,131,.4);
+    background: rgba(1, 58, 131, 0.4);
     .right-box {
       height: 14%;
       color: #fff;
@@ -182,7 +150,7 @@ export default {
     }
   }
   .page-box {
-    height:10%;
+    height: 10%;
     display: flex;
     justify-content: center;
     align-items: center;

+ 1 - 0
src/views/datav/img/SOS.svg

@@ -0,0 +1 @@
+<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17.62 19.99"><defs><style>.cls-1{fill:#bd3124;fill-rule:evenodd;}</style></defs><title>2</title><path id="矩形_1_拷贝" data-name="矩形 1 拷贝" class="cls-1" d="M2.07,18.3H17.94V20H2.07ZM10.79.87v1a.86.86,0,1,1-1.72,0v-1a.86.86,0,1,1,1.72,0Zm7.63,3.2-.86.57a.87.87,0,0,1-1.2-.25.86.86,0,0,1,.25-1.19h0l.86-.57a.85.85,0,0,1,1.19.24A.86.86,0,0,1,18.42,4.07Zm-16.83,0,.86.57a.86.86,0,0,0,1-1.42l0,0-.87-.57a.86.86,0,0,0-1,1.42ZM10,3.63a7.26,7.26,0,0,1,7.25,7.26h0v6H2.75v-6A7.26,7.26,0,0,1,10,3.63Z" transform="translate(-1.19 -0.01)"/></svg>

+ 1 - 0
src/views/datav/img/didian.svg

@@ -0,0 +1 @@
+<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 11.34"><defs><style>.cls-1{fill:#ccf783;}</style></defs><title>4</title><path class="cls-1" d="M18.87,7.79h-.79V5.85a1.31,1.31,0,0,0-1.31-1.31H12.88V5.91h3.36a.47.47,0,0,1,.47.47v7.45a.47.47,0,0,1-.47.47H12.88v1.37h3.89a1.31,1.31,0,0,0,1.31-1.31V12.42h.79A1.14,1.14,0,0,0,20,11.29V8.92A1.14,1.14,0,0,0,18.87,7.79Z" transform="translate(0 -4.33)"/><path class="cls-1" d="M1.25,13.83V6.38a.47.47,0,0,1,.46-.47H5.4V4.54H1.31A1.31,1.31,0,0,0,0,5.85v8.51a1.31,1.31,0,0,0,1.31,1.31H5.4V14.3H1.71A.47.47,0,0,1,1.25,13.83Z" transform="translate(0 -4.33)"/><polygon class="cls-1" points="12.88 5.19 7.45 5.19 9.04 0 4.59 6.81 9.85 6.81 7.66 11.34 12.88 5.19"/></svg>

+ 1 - 0
src/views/datav/img/diedao.svg

@@ -0,0 +1 @@
+<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19 19.96"><defs><style>.cls-1{fill:#ff6320;}</style></defs><title>3</title><path class="cls-1" d="M19.23,12.42l-5-6.49a1.66,1.66,0,0,0-1.41-.65A1.68,1.68,0,0,0,11.47,6L9,9.75a.4.4,0,0,1-.59.09L7,8.71a1.63,1.63,0,0,0-1.49-.27l-4,1.29a1.31,1.31,0,0,0,.8,2.5l3-1a1,1,0,0,1,.92.17l1.5,1.18a.13.13,0,0,1-.07.22L5.35,13a1.64,1.64,0,0,0-1.15.62L.84,17.87A1.31,1.31,0,1,0,2.9,19.5l3-3.81a.33.33,0,0,1,.21-.11l4-.32a3,3,0,0,0,2.26-1.32l2-2.93a.27.27,0,0,1,.44,0l2.34,3a1.31,1.31,0,1,0,2.08-1.6Z" transform="translate(-0.5 -0.04)"/><path class="cls-1" d="M9.91,5a2.5,2.5,0,1,0-2.5-2.5A2.5,2.5,0,0,0,9.91,5Z" transform="translate(-0.5 -0.04)"/></svg>

+ 1 - 0
src/views/datav/img/shebei.svg

@@ -0,0 +1 @@
+<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18.79 20"><defs><style>.cls-1{fill:#fcca00;}</style></defs><title>5</title><path class="cls-1" d="M14.62,3.75h-.88V1.36A1.36,1.36,0,0,0,12.38,0H7.62A1.36,1.36,0,0,0,6.26,1.36V3.75H5.38A1.36,1.36,0,0,0,4,5.11v9.78a1.36,1.36,0,0,0,1.36,1.36h.88v2.39A1.36,1.36,0,0,0,7.62,20h4.76a1.36,1.36,0,0,0,1.36-1.36V16.25h.88A1.36,1.36,0,0,0,16,14.89V5.11A1.36,1.36,0,0,0,14.62,3.75Zm-6.93-2a.48.48,0,0,1,.48-.49h3.66a.48.48,0,0,1,.48.49v2H7.69Zm4.62,16.44a.48.48,0,0,1-.48.49H8.17a.48.48,0,0,1-.48-.49v-2h4.62Zm1.89-3.39H10.79V12.66H9.21v2.17H5.8a.49.49,0,0,1-.48-.49V10.79h2V9.21h-2V5.66a.49.49,0,0,1,.48-.49H9.21V7.34h1.58V5.17H14.2a.49.49,0,0,1,.48.49V9.21h-2v1.58h2v3.55A.49.49,0,0,1,14.2,14.83Z" transform="translate(-0.6)"/><path class="cls-1" d="M18.08,7.24H17v6.35h1a1.32,1.32,0,0,0,1.32-1.31V8.55A1.32,1.32,0,0,0,18.08,7.24Z" transform="translate(-0.6)"/><path class="cls-1" d="M.6,8.55v3.73a1.32,1.32,0,0,0,1.32,1.31H3V7.24H1.92A1.32,1.32,0,0,0,.6,8.55Z" transform="translate(-0.6)"/></svg>

+ 1 - 0
src/views/datav/img/weilan.svg

@@ -0,0 +1 @@
+<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 17.89"><defs><style>.cls-1{fill:#fcca00;}</style></defs><title>6</title><path class="cls-1" d="M13.76,4.08a1.52,1.52,0,1,0-1.51-1.51A1.51,1.51,0,0,0,13.76,4.08Z" transform="translate(0 -1.05)"/><path class="cls-1" d="M12.62,11.13v-1a9.33,9.33,0,0,1,.29-2.29L13,7.51l1.18,1.82a1,1,0,0,0,.47.38l2.08.79a.84.84,0,0,0,.6-1.56L15.66,8.3a.56.56,0,0,1-.3-.25L13.3,4.89a1.6,1.6,0,0,0-1-.68,1.58,1.58,0,0,0-1.15.14l-3,1.58A1.27,1.27,0,0,0,7.54,7V9.46a.84.84,0,1,0,1.68,0V7.56a.45.45,0,0,1,.23-.39l.92-.48-.15.56a10.9,10.9,0,0,0-.36,2.84v2L7,17.07V11.43a.71.71,0,1,0-1.42,0v3.76H4.19V11.43a.71.71,0,0,0-1.42,0v3.76H1.42V11.43a.71.71,0,0,0-1.42,0v6.16H1.42V16.08H2.77v1.51H4.19V16.08H5.56v1.51h1.2a.83.83,0,0,0,.4.85.84.84,0,0,0,1.15-.31l3.12-5.41h.22l1.6,2.46a1.51,1.51,0,0,1,.25.85v2.08a.85.85,0,0,0,.84.84h0a.84.84,0,0,0,.84-.84V15.55a1.58,1.58,0,0,0-.26-.86Z" transform="translate(0 -1.05)"/><path class="cls-1" d="M19.29,10.72a.71.71,0,0,0-.71.71v3.76H17.23V11.43a.71.71,0,1,0-1.42,0v6.16h1.42V16.08h1.35v1.51H20V11.43A.71.71,0,0,0,19.29,10.72Z" transform="translate(0 -1.05)"/></svg>

+ 1 - 0
src/views/datav/img/xinlv.svg

@@ -0,0 +1 @@
+<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 16.88"><defs><style>.cls-1{fill:#e99d42;}</style></defs><title>1</title><path class="cls-1" d="M1.58,10.43H4.89L6.35,7a.93.93,0,0,1,.85-.57h0A.94.94,0,0,1,8.07,7l2,4.48L11.9,8a.86.86,0,0,1,.76-.45.84.84,0,0,1,.75.45l1.14,2.17h4.14a5.16,5.16,0,0,0-7.5-7.08L10,4.26,8.81,3.07a5.16,5.16,0,0,0-7.3,7.3Z" transform="translate(0 -1.56)"/><path class="cls-1" d="M13.7,11.55l-1-2-1.91,3.61a.83.83,0,0,1-.74.44h0a.82.82,0,0,1-.73-.49l-2-4.58-1.4,3.3H3l6.31,6.31a1,1,0,0,0,1.43,0l6.58-6.58H13.7Z" transform="translate(0 -1.56)"/></svg>

+ 3 - 0
src/views/test/LeftChart1.vue

@@ -23,6 +23,9 @@ export default {
             type: "pie",
             data: [{ name: "可口可乐", value: 93 }],
             radius: ["50%", "75%"],
+            axisTick:{
+
+            },
             insideLabel: {
               show: true,
               formatter: "{value}",

+ 32 - 3
src/views/test/LeftChart2.vue

@@ -13,8 +13,20 @@
 </template>
 
 <script>
+import { addDevice } from "@/api/system/equdata";
+
 export default {
   name: "LeftChart2",
+  props:{
+   xlist:{
+    type:Array,
+    default:[],
+   },
+   ylist:{
+    type:Array,
+    default:[],
+   }
+  },
   data() {
     return {
       option: {
@@ -51,8 +63,9 @@ export default {
           bottom: 20,
         },
         xAxis: {
-          name: "第二周",
-          data: ["周一"],
+          name: "",
+          // data: ["周一","周二"],
+          data: this.xlist,
           axisLine: {
             style: {
               stroke: "#324686",
@@ -89,7 +102,8 @@ export default {
         },
         series: [
           {
-            data: [2],
+            // data: [2,6],
+            data: this.ylist,
             type: "line",
             lineArea: {
               show: true,
@@ -100,6 +114,21 @@ export default {
       },
     };
   },
+  created() {
+    this.getEquData();
+  },
+  methods: {
+    getEquData() {
+      addDevice().then(res=>{
+        let xlist=res.data.map(item=>item.month)
+        let ylist=res.data.map(item=>item.count)
+        console.log(xlist,777);
+        console.log(ylist,888);
+        this.option.xAxis.data=xlist
+        this.option.series[0].data=ylist
+      })
+    },
+  },
 };
 </script>
 

+ 51 - 32
src/views/test/LeftChartUnder.vue

@@ -8,42 +8,61 @@
 
 <script>
 export default {
-  name: 'LeftChart3',
-  data () {
+  name: "LeftChart3",
+  props: {
+    dataList: {
+      type: Array,
+      default: [],
+    },
+  },
+  data() {
     return {
       config: {
         data: [
-          {
-            name: '40',
-            value: 0.2
-          },
-          {
-            name: '50',
-            value: 0.8
-          },
-          {
-            name: '60',
-            value: 0.5
-          },
-          {
-            name: '70',
-            value: 0.2
-          },
-          {
-            name: '80',
-            value: 0.4
-          },
-          {
-            name: '90',
-            value: 0.1
-          },
+          // {
+          //   name: "40",
+          //   value: 0.2,
+          // },
+          // {
+          //   name: "50",
+          //   value: 0.8,
+          // },
+          // {
+          //   name: "60",
+          //   value: 0.5,
+          // },
+          // {
+          //   name: "70",
+          //   value: 0.2,
+          // },
+          // {
+          //   name: "80",
+          //   value: 0.4,
+          // },
+          // {
+          //   name: "90",
+          //   value: 0.1,
+          // },
         ],
-        colors: ['#00baff', '#3de7c9', '#fff', '#ffc530', '#469f4b'],
-        unit: '人'
-      }
-    }
-  }
-}
+        colors: ["#00baff", "#3de7c9", "#fff", "#ffc530", "#469f4b"],
+        unit: "人",
+      },
+    };
+  },
+  created() {
+    this.getData();
+  },
+  methods: {
+    getData() {
+      this.config.data = this.dataList.map((item) => {
+        return {
+          name: item.age,
+          value: item.count,
+        };
+      });
+    },
+  },
+};
 </script>
 
 <style lang="less">

+ 29 - 5
src/views/test/MiddleChart.vue

@@ -8,19 +8,31 @@
 -->
 <template>
   <div class="left-chart-4">
-    <dv-charts class="lc2-chart" :option="option" />
+    <dv-charts class="middle-chart" :option="option" />
   </div>
 </template>
 
 <script>
+import { addUser } from "@/api/system/equdata";
 export default {
   name: "LeftChart4",
+  props:{
+   xlist:{
+    type:Array,
+    default:[],
+   },
+   ylist:{
+    type:Array,
+    default:[],
+   }
+  },
   data() {
     return {
       option: {
         xAxis: {
           // name: "第一周",
-          data: ["周一"],
+          // data: ["周一"],
+          data: this.xlist,
           axisLabel: {
             style: {
               fill: "#fff",
@@ -42,7 +54,8 @@ export default {
         },
         series: [
           {
-            data: [10],
+            // data: [10],
+            data: this.ylist,
             type: "bar",
             barWidth: 10,
           },
@@ -50,10 +63,21 @@ export default {
       },
     };
   },
-  mounted() {
+  created() {
     // this.initData();
+    this.getAddUser()
   },
   methods: {
+    getAddUser(){
+      addUser().then(res=>{
+        let xlist=res.data.map(item=>item.month)
+        let ylist=res.data.map(item=>item.count)
+        console.log(xlist,333);
+        console.log(ylist,555);
+        this.option.xAxis.data=xlist
+        this.option.series[0].data=ylist
+      })
+    }
     // initData() {
     //   const option1 = {
     //     xAxis: {
@@ -91,7 +115,7 @@ export default {
     margin-top: 10px;
   }
 
-  .lc2-chart {
+  .middle-chart {
     height: calc(~"100% - 80px");
     position: relative;
   }

+ 193 - 12
src/views/test/RightBottom.vue

@@ -9,32 +9,148 @@
 <template>
   <div id="scroll-board">
     <dv-scroll-board :config="config" />
+    <!-- <div class="box">
+      <div class="box-left">
+        <div class="box-left-top">
+          <div>设备ID:<span>3500000</span></div>
+          <div>时间:<span>2023-08-04 10:25:34</span></div>
+        </div>
+        <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+      </div>
+      <div class="box-right">王艺涵</div>
+    </div> -->
   </div>
 </template>
 
 <script>
 export default {
   name: "ScrollBoard",
+  props: {
+    data: {
+      type: Array,
+      default: [],
+    },
+  },
   data() {
     return {
       config: {
         // header: ["时间", "病害信息", "数量", "标段"],
-        data: [
-          ["2019-07-01 19:25:00", "路面危害-松散", "5", "xxxxxxx"],
-          ["2019-07-02 17:25:00", "路面危害-路面油污清理", "13", "xxxxxxx"],
-          ["2019-07-03 16:25:00", "交安设施-交通标志牌结构", "6", "xxxxxxx"],
-          ["2019-07-04 15:25:00", "路基危害-防尘网", "2", "xxxxxxx"],
-          ["2019-07-05 14:25:00", "交安设施-交通标志牌结构", "1", "xxxxxxx"],
-          ["2019-07-06 13:25:00", "路面危害-松散", "3", "xxxxxxx"],
-          ["2019-07-07 12:25:00", "路基危害-防尘网", "4", "xxxxxxx"],
-          ["2019-07-08 11:25:00", "路面危害-路面油污清理", "2", "xxxxxxx"],
-          ["2019-07-09 10:25:00", "交安设施-交通标志牌结构", "5", "xxxxxxx"],
-          ["2019-07-10 09:25:00", "路基危害-防尘网", "3", "xxxxxxx"],
-        ],
+        // data: [
+        //   ["2019-07-01 19:25:00", "路面危害-松散", "5", "xxxxxxx"],
+        //   ["2019-07-02 17:25:00", "路面危害-路面油污清理", "13", "xxxxxxx"],
+        //   ["2019-07-03 16:25:00", "交安设施-交通标志牌结构", "6", "xxxxxxx"],
+        //   ["2019-07-04 15:25:00", "路基危害-防尘网", "2", "xxxxxxx"],
+        //   ["2019-07-05 14:25:00", "交安设施-交通标志牌结构", "1", "xxxxxxx"],
+        //   ["2019-07-06 13:25:00", "路面危害-松散", "3", "xxxxxxx"],
+        //   ["2019-07-07 12:25:00", "路基危害-防尘网", "4", "xxxxxxx"],
+        //   ["2019-07-08 11:25:00", "路面危害-路面油污清理", "2", "xxxxxxx"],
+        //   ["2019-07-09 10:25:00", "交安设施-交通标志牌结构", "5", "xxxxxxx"],
+        //   ["2019-07-10 09:25:00", "路基危害-防尘网", "3", "xxxxxxx"],
+        // ],
+        // data: [
+        //   [
+        //     `<div class="box">
+        //       <div class="box-left">
+        //         <div class="box-left-top">
+        //           <div>设备ID:<span class="idspan">3500000</span></div>
+        //           <div class="time">时间: <span>2023-08-04 10:25:34</span></div>
+        //         </div>
+        //         <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+        //       </div>
+        //       <div class="box-right">王艺涵</div>
+        //     </div>`,
+        //   ],
+        //   [
+        //     `<div class="box">
+        //       <div class="box-left">
+        //         <div class="box-left-top">
+        //           <div>设备ID:<span class="idspan">3500000</span></div>
+        //           <div class="time">时间: <span>2023-08-04 10:25:34</span></div>
+        //         </div>
+        //         <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+        //       </div>
+        //       <div class="box-right">王艺涵</div>
+        //     </div>`,
+        //   ],
+        //   [
+        //     `<div class="box">
+        //       <div class="box-left">
+        //         <div class="box-left-top">
+        //           <div>设备ID:<span class="idspan">3500000</span></div>
+        //           <div class="time">时间: <span>2023-08-04 10:25:34</span></div>
+        //         </div>
+        //         <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+        //       </div>
+        //       <div class="box-right">王艺涵</div>
+        //     </div>`,
+        //   ],
+        //   [
+        //     `<div class="box">
+        //       <div class="box-left">
+        //         <div class="box-left-top">
+        //           <div>设备ID:<span class="idspan">3500000</span></div>
+        //           <div class="time">时间: <span>2023-08-04 10:25:34</span></div>
+        //         </div>
+        //         <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+        //       </div>
+        //       <div class="box-right">王艺涵</div>
+        //     </div>`,
+        //   ],
+        //   [
+        //     `<div class="box">
+        //       <div class="box-left">
+        //         <div class="box-left-top">
+        //           <div>设备ID:<span class="idspan">3500000</span></div>
+        //           <div class="time">时间: <span>2023-08-04 10:25:34</span></div>
+        //         </div>
+        //         <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+        //       </div>
+        //       <div class="box-right">王艺涵</div>
+        //     </div>`,
+        //   ],
+        //   [
+        //     `<div class="box">
+        //       <div class="box-left">
+        //         <div class="box-left-top">
+        //           <div>设备ID:<span class="idspan">3500000</span></div>
+        //           <div class="time">时间: <span>2023-08-04 10:25:34</span></div>
+        //         </div>
+        //         <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+        //       </div>
+        //       <div class="box-right">王艺涵</div>
+        //     </div>`,
+        //   ],
+        //   [
+        //     `<div class="box">
+        //       <div class="box-left">
+        //         <div class="box-left-top">
+        //           <div>设备ID:<span class="idspan">3500000</span></div>
+        //           <div class="time">时间: <span>2023-08-04 10:25:34</span></div>
+        //         </div>
+        //         <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+        //       </div>
+        //       <div class="box-right">王艺涵</div>
+        //     </div>`,
+        //   ],
+        //   [
+        //     `<div class="box">
+        //       <div class="box-left">
+        //         <div class="box-left-top">
+        //           <div>设备ID:<span class="idspan">3500000</span></div>
+        //           <div class="time">时间: <span>2023-08-04 10:25:34</span></div>
+        //         </div>
+        //         <div class="box-left-under">消息:<span>手表未佩戴</span></div>
+        //       </div>
+        //       <div class="box-right">王艺涵</div>
+        //     </div>`,
+        //   ],
+        // ],
+        data: [],
         index: true,
         columnWidth: [50],
         align: ["center"],
         rowNum: 5,
+        waitTime: 1500,
         // headerBGC: "#1981f6",
         // headerHeight: 20,
         oddRowBGC: "rgba(0, 44, 81, 0.8)",
@@ -42,10 +158,75 @@ export default {
       },
     };
   },
+  mounted() {
+    this.getData();
+  },
+  methods: {
+    getData() {
+      let dataList = this.data;
+      let list = [];
+      dataList.forEach((item) => {
+        list.push([
+          `<div class="box">
+          <div class="box-left">
+            <div class="box-left-top">
+              <div>设备ID:<span class="idspan">${item.device_id_code}</span></div>
+              <div class="time">时间: <span>${item.createtime}</span></div>
+            </div>
+            <div class="box-left-under">消息:<span>${item.alarm_msg}</span></div>
+          </div>
+          <div class="box-right">${item.name}</div>
+        </div>`,
+        ]);
+      });
+      this.config.data = list;
+    },
+  },
 };
 </script>
 
 <style lang="scss" scoped>
+::v-deep .dv-scroll-board .rows .row-item {
+  height: 20% !important;
+  line-height: normal !important;
+  display: flex;
+  align-items: center;
+}
+.dv-scroll-board .rows .ceil {
+  overflow: auto;
+}
+::v-deep .box {
+  display: flex;
+  justify-content: space-between;
+  height: 100%;
+}
+::v-deep .box-left {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  // align-items: center;
+  .box-left-top {
+    height: 50%;
+    display: flex;
+    justify-content: space-around;
+    align-items: center;
+
+    .idspan {
+      color: #1790ff;
+      font-size: 15px;
+    }
+    .time {
+      margin-left: 5px;
+    }
+  }
+  .box-left-under {
+    height: 50%;
+  }
+}
+::v-deep .box-right {
+  color: #1fcb21;
+}
 #scroll-board {
   width: 100%;
   box-sizing: border-box;

+ 35 - 20
src/views/test/aaa.vue

@@ -18,7 +18,6 @@
     <div class="left-chart-item">
       <dv-charts class="item-chart" :option="option3" />
       <div class="item-chart-word gaojingshu">告警数</div>
-
     </div>
   </div>
 </template>
@@ -28,11 +27,22 @@ import LabelTag from "./LabelTag";
 
 export default {
   name: "BottomCharts",
+  props:{
+    data:{
+      type:Object,
+      default:{},
+    }
+  },
   components: {
     LabelTag,
   },
   data() {
     return {
+      equTotalData: {},
+      deviceCount: 0,
+      deviceOnline: 0,
+      un_deviceOnline: 0,
+      alarmCount: 0,
       option: {
         series: [
           {
@@ -43,7 +53,7 @@ export default {
             data: [
               {
                 name: "itemA",
-                value: 89,
+                value: this.data.deviceCount,
                 // gradient: ["#03c2fd", "#1ed3e5", "#2fded6"],
                 gradient: ["#01dcdf"],
               },
@@ -62,7 +72,7 @@ export default {
             },
             details: {
               show: true,
-              formatter: "{value}%",
+              formatter: "{value}",
               style: {
                 fill: "#1ed3e5",
                 fontSize: 20,
@@ -81,7 +91,7 @@ export default {
             data: [
               {
                 name: "itemA",
-                value: 89,
+                value: this.data.deviceOnline,
                 // gradient: ["#03c2fd", "#1ed3e5", "#2fded6"],
                 gradient: ["#33faaa"],
               },
@@ -100,7 +110,7 @@ export default {
             },
             details: {
               show: true,
-              formatter: "{value}%",
+              formatter: "{value}",
               style: {
                 fill: "#1ed3e5",
                 fontSize: 20,
@@ -119,10 +129,9 @@ export default {
             data: [
               {
                 name: "itemA",
-                value: 89,
+                value: this.data.un_deviceOnline,
                 // gradient: ["#03c2fd", "#1ed3e5", "#2fded6"],
                 gradient: ["#f7ac20"],
-
               },
             ],
             axisLabel: {
@@ -139,7 +148,7 @@ export default {
             },
             details: {
               show: true,
-              formatter: "{value}%",
+              formatter: "{value}",
               style: {
                 fill: "#1ed3e5",
                 fontSize: 20,
@@ -158,9 +167,9 @@ export default {
             data: [
               {
                 name: "itemA",
-                value: 89,
+                value: this.data.alarmCount,
                 // gradient: ["#03c2fd", "#1ed3e5", "#2fded6"],
-                gradient: ["#f93496", "#f61967","#f2053e"],
+                gradient: ["#f93496", "#f61967", "#f2053e"],
               },
             ],
             axisLabel: {
@@ -177,7 +186,7 @@ export default {
             },
             details: {
               show: true,
-              formatter: "{value}%",
+              formatter: "{value}",
               style: {
                 fill: "#1ed3e5",
                 fontSize: 20,
@@ -189,6 +198,12 @@ export default {
       },
     };
   },
+  mounted() {
+    // this.deviceView();
+  },
+  methods: {
+   
+  },
 };
 </script>
 
@@ -208,20 +223,20 @@ export default {
       height: calc(100% - 80px);
       position: relative;
     }
-    .item-chart-word{
+    .item-chart-word {
       font-size: 16px;
     }
-    .zongshu{
-      color:rgb(0, 253, 250);
+    .zongshu {
+      color: rgb(0, 253, 250);
     }
-    .zaixianshu{
-      color:rgb(7, 247, 168);
+    .zaixianshu {
+      color: rgb(7, 247, 168);
     }
-    .lixianshu{
-      color:rgb(227, 179, 55);
+    .lixianshu {
+      color: rgb(227, 179, 55);
     }
-    .gaojingshu{
-      color:rgb(245, 2, 61);
+    .gaojingshu {
+      color: rgb(245, 2, 61);
     }
   }
 }

+ 20 - 8
src/views/test/bbb.vue

@@ -25,14 +25,26 @@
 
 <script>
 import LabelTag from "./LabelTag";
+import { count, alarm } from "@/api/system/datav";
 
 export default {
   name: "BottomCharts",
+  props: {
+    number: {
+      type: Number,
+      default: 0,
+    },
+    data:{
+      type:Object,
+      default:{},
+    }
+  },
   components: {
     LabelTag,
   },
   data() {
     return {
+      // userTotal:0,
       option: {
         series: [
           {
@@ -43,7 +55,7 @@ export default {
             data: [
               {
                 name: "itemA",
-                value: 89,
+                value: this.number,
                 // gradient: ["#03c2fd", "#1ed3e5", "#2fded6"],
                 gradient: ["#01dcdf"],
               },
@@ -62,7 +74,7 @@ export default {
             },
             details: {
               show: true,
-              formatter: "{value}%",
+              formatter: "{value}",
               style: {
                 fill: "#1ed3e5",
                 fontSize: 20,
@@ -81,7 +93,7 @@ export default {
             data: [
               {
                 name: "itemA",
-                value: 89,
+                value: this.data.bindDevice,
                 // gradient: ["#03c2fd", "#1ed3e5", "#2fded6"],
                 gradient: ["#33faaa"],
               },
@@ -100,7 +112,7 @@ export default {
             },
             details: {
               show: true,
-              formatter: "{value}%",
+              formatter: "{value}",
               style: {
                 fill: "#1ed3e5",
                 fontSize: 20,
@@ -119,7 +131,7 @@ export default {
             data: [
               {
                 name: "itemA",
-                value: 89,
+                value: this.data.bindUser,
                 // gradient: ["#03c2fd", "#1ed3e5", "#2fded6"],
                 gradient: ["#f7ac20"],
               },
@@ -138,7 +150,7 @@ export default {
             },
             details: {
               show: true,
-              formatter: "{value}%",
+              formatter: "{value}",
               style: {
                 fill: "#1ed3e5",
                 fontSize: 20,
@@ -157,7 +169,7 @@ export default {
             data: [
               {
                 name: "itemA",
-                value: 89,
+                value: this.data.deviceOnline,
                 // gradient: ["#03c2fd", "#1ed3e5", "#2fded6"],
                 gradient: ["#f93496", "#f61967","#f2053e"],
               },
@@ -176,7 +188,7 @@ export default {
             },
             details: {
               show: true,
-              formatter: "{value}%",
+              formatter: "{value}",
               style: {
                 fill: "#1ed3e5",
                 fontSize: 20,

BIN
src/views/test/img/online-0.png


BIN
src/views/test/img/online-1.png


+ 681 - 138
src/views/test/index.vue

@@ -6,7 +6,7 @@
         <div class="left-top">
           <dv-border-box-13>
             <Border-Item title="设备总览">
-              <aaa />
+              <aaa v-if="equDataFlag" :data="equTotalData" />
               <!-- <Left-Chart-1 /> -->
               <!-- <Left-Chart-1 />
               <Left-Chart-1 />
@@ -21,7 +21,9 @@
         </div>
         <div class="left-under">
           <dv-border-box-13>
-            <Border-Item title="用户年龄总览"><Left-chart-under /></Border-Item>
+            <Border-Item title="用户年龄总览"
+              ><Left-chart-under v-if="userAgeFlag" :dataList="userAgeList"
+            /></Border-Item>
           </dv-border-box-13>
         </div>
       </div>
@@ -30,24 +32,41 @@
         <equ-map v-loading="mapLoading" @callback="initMap" />
         <div class="left-under">
           <dv-border-box-13>
-            <Border-Item title="报警列表"><Right-Bottom /></Border-Item>
+            <Border-Item title="报警列表"
+              ><Right-Bottom v-if="alarmListFlag" :data="alarmList"
+            /></Border-Item>
           </dv-border-box-13>
         </div>
       </div>
       <div class="right">
         <div class="left-top">
           <dv-border-box-13>
-            <Border-Item title="设备总览"> <bbb /></Border-Item>
+            <Border-Item title="设备总览">
+              <bbb
+                v-if="userTotalFlag && userDataFlag"
+                :number="userTotalData"
+                :data="userData"
+            /></Border-Item>
           </dv-border-box-13>
         </div>
         <div class="left-content">
           <dv-border-box-13>
-            <Border-Item title="月新增设备"><Left-Chart-2 /></Border-Item>
+            <Border-Item title="月新增设备"
+              ><Left-Chart-2
+                v-if="xylistFlag"
+                :xlist="xDataList"
+                :ylist="yDataList"
+            /></Border-Item>
           </dv-border-box-13>
         </div>
         <div class="left-under">
           <dv-border-box-13>
-            <Border-Item title="月新增用户"> <Middle-Chart /></Border-Item>
+            <Border-Item title="月新增用户">
+              <Middle-Chart
+                v-if="xyUserFlag"
+                :xlist="xDataList"
+                :ylist="yDataList"
+            /></Border-Item>
           </dv-border-box-13>
         </div>
       </div>
@@ -101,6 +120,8 @@ import bbb from "./bbb";
 import RightBottom from "./RightBottom";
 import MiddleChart from "./MiddleChart";
 
+import { deviceView,userAgeAll,count,deviceOver,alarmStatusList,addDevice,addUser } from "@/api/system/equdata";
+
 export default {
   name: "DataView",
   components: {
@@ -119,151 +140,642 @@ export default {
     bbb,
     RightBottom,
     LeftChartUnder,
-    MiddleChart
+    MiddleChart,
   },
   data() {
     return {
       mapLoading: false,
+      equTotalData: {},
+      equDataFlag: false,
+      userAgeFlag:false,
+      userTotalFlag:false,
+      userDataFlag:false,
+      alarmListFlag:false,
+      xylistFlag:false,
+      xyUserFlag:false,
+      userAgeList:[],
+      alarmList:[],
+      xDataList:[],
+      yDataList:[],
+      xUserList:[],
+      yUserList:[],
+      userTotalData:0,
     };
   },
+  mounted() {
+    this.deviceView();
+    this.userAgeAll();
+    this.userTotal()
+    this.getUserData()
+    this.getAlarmStatusList()
+    this.getEquData();
+    this.getAddUser()
+  },
   methods: {
+    getAddUser(){
+      addUser().then(res=>{
+        let xlist=res.data.map(item=>item.month)
+        let ylist=res.data.map(item=>item.count)
+        this.xUserList=xlist
+        this.yUserList=ylist
+        this.xyUserFlag=true
+      })
+    },
+    getEquData() {
+      addDevice().then(res=>{
+        let xlist=res.data.map(item=>item.month)
+        let ylist=res.data.map(item=>item.count)
+        this.xDataList=xlist
+        this.yDataList=ylist
+        this.xylistFlag=true
+      })
+    },
+    deviceView() {
+      deviceView().then((res) => {
+        this.equTotalData = res.data;
+        this.equDataFlag = true;
+      });
+    },
+    userTotal(){
+      count().then((res) => {
+        this.userTotalData=res.data
+        this.userTotalFlag=true
+      });
+    },
+    getUserData(){
+      deviceOver().then(res=>{
+        this.userData=res.data
+        this.userDataFlag=true
+      })
+    },
+    userAgeAll(){
+      userAgeAll().then(res=>{
+        this.userAgeList=res.data.list
+        this.userAgeFlag=true
+      })
+    },
+    getAlarmStatusList(){
+      alarmStatusList().then(res=>{
+        this.alarmList=res.data
+        this.alarmListFlag=true
+      })
+    },
     initMap(AMap) {
       this.AMap = AMap;
       this.map = new AMap.Map("map", {
-        // 设置地图容器id
+        resizeEnable: true,
         // viewMode: "3D", // 是否为3D地图模式
-        zoom: 5, // 初始化地图级别
-        center: [105.602725, 37.076636], // 初始化地图中心点位置
-        mapStyle: "amap://styles/darkblue"
-      });
-      this.clickMarker = new this.AMap.Marker();
-      this.addMapMarkers(this.AMap, {
-        equList: [
-          { lng: 105.602725, lat: 37.076636 },
-          { lng: 105.622725, lat: 37.75219686835205 },
-          // { lng: 154.8098755478859, lat: 18.75219686835205 },
-          // { lng: 183.8098755478859, lat: 34.75219686835205 },
-          // { lng: 178.8098755478859, lat: 3.75219686835205 },
-        ],
-      });
-      // this.getEquMap();
-      // 暂时放这里
-      this.map.on("click", (e) => {
-        console.log(e, "e");
-        this.regeoCode(e.lnglat);
+        zoom: 3.85, // 初始化地图级别
+        center: [101.835078, 42.90488], // 初始化地图中心点位置
       });
+      // this.mapLoading = false;
+      // this.secherPlace(AMap);
+      // this.districtSearch(AMap);
+      // this.ruler(AMap);
+      this.mapZoomChange();
+      this.aaa();
     },
-    // 地图覆盖物
-    addMapMarkers(AMap, data) {
-      // console.log(data,'data');
-      // // 项目中心点
-      // const centerMarker = new AMap.Marker({
-      //   position: new AMap.LngLat(data.projectLng, data.projectLat),
-      //   offset: new AMap.Pixel(-20, -20),
-      //   icon: require(`@/assets/map-icon/center.png`),
-      // });
-      // 设备分布点
-      this.markers = [];
-      data.equList.forEach((item) => {
-        const marker = new AMap.Marker({
-          position: new AMap.LngLat(item.lng, item.lat),
-          offset: new AMap.Pixel(-13, -30),
-          // icon: require(`@/assets/map-icon/${item.classifyCode}-${
-          //   item.online === 0 ? "GRAY" : item.flag ? "DEFAULT" : "DANGER"
-          //   }.png`),
-          icon: "https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
-          anchor: "bottom-center",
-          extData: {
-            id: item.id,
-            equNo: item.equNo,
-            netCode: data.netCode,
-            classifyCode: item.classifyCode,
-            flag: item.flag,
-            online: item.online,
-          },
-        });
-        this.markers.push(marker);
-        this.map.add(marker);
+    // 索引点聚合
+    // drawCluster(isCheck, isCheck2) {
+    //   // console.log(this.$refs.tree.getCheckedKeys(true));
+    //   if (this.cluster) {
+    //     this.cluster.setMap(null);
+    //   }
+    //   let points = [
+    //     {
+    //       code: 862607059021807,
+    //       equNo: "SHX-JG05276GS1932",
+    //       onlineState: 0,
+    //       storeName: "第1营业店(上海嘉定)",
+    //       storeErpCode: "03-01-01",
+    //       deptName: "通用设备二部",
+    //       lnglat: ["121.81513906780002", "30.89272014115498"],
+    //     },
+    //     {
+    //       code: 866041042138963,
+    //       equNo: "SHX-SG01142860SJ",
+    //       onlineState: 0,
+    //       storeName: "上海维修组",
+    //       storeErpCode: "08-01-01",
+    //       deptName: "资产中心",
+    //       lnglat: ["120.61801385657444", "31.977446558941004"],
+    //     },
+    //     {
+    //       code: 867383057214142,
+    //       equNo: "SHX-SG08898S-65XC",
+    //       onlineState: 0,
+    //       storeName: "第1营业店(上海嘉定)",
+    //       storeErpCode: "03-01-01",
+    //       deptName: "通用设备二部",
+    //       lnglat: ["121.03558147655212", "31.126224206828198"],
+    //     },
+    //     {
+    //       code: 864513041445245,
+    //       equNo: "SHX-JG37778JCPT1412DC",
+    //       onlineState: 0,
+    //       storeName: "第5营业店(上海闵行)",
+    //       storeErpCode: "03-03-08",
+    //       deptName: "通用设备二部",
+    //       lnglat: ["121.82208391421668", "30.85699004008208"],
+    //     },
+    //     {
+    //       code: 867032059016076,
+    //       equNo: "SHX-SG07695BT28ERT",
+    //       onlineState: 0,
+    //       storeName: "第3营业店(上海浦东)",
+    //       storeErpCode: "03-01-40",
+    //       deptName: "通用设备二部",
+    //       lnglat: ["121.5704633089994", "29.894328624226418"],
+    //     },
+    //     {
+    //       code: 868142047179180,
+    //       equNo: "SHX-JG46091S0812E",
+    //       onlineState: 0,
+    //       storeName: "第1营业店(上海嘉定)",
+    //       storeErpCode: "03-01-01",
+    //       deptName: "通用设备二部",
+    //       lnglat: ["121.31930274336634", "31.245171826552806"],
+    //     },
+    //     {
+    //       code: 867383057182588,
+    //       equNo: "SHX-JG55617S0607",
+    //       onlineState: 0,
+    //       storeName: "第1营业店(上海嘉定)",
+    //       storeErpCode: "03-01-01",
+    //       deptName: "通用设备二部",
+    //       lnglat: ["121.02616661110348", "31.22516500695246"],
+    //     },
+    //   ];;
+    //   // this.mapLoading = true;
+    //   // 写接口
+    //   // const equInfo2 = await this.getMapInfo(checkNodeKey, 0);
+    //   // const equInfo1 = await this.getMapInfo(checkNodeKey, 1);
+    //   // const { terminalList, data } = equInfo1.data;
+    //   this.map.setZoomAndCenter(3.85, [101.835078, 42.90488]);
+    //   const getNodes = (context) => {
+    //     console.log('context',context);
+    //     const clusterData = context.clusterData; // 聚合中包含数据
+    //     console.log('clusterData',clusterData);
+    //     const index = context.index; // 聚合的条件
+    //     console.log("index:", index);
+    //     const indexs = ["deptName", "storeErpCode", "equNo"];
+    //     const i = indexs.indexOf(index.mainKey);
+    //     let text =
+    //       i === 0 ? clusterData[0][index.mainKey] : clusterData[0].storeName;
+    //     if (i <= 1) {
+    //       const extra = '<p class="showCount">' + context.count + "</p>";
+    //       text = '<p class="showName">' + text + "</p>";
+    //       text += extra;
+    //     }
+    //     const style = {
+    //       index: i,
+    //       text,
+    //     };
+    //     return style;
+    //   };
+
+    //   const getPosition = (context) => {
+    //     console.log(context);
+    //     const key = context.index.mainKey;
+    //     const dataItem = context.clusterData && context.clusterData[0];
+    //     const clusterName = dataItem[key];
+    //     if (!clusterObj[clusterName]) {
+    //       return null;
+    //     }
+    //     const point = clusterObj[clusterName].point;
+    //     const centerLnglat = new this.AMap.LngLat(point[0], point[1]);
+    //     return centerLnglat;
+    //   };
+    //   // 自定义聚合点样式
+    //   const renderClusterMarker = (context) => {
+    //     const marker = context.marker; // 聚合点标记对象
+    //     const nodesObj = getNodes(context);
+    //     // 自定义点标记样式
+    //     const div = document.createElement("div");
+    //     if (nodesObj.index === 0) {
+    //       div.className = "amap-cluster amap-cluster-dep";
+    //     }
+    //     if (nodesObj.index === 1) {
+    //       div.className = "amap-cluster amap-cluster-shop";
+    //     }
+    //     if (nodesObj.index <= 1) {
+    //       // 聚合点自定义点击事件
+    //       marker.on("click", (e) => {
+    //         // console.log(e);
+    //         /* let curZoom = this.map.getZoom();
+    //         if (curZoom < 12) {
+    //           curZoom += 1;
+    //         } */
+    //         let curZoom = this.map.getZoom();
+    //         if (nodesObj.index === 0) {
+    //           curZoom = 4.9;
+    //         } else {
+    //           curZoom += 1;
+    //         }
+    //         this.map.setZoomAndCenter(curZoom, e.lnglat);
+    //       });
+
+    //       div.innerHTML = nodesObj.text;
+    //       marker.setContent(div);
+    //     } else {
+    //       // 非聚合点
+    //       const dataItem = context.clusterData[0];
+    //       marker.setIcon(require(`./img/online-${dataItem.onlineState}.png`));
+    //     }
+
+    //     // 自定义聚合点标记显示位置
+    //     const position = getPosition(context);
+    //     if (position) {
+    //       marker.setPosition(position);
+    //     }
+    //     marker.setAnchor("center");
+    //   };
+    //   const clusterIndexSet = {
+    //     equNo: {
+    //       minZoom: 9,
+    //       maxZoom: 22,
+    //     },
+    //   };
+    //   /* eslint-disable no-new */
+    //   this.cluster = new this.AMap.IndexCluster(this.map, points, {
+    //     renderClusterMarker,
+    //     clusterIndexSet,
+    //   });
+    //   this.mapLoading = false;
+    // },
+    // 监听地图缩放
+    mapZoomChange() {
+      this.map.on("zoomchange", () => {
+        const curZoom = this.map.getZoom();
+        console.log(curZoom);
+        if (curZoom < 12) {
+          this.map.clearInfoWindow();
+        }
       });
-      // console.log('this.markers',this.markers);
-      // const overlayGroups = new AMap.OverlayGroup(this.markers);
-      // // 比例尺
-      // // const scale = new AMap.Scale();
+    },
 
-      // this.map.add(overlayGroups);
-      // this.map.add(centerMarker);
-      // this.map.addControl(scale);
+    aaa(data, isCheck, isCheck2) {
+      if (this.cluster) {
+        this.cluster.setMap(null);
+      }
+      let points = [];
+      let clusterObj = {};
 
-      // // 鼠标点击marker弹出自定义的信息窗体
-      // overlayGroups.eachOverlay((overlay, index, collections) => {
-      //   const extData = overlay.getExtData();
-      //   overlay.on("click", () => {
-      //     const params = {
-      //       netCode: extData.netCode,
-      //       equNo: extData.equNo,
-      //     };
-      //     getEquInfo(params).then((res) => {
-      //       const info = res.data;
-      //       const id = extData.id;
-      //       const currentMarker = this.markers.find(
-      //         (item) => item._opts.extData.id === id
-      //       );
-      //       currentMarker.setIcon(
-      //         require(`@/assets/map-icon/${extData.classifyCode}-${
-      //           info.online === 0 ? "GRAY" : extData.flag ? "DEFAULT" : "DANGER"
-      //         }.png`)
-      //       );
-      //       const onlineEnum = {
-      //         0: "离线",
-      //         1: "在线",
-      //       };
-      //       info.projectName = data.projectName;
-      //       const infoWindow = new AMap.InfoWindow({
-      //         content: `<div class="equ-info-box">
-      //               <p class="equ-info-item"><span class="label">设备编号</span><span class="value" id="equNo">${
-      //                 info.equNo
-      //               }</span></p>
-      //               <p class="equ-info-item"><span class="label">当前设备状态</span><span class="value tag">${
-      //                 onlineEnum[info.online]
-      //               }</span></p>
-      //               <p class="equ-info-item"><span class="label">累计报警次数</span><span class="value link" onclick="goNextPage(this, 'alarmStat')" data-equNo="${
-      //                 info.equNo
-      //               }" data-name="${info.projectName}">${
-      //           info.alarmTotal
-      //         }</span></p>
-      //               <p class="equ-info-item"><span class="label">最近定位时间</span><span class="value">${
-      //                 info.positionTime
-      //               }</span></p>
-      //               <p class="equ-info-item"><span class="label">TBox品牌</span><span class="value">${
-      //                 info.brand
-      //               }</span></p>
-      //               <p class="equ-info-item"><span class="label">TBox编号</span><span class="value">${
-      //                 info.gpsId
-      //               }</span></p>
-      //               </div>`,
-      //         anchor: "top-center",
-      //       });
-      //       infoWindow.open(this.map, overlay.getPosition());
-      //     });
-      //   });
-      // });
+      points = [
+        {
+          code: 862607059021807,
+          equNo: "SHX-JG05276GS1932",
+          onlineState: 0,
+          storeName: "第1营业店(上海嘉定)",
+          storeErpCode: "03-01-01",
+          deptName: "通用设备二部",
+          lnglat: ["121.81513906780002", "30.89272014115498"],
+        },
+        {
+          code: 866041042138963,
+          equNo: "SHX-SG01142860SJ",
+          onlineState: 0,
+          storeName: "上海维修组",
+          storeErpCode: "08-01-01",
+          deptName: "资产中心",
+          lnglat: ["120.61801385657444", "31.977446558941004"],
+        },
+        {
+          code: 867383057214142,
+          equNo: "SHX-SG08898S-65XC",
+          onlineState: 0,
+          storeName: "第1营业店(上海嘉定)",
+          storeErpCode: "03-01-01",
+          deptName: "通用设备二部",
+          lnglat: ["121.03558147655212", "31.126224206828198"],
+        },
+        {
+          code: 864513041445245,
+          equNo: "SHX-JG37778JCPT1412DC",
+          onlineState: 0,
+          storeName: "第5营业店(上海闵行)",
+          storeErpCode: "03-03-08",
+          deptName: "通用设备二部",
+          lnglat: ["121.82208391421668", "30.85699004008208"],
+        },
+        {
+          code: 867032059016076,
+          equNo: "SHX-SG07695BT28ERT",
+          onlineState: 0,
+          storeName: "第3营业店(上海浦东)",
+          storeErpCode: "03-01-40",
+          deptName: "通用设备二部",
+          lnglat: ["121.5704633089994", "29.894328624226418"],
+        },
+        {
+          code: 868142047179180,
+          equNo: "SHX-JG46091S0812E",
+          onlineState: 0,
+          storeName: "第1营业店(上海嘉定)",
+          storeErpCode: "03-01-01",
+          deptName: "通用设备二部",
+          lnglat: ["121.31930274336634", "31.245171826552806"],
+        },
+        {
+          code: 867383057182588,
+          equNo: "SHX-JG55617S0607",
+          onlineState: 0,
+          storeName: "第1营业店(上海嘉定)",
+          storeErpCode: "03-01-01",
+          deptName: "通用设备二部",
+          lnglat: ["121.02616661110348", "31.22516500695246"],
+        },
+      ];
+      clusterObj = {
+        "03-04-40": {
+          nodeId: 200408003032,
+          nodeName: "第12营业店(苏州昆山)",
+          nodeErpCode: "03-04-40",
+          point: ["121.01714", "31.35137"],
+        },
+      };
+      console.log(clusterObj, "clusterObj");
+      this.map.setZoomAndCenter(3.85, [101.835078, 42.90488]);
+      const getNodes = (context) => {
+        console.log("context", context);
+        const clusterData = context.clusterData; // 聚合中包含数据
+        const index = context.index; // 聚合的条件
+        console.log("index:", index);
+        const indexs = ["deptName", "storeErpCode", "equNo"];
+        const i = indexs.indexOf(index.mainKey);
+        let text =
+          i === 0 ? clusterData[0][index.mainKey] : clusterData[0].storeName;
+        if (i <= 1) {
+          const extra = '<p class="showCount">' + context.count + "</p>";
+          text = '<p class="showName">' + text + "</p>";
+          text += extra;
+        }
+        const style = {
+          index: i,
+          text,
+        };
+        return style;
+      };
 
-      // // 地图的3km圆
-      // const circle = new AMap.Circle({
-      //   center: new AMap.LngLat(data.projectLng, data.projectLat), // 圆心位置
-      //   radius: data.radius * 1000, // 半径
-      //   strokeColor: "#367EF5", // 线颜色
-      //   strokeOpacity: 0.8, // 线透明度
-      //   strokeWeight: 1, // 线粗细度
-      //   fillColor: "#18FFFC", // 填充颜色
-      //   fillOpacity: 0.1, // 填充透明度
-      // });
-      // this.map.add(circle);
-      // this.map.setFitView();
-      /* this.map.on("click", (e) => {
-        this.regeoCode(e.lnglat);
-      }); */
+      const getPosition = (context) => {
+        console.log(context, "121212");
+        const key = context.index.mainKey;
+        const dataItem = context.clusterData && context.clusterData[0];
+        const clusterName = dataItem[key];
+        if (!clusterObj[clusterName]) {
+          return null;
+        }
+        const point = clusterObj[clusterName].point;
+        const centerLnglat = new this.AMap.LngLat(point[0], point[1]);
+        return centerLnglat;
+      };
+      // 自定义聚合点样式
+      const renderClusterMarker = (context) => {
+        const marker = context.marker; // 聚合点标记对象
+        console.log(marker, "45566");
+        const nodesObj = getNodes(context);
+        console.log(nodesObj, "nodesObj");
+        // 自定义点标记样式
+        const div = document.createElement("div");
+        if (nodesObj.index === 0) {
+          div.className = "amap-cluster amap-cluster-dep";
+        }
+        if (nodesObj.index === 1) {
+          div.className = "amap-cluster amap-cluster-shop";
+        }
+        if (nodesObj.index <= 1) {
+          // 聚合点自定义点击事件
+          marker.on("click", (e) => {
+            // console.log(e);
+            /* let curZoom = this.map.getZoom();
+            if (curZoom < 12) {
+              curZoom += 1;
+            } */
+            let curZoom = this.map.getZoom();
+            if (nodesObj.index === 0) {
+              curZoom = 4.9;
+            } else {
+              curZoom += 1;
+            }
+            this.map.setZoomAndCenter(curZoom, e.lnglat);
+          });
+          if (nodesObj.index === 1) {
+            marker.on("mouseover", () => {
+              this.marker = marker;
+              const key = context.index.mainKey;
+              const dataItem = context.clusterData && context.clusterData[0];
+              const clusterName = dataItem[key];
+              if (!clusterObj[clusterName]) {
+                return null;
+              }
+              const nodeId = clusterObj[clusterName].nodeId;
+              let showStatus = false;
+              if (this.shopInfoWindow) {
+                showStatus = this.shopInfoWindow.getIsOpen();
+              }
+              if (!showStatus) {
+                // 请求数据
+                getMapStoreInfo({ nodeId }).then((res) => {
+                  if (res) {
+                    const data = res.data;
+                    this.openShopInfoWindow(data);
+                  }
+                });
+              }
+            });
+          }
+          div.innerHTML = nodesObj.text;
+          marker.setContent(div);
+        } else {
+          // 非聚合点
+          const dataItem = context.clusterData[0];
+          console.log(dataItem, "2323");
+          marker.setIcon(require(`./img/online-${dataItem.onlineState}.png`));
+
+          // 自定义点击事件
+          marker.on("click", (e) => {
+            this.marker = marker;
+            const dataItem = context.clusterData[0];
+            const code = context.clusterData[0].code;
+
+            // 数据请求
+            getEquInfo(code).then(async (res) => {
+              if (res) {
+                this.equData = res.data;
+                this.equAddress = "根据经纬度查询地址失败";
+                this.equAddress = await this.getAddress(dataItem.lnglat);
+                this.openEquInfoWindow(this.equData, this.equAddress);
+              }
+            });
+          });
+        }
+
+        // 自定义聚合点标记显示位置
+        const position = getPosition(context);
+        if (position) {
+          marker.setPosition(position);
+        }
+        marker.setAnchor("center");
+      };
+      const clusterIndexSet = {
+        deptName: {
+          minZoom: 2,
+          maxZoom: 4.8,
+        },
+        storeErpCode: {
+          minZoom: 4.8,
+          maxZoom: 9,
+        },
+        equNo: {
+          minZoom: 9,
+          maxZoom: 22,
+        },
+      };
+      /* eslint-disable no-new */
+      this.cluster = new this.AMap.IndexCluster(this.map, points, {
+        renderClusterMarker,
+        clusterIndexSet,
+      });
+      this.mapLoading = false;
+      console.log(this.cluster, 777777);
     },
+    // initMap(AMap) {
+    //   this.AMap = AMap;
+    //   this.map = new AMap.Map("map", {
+    //     // 设置地图容器id
+    //     // viewMode: "3D", // 是否为3D地图模式
+    //     zoom: 5, // 初始化地图级别
+    //     center: [105.602725, 37.076636], // 初始化地图中心点位置
+    //     mapStyle: "amap://styles/darkblue",
+    //   });
+    //   this.clickMarker = new this.AMap.Marker();
+    //   this.addMapMarkers(this.AMap, {
+    //     equList: [
+    //       { lng: 105.602725, lat: 37.076636 },
+    //       { lng: 105.622725, lat: 37.75219686835205 },
+    //       // { lng: 154.8098755478859, lat: 18.75219686835205 },
+    //       // { lng: 183.8098755478859, lat: 34.75219686835205 },
+    //       // { lng: 178.8098755478859, lat: 3.75219686835205 },
+    //     ],
+    //   });
+    //   // this.getEquMap();
+    //   // 暂时放这里
+    //   this.map.on("click", (e) => {
+    //     console.log(e, "e");
+    //     this.regeoCode(e.lnglat);
+    //   });
+    // },
+    // // 地图覆盖物
+    // addMapMarkers(AMap, data) {
+    //   // console.log(data,'data');
+    //   // // 项目中心点
+    //   // const centerMarker = new AMap.Marker({
+    //   //   position: new AMap.LngLat(data.projectLng, data.projectLat),
+    //   //   offset: new AMap.Pixel(-20, -20),
+    //   //   icon: require(`@/assets/map-icon/center.png`),
+    //   // });
+    //   // 设备分布点
+    //   this.markers = [];
+    //   data.equList.forEach((item) => {
+    //     const marker = new AMap.Marker({
+    //       position: new AMap.LngLat(item.lng, item.lat),
+    //       offset: new AMap.Pixel(-13, -30),
+    //       // icon: require(`@/assets/map-icon/${item.classifyCode}-${
+    //       //   item.online === 0 ? "GRAY" : item.flag ? "DEFAULT" : "DANGER"
+    //       //   }.png`),
+    //       icon: "https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
+    //       anchor: "bottom-center",
+    //       extData: {
+    //         id: item.id,
+    //         equNo: item.equNo,
+    //         netCode: data.netCode,
+    //         classifyCode: item.classifyCode,
+    //         flag: item.flag,
+    //         online: item.online,
+    //       },
+    //     });
+    //     this.markers.push(marker);
+    //     this.map.add(marker);
+    //   });
+    //   // console.log('this.markers',this.markers);
+    //   // const overlayGroups = new AMap.OverlayGroup(this.markers);
+    //   // // 比例尺
+    //   // // const scale = new AMap.Scale();
+
+    //   // this.map.add(overlayGroups);
+    //   // this.map.add(centerMarker);
+    //   // this.map.addControl(scale);
+
+    //   // // 鼠标点击marker弹出自定义的信息窗体
+    //   // overlayGroups.eachOverlay((overlay, index, collections) => {
+    //   //   const extData = overlay.getExtData();
+    //   //   overlay.on("click", () => {
+    //   //     const params = {
+    //   //       netCode: extData.netCode,
+    //   //       equNo: extData.equNo,
+    //   //     };
+    //   //     getEquInfo(params).then((res) => {
+    //   //       const info = res.data;
+    //   //       const id = extData.id;
+    //   //       const currentMarker = this.markers.find(
+    //   //         (item) => item._opts.extData.id === id
+    //   //       );
+    //   //       currentMarker.setIcon(
+    //   //         require(`@/assets/map-icon/${extData.classifyCode}-${
+    //   //           info.online === 0 ? "GRAY" : extData.flag ? "DEFAULT" : "DANGER"
+    //   //         }.png`)
+    //   //       );
+    //   //       const onlineEnum = {
+    //   //         0: "离线",
+    //   //         1: "在线",
+    //   //       };
+    //   //       info.projectName = data.projectName;
+    //   //       const infoWindow = new AMap.InfoWindow({
+    //   //         content: `<div class="equ-info-box">
+    //   //               <p class="equ-info-item"><span class="label">设备编号</span><span class="value" id="equNo">${
+    //   //                 info.equNo
+    //   //               }</span></p>
+    //   //               <p class="equ-info-item"><span class="label">当前设备状态</span><span class="value tag">${
+    //   //                 onlineEnum[info.online]
+    //   //               }</span></p>
+    //   //               <p class="equ-info-item"><span class="label">累计报警次数</span><span class="value link" onclick="goNextPage(this, 'alarmStat')" data-equNo="${
+    //   //                 info.equNo
+    //   //               }" data-name="${info.projectName}">${
+    //   //           info.alarmTotal
+    //   //         }</span></p>
+    //   //               <p class="equ-info-item"><span class="label">最近定位时间</span><span class="value">${
+    //   //                 info.positionTime
+    //   //               }</span></p>
+    //   //               <p class="equ-info-item"><span class="label">TBox品牌</span><span class="value">${
+    //   //                 info.brand
+    //   //               }</span></p>
+    //   //               <p class="equ-info-item"><span class="label">TBox编号</span><span class="value">${
+    //   //                 info.gpsId
+    //   //               }</span></p>
+    //   //               </div>`,
+    //   //         anchor: "top-center",
+    //   //       });
+    //   //       infoWindow.open(this.map, overlay.getPosition());
+    //   //     });
+    //   //   });
+    //   // });
+
+    //   // // 地图的3km圆
+    //   // const circle = new AMap.Circle({
+    //   //   center: new AMap.LngLat(data.projectLng, data.projectLat), // 圆心位置
+    //   //   radius: data.radius * 1000, // 半径
+    //   //   strokeColor: "#367EF5", // 线颜色
+    //   //   strokeOpacity: 0.8, // 线透明度
+    //   //   strokeWeight: 1, // 线粗细度
+    //   //   fillColor: "#18FFFC", // 填充颜色
+    //   //   fillOpacity: 0.1, // 填充透明度
+    //   // });
+    //   // this.map.add(circle);
+    //   // this.map.setFitView();
+    //   /* this.map.on("click", (e) => {
+    //     this.regeoCode(e.lnglat);
+    //   }); */
+    // },
   },
 };
 </script>
@@ -272,7 +784,7 @@ export default {
 #data-view-container {
   width: 100%;
   // height: 100%;
-  min-height:calc(100vh - 84px);
+  min-height: calc(100vh - 84px);
   background-color: #030409;
   color: #fff;
   overflow: hidden;
@@ -280,7 +792,6 @@ export default {
   background-size: 100%;
   background-repeat: no-repeat;
 
-
   .main {
     display: flex;
     padding: 0 10px 10px 10px;
@@ -342,8 +853,40 @@ export default {
       }
     }
   }
-
-
-
+  ::v-deep.amap-cluster {
+    position: relative;
+    color: #fff;
+    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
+    border-radius: 4px;
+    text-align: center;
+    &::after {
+      content: "";
+      position: absolute;
+      display: block;
+      width: 0;
+      height: 0;
+      border-color: transparent;
+      border-style: solid;
+      border-width: 6px;
+      border-bottom-width: 0;
+      left: 50%;
+      bottom: -6px;
+      transform: translate(-50%, 0);
+    }
+  }
+  ::v-deep.amap-cluster-dep {
+    width: 140px;
+    background: #d11128;
+    &::after {
+      border-top-color: #d11128;
+    }
+  }
+  ::v-deep.amap-cluster-shop {
+    width: 170px;
+    background: #f25668;
+    &::after {
+      border-top-color: #f25668;
+    }
+  }
 }
 </style>

+ 2 - 2
vue.config.js

@@ -35,8 +35,8 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        // target: `http://118.195.207.241:8088`,
-        target: `http://43.138.30.29:8080`,
+        target: `http://118.195.207.241:8088`,
+        // target: `http://43.138.30.29:8080`,
         //  target: `http://localhost:8080`,
         changeOrigin: true,
         pathRewrite: {