skyline 2 лет назад
Родитель
Сommit
1ec6d05623
1 измененных файлов с 14 добавлено и 8 удалено
  1. 14 8
      admin-web/src/views/admin/index.vue

+ 14 - 8
admin-web/src/views/admin/index.vue

@@ -97,7 +97,7 @@ const defaultTime = ref<[Date, Date]>([
 ])
 
 const state = reactive({
-  currentStationId:null,
+  currentStationId: null,
   dateRange: [u.date.format(start, "YYYY-MM-DD"), u.date.format(end, "YYYY-MM-DD")],
   global: {
     homeChartOne: null,
@@ -325,7 +325,8 @@ const initLineChart = (dataList: Array<any>) => {
 const initPieChart = (dataMap: any) => {
   if (!state.global.dispose.some((b: any) => b === state.global.homeChartTwo)) state.global.homeChartTwo.dispose();
   state.global.homeChartTwo = markRaw(echarts.init(homePieRef.value, state.charts.theme));
-  var getname = ['空闲', '已连接', '充电中'];
+  var getname = ['离线', '空闲', '已连接', '充电中', '预约中', '故障'];
+  const colorList = ['#6B6F75FF', '#36C78B', '#e9ee8e', '#ffa496', '#E790E8','#363638FF'];
   // var getvalue = [34.2, 38.87, 17.88];
   // var data = [dataMap["0"]||0,dataMap["1"]||0,dataMap["2"]||0];
   var data = [];
@@ -333,7 +334,6 @@ const initPieChart = (dataMap: any) => {
     data.push({name: getname[i], value: dataMap[`${i}`] || 0});
   }
 
-  const colorList = ['#51A3FC', '#36C78B', '#FEC279', '#968AF5', '#E790E8'];
   const option = {
     backgroundColor: state.charts.bgColor,
     title: {
@@ -425,7 +425,7 @@ const initEchartsResize = () => {
 };
 
 const loadCurrentEquipmentStatus = () => {
-  $get(`equipment/statEquipmentStatus`,{stationId:state.currentStationId}).then((res: any) => {
+  $get(`equipment/statEquipmentStatus`, {stationId: state.currentStationId}).then((res: any) => {
     console.log(res)
     initPieChart(res || {});
   })
@@ -436,7 +436,13 @@ const loadStationStat = () => {
   let start = state.dateRange[0]
   let end = state.dateRange[1]
   let size = u.date.diff(new Date(start), new Date(end)) + 1;
-  $get(`stat/stationStat`, {startTime: start, endTime: end, type: 'day', pageSize: size,stationId:state.currentStationId}).then((res: any) => {
+  $get(`stat/stationStat`, {
+    startTime: start,
+    endTime: end,
+    type: 'day',
+    pageSize: size,
+    stationId: state.currentStationId
+  }).then((res: any) => {
     console.log(res)
     state.homeOneExtra = res.extraData
     initLineChart(res.list);
@@ -444,7 +450,7 @@ const loadStationStat = () => {
 }
 
 const loadStationStatToday = () => {
-  $get(`stat/stationTodayStat`,{stationId:state.currentStationId}).then((res: any) => {
+  $get(`stat/stationTodayStat`, {stationId: state.currentStationId}).then((res: any) => {
     console.log(res)
     if (!u.isEmptyOrNull(res)) {
       let {chargeUsers, totalOrders, totalPower, totalMoney, elecMoney, serviceMoney} = res
@@ -461,7 +467,7 @@ const loadStationStatToday = () => {
 // 页面加载时
 onMounted(() => {
   var currentStationId = Session.get("currentStationId");
-  if(currentStationId){
+  if (currentStationId) {
     state.currentStationId = currentStationId;
   }
   console.error("home onMounted")
@@ -476,7 +482,7 @@ onMounted(() => {
   loadCurrentEquipmentStatus();
 
   mittBus.on('stationChangeRefresh', (stationId) => {
-    if(stationId){
+    if (stationId) {
       state.currentStationId = stationId;
       loadStationStat()
       loadStationStatToday()