Ver código fonte

Merge branch 'dev_g' of United_Software/k_online_ui into dev

Jack Zhou 1 ano atrás
pai
commit
4b280c7eea

+ 13 - 2
src/views/Dashboard/src/DashboardView.vue

@@ -41,6 +41,7 @@ const handleTabClick = (tab: any) => {
   } else {
     isShowtitle1.value = false
   }
+  GetTop10ODEcharts(dashboardObj.Top10faultData)
 }
 const KPIDefaulteData = ref()
 const PendingDefaulteData = ref()
@@ -284,6 +285,8 @@ const Top1OInterval_dest = reactive({
   interval: 0
 })
 const TopOriginLoading = ref(true)
+const Top10Originref = ref()
+const Top10Destinationref = ref()
 const GetTop10ODEcharts = (val: any) => {
   dashboardObj.Top10faultData = val
   $api
@@ -292,6 +295,12 @@ const GetTop10ODEcharts = (val: any) => {
     })
     .then((res: any) => {
       if (res.code === 200) {
+        // Top10Originref.value[0].updataMapObj(dashboardObj.Top10faultData)
+        if (isShowtitle1.value) {
+          Top10Originref.value[0].updataMapObj(res.data.toporiginMap)
+        } else {
+          Top10Destinationref.value[0].updataMapObj(res.data.topdestinationinMap)
+        }
         Top10Obj.DestinationData = res.data.seller_data_list_destination
         Top10Obj.OriginData = res.data.seller_data_list_origin
         Top1OInterval.Max = res.data.Max
@@ -1037,7 +1046,8 @@ const ClickParams = (val: any) => {
                     ></SellerChart>
                   </div>
                   <div class="map">
-                    <TopMap :obj="dashboardObj.Top10faultData"></TopMap>
+                    <!-- <TopMap :obj="dashboardObj.Top10faultData" ref="Top10Originref"></TopMap> -->
+                    <TopMap ref="Top10Originref"></TopMap>
                   </div>
                 </div>
               </template>
@@ -1054,7 +1064,8 @@ const ClickParams = (val: any) => {
                     ></SellerChart>
                   </div>
                   <div class="map" style="height: 272px">
-                    <TopMap :obj="dashboardObj.Top10faultData"></TopMap>
+                    <!-- <TopMap :obj="dashboardObj.Top10faultData" ref="Top10Destinationref"></TopMap> -->
+                    <TopMap ref="Top10Destinationref"></TopMap>
                   </div>
                 </div>
               </template>

+ 2 - 6
src/views/Dashboard/src/components/BarChart.vue

@@ -102,14 +102,10 @@ const initOption = reactive({
           item.marker +
           item.seriesName +
           ': ' +
-          item.value.toLocaleString() +
+          item.value +
           '</div>'
       })
-      str +=
-        '<div style= ' +
-        'color:#FFF;font-family: Lato-Light>Total: ' +
-        allnum.toLocaleString() +
-        '</div>'
+      str += '<div style= ' + 'color:#FFF;font-family: Lato-Light>Total: ' + allnum + '</div>'
       return str
     },
     textStyle: {

+ 58 - 33
src/views/Dashboard/src/components/TopMap.vue

@@ -3,18 +3,19 @@ import { onMounted, ref, watch } from 'vue'
 import OriginIcon from '../image/hhh_2.png'
 import L from 'leaflet'
 const MapDataList = ref([])
-const props = defineProps({
-  obj: {
-    type: Object
-  }
-})
-const mapobj = ref(props.obj)
-watch(
-  () => props.obj,
-  (current) => {
-    mapobj.value = current
-  }
-)
+// const props = defineProps({
+//   obj: {
+//     type: Object
+//   }
+// })
+// const mapobj = ref(props.obj)
+const mapobj = ref()
+// watch(
+//   () => props.obj,
+//   (current) => {
+//     mapobj.value = current
+//   }
+// )
 
 const originIcon = L.icon({
   iconUrl: OriginIcon,
@@ -110,30 +111,54 @@ const init = () => {
       }, 0)
     }
   }
-  $api
-    .GetTop10ODEcharts({
-      ...mapobj.value
-    })
-    .then((res: any) => {
-      if (res.code === 200) {
-        res.data.toporiginMap &&
-          res.data.toporiginMap.forEach((item: any) => {
-            MapDataList.value.push({
-              color: item.color,
-              name: item.name,
-              qandl: item.qandl,
-              textcolor: item.textcolor,
-              value: item.value
-            })
-          })
-
-        // 请求成功后添加标记,并动态添加重置按钮
-        addMarkersToMap()
-      }
+  if (mapobj.value) {
+    mapobj.value.forEach((item: any) => {
+      MapDataList.value.push({
+        color: item.color,
+        name: item.name,
+        qandl: item.qandl,
+        textcolor: item.textcolor,
+        value: item.value
+      })
     })
+
+    // 请求成功后添加标记,并动态添加重置按钮
+    addMarkersToMap()
+  }
+  // $api
+  //   .GetTop10ODEcharts({
+  //     ...mapobj.value
+  //   })
+  //   .then((res: any) => {
+  //     if (res.code === 200) {
+  //       res.data.toporiginMap &&
+  //         res.data.toporiginMap.forEach((item: any) => {
+  //           MapDataList.value.push({
+  //             color: item.color,
+  //             name: item.name,
+  //             qandl: item.qandl,
+  //             textcolor: item.textcolor,
+  //             value: item.value
+  //           })
+  //         })
+
+  //       // 请求成功后添加标记,并动态添加重置按钮
+  //       addMarkersToMap()
+  //     }
+  //   })
 }
-onMounted(() => {
+// onMounted(() => {
+//   init()
+// })
+
+const updataMapObj = (val: any) => {
+  mapobj.value = val
+  console.log(mapobj.value)
   init()
+}
+
+defineExpose({
+  updataMapObj
 })
 </script>
 <template>