소스 검색

充电走势图修改

zuy 2 년 전
부모
커밋
246f0d9afc
1개의 변경된 파일13개의 추가작업 그리고 29개의 파일을 삭제
  1. 13 29
      admin-web/src/views/admin/index.vue

+ 13 - 29
admin-web/src/views/admin/index.vue

@@ -29,10 +29,12 @@
       <el-col :xs="24" :sm="14" :md="14" :lg="16" :xl="16">
         <div class="home-card-item">
           <el-date-picker
+              @change="loadStationStat"
+              value-format="YYYY-MM-DD"
               v-model="state.dateRange"
               type="daterange"
               unlink-panels
-              range-separator="To"
+              range-separator=""
               start-placeholder="开始时间"
               end-placeholder="结束时间"
               :shortcuts="shortcuts"
@@ -46,31 +48,6 @@
         </div>
       </el-col>
     </el-row>
-<!--    <el-row :gutter="15" class="home-card-three">-->
-<!--      <el-col :xs="24" :sm="10" :md="10" :lg="8" :xl="8">-->
-<!--        <div class="home-card-item">-->
-<!--          <div class="home-card-item-title">快捷导航工具</div>-->
-<!--          <div class="home-monitor">-->
-<!--            <div class="flex-warp">-->
-<!--              <div class="flex-warp-item" v-for="(v, k) in state.homeThree" :key="k">-->
-<!--                <div class="flex-warp-item-box" :class="`home-animation${k}`">-->
-<!--                  <div class="flex-margin">-->
-<!--                    <i :class="v.icon" :style="{ color: v.iconColor }"></i>-->
-<!--                    <span class="pl5">{{ v.label }}</span>-->
-<!--                    <div class="mt10">{{ v.value }}</div>-->
-<!--                  </div>-->
-<!--                </div>-->
-<!--              </div>-->
-<!--            </div>-->
-<!--          </div>-->
-<!--        </div>-->
-<!--      </el-col>-->
-<!--      <el-col :xs="24" :sm="14" :md="14" :lg="16" :xl="16" class="home-media">-->
-<!--        <div class="home-card-item">-->
-<!--          <div style="height: 100%" ref="homeBarRef"></div>-->
-<!--        </div>-->
-<!--      </el-col>-->
-<!--    </el-row>-->
   </div>
 </template>
 
@@ -99,9 +76,13 @@ const end = new Date()
 const start = new Date()
 start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
 
-const state = reactive({
+const defaultTime = ref<[Date, Date]>([
+  new Date(2000, 1, 1, 12, 0, 0),
+  new Date(2000, 2, 1, 23, 59, 59),
+])
 
-  dateRange:[start,end],
+const state = reactive({
+  dateRange:[u.date.format(start,"YYYY-MM-DD"),u.date.format(end,"YYYY-MM-DD")],
   global: {
     homeChartOne: null,
     homeChartTwo: null,
@@ -491,7 +472,10 @@ const loadCurrentEquipmentStatus = ()=>{
 
 
 const loadStationStat = ()=>{
-  $get(`stat/stationStat`,{startTime:state.dateRange[0],endTime:state.dateRange[1],type:'day',pageSize:31}).then((res:any)=>{
+  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}).then((res:any)=>{
     console.log(res)
     initLineChart(res.list);
   })