spring
2025-02-17 ffa4fdb58442c4e4304d14ec8ac6fb7f34fb4c69
修改统计日期传参
已修改3个文件
1884 ■■■■■ 文件已修改
src/components/view/b4-daily-business-statistics.vue 687 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/b4-inspection-item-statistics.vue 799 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/b4-site-hours-statistics.vue 398 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/b4-daily-business-statistics.vue
@@ -1,328 +1,486 @@
<template>
<div class="daily-main" v-loading="loading">
  <div class="daily-content" style="height:100%">
    <div class="time" style="margin-bottom: 10px;">
      <el-radio-group v-model="type" size="small">
        <el-radio-button label="周" ></el-radio-button>
        <el-radio-button label="月"></el-radio-button>
        <el-radio-button label="年"></el-radio-button>
      </el-radio-group>
      <el-date-picker
        v-model="time.week"
        type="week"
        format="yyyy 第 WW 周"
        placeholder="选择周" size="small" v-if="type=='周'" @change="m=>changeTime(type,m)">
      </el-date-picker>
      <el-date-picker
        v-model="time.month"
        type="month"
        placeholder="选择月" size="small" v-if="type=='月'" @change="m=>changeTime(type,m)">
      </el-date-picker>
      <el-date-picker
        v-model="time.year"
        type="year"
        placeholder="选择年" size="small" v-if="type=='年'" @change="m=>changeTime(type,m)">
      </el-date-picker>
  <div class="daily-main" v-loading="loading">
    <div class="daily-content" style="height:100%">
      <div class="time" style="margin-bottom: 10px;">
        <el-radio-group v-model="type" size="small">
          <el-radio-button label="周"></el-radio-button>
          <el-radio-button label="月"></el-radio-button>
          <el-radio-button label="年"></el-radio-button>
        </el-radio-group>
        <el-date-picker
          v-model="time.week"
          type="week"
          format="yyyy 第 WW 周"
          placeholder="选择周"
          size="small"
          v-if="type == '周'"
          @change="m => changeTime(type, m)"
        >
        </el-date-picker>
        <el-date-picker
          v-model="time.month"
          type="month"
          placeholder="选择月"
          size="small"
          v-if="type == '月'"
          @change="m => changeTime(type, m)"
        >
        </el-date-picker>
        <el-date-picker
          v-model="time.year"
          type="year"
          placeholder="选择年"
          size="small"
          v-if="type == '年'"
          @change="m => changeTime(type, m)"
        >
        </el-date-picker>
      </div>
      <el-row :gutter="20">
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="daily-card">
            <div class="daily-head">
              <div class="daily-head-left">
                <h4>本{{ type }}任务接收</h4>
                <span>{{ pageData.RECEIVE }}</span>
              </div>
              <img src="../../../static/img/daliy-0.svg" alt="" srcset="" />
            </div>
            <div class="daily-head-left-info">
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.RECEIVE_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.RECEIVE_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.RECEIVE_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="daily-card">
            <div class="daily-head">
              <div class="daily-head-left">
                <h4>本{{ type }}任务完成</h4>
                <span>{{ pageData.FINISHE }}</span>
              </div>
              <img src="../../../static/img/daliy-1.svg" alt="" srcset="" />
            </div>
            <div class="daily-head-left-info">
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.FINISHE_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.FINISHE_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.FINISHE_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="daily-card">
            <div class="daily-head">
              <div class="daily-head-left">
                <h4>本{{ type }}任务剩余</h4>
                <span>{{ pageData.SURPLUS }}</span>
              </div>
              <img src="../../../static/img/daliy-2.svg" alt="" srcset="" />
            </div>
            <div class="daily-head-left-info">
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.SURPLUS_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.SURPLUS_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.SURPLUS_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="daily-card">
            <div class="daily-head">
              <div class="daily-head-left">
                <h4>本{{ type }}检测费用</h4>
                <span>¥{{ handlePrice(pageData.PRICE) }}</span>
              </div>
              <img src="../../../static/img/daliy-3.svg" alt="" srcset="" />
            </div>
            <div class="daily-head-left-info">
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.PRICE_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.PRICE_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.PRICE_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="daily-card">
            <div class="daily-head">
              <div class="daily-head-left">
                <h4>本{{ type }}检测工时</h4>
                <span>{{ pageData.COST }}</span>
              </div>
              <img src="../../../static/img/daliy-4.svg" alt="" srcset="" />
            </div>
            <div class="daily-head-left-info">
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.COST_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.COST_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.COST_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="daily-card">
            <div class="daily-head">
              <div class="daily-head-left">
                <h4>本{{ type }}检测人员</h4>
                <span>{{ pageData.PERSON }}</span>
              </div>
              <img src="../../../static/img/daliy-5.svg" alt="" srcset="" />
            </div>
            <div class="daily-head-left-info">
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.PERSON_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.PERSON_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.PERSON_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
      </el-row>
      <el-row :gutter="20" style="height: calc(100% - 200px);">
        <el-col
          :xs="24"
          :sm="24"
          :md="12"
          :lg="12"
          :xl="12"
          style="margin-bottom: 16px;height: 100%;"
        >
          <div class="daily-card chart-box" style="height: 100%;">
            <h4>本{{ type }}任务接收量</h4>
            <echart-module
              :id="'daily-left'"
              :config="chartConfig0"
              :datas="chartData0"
              style="height: calc(100% - 32px);"
            ></echart-module>
          </div>
        </el-col>
        <el-col
          :xs="24"
          :sm="24"
          :md="12"
          :lg="12"
          :xl="12"
          style="margin-bottom: 16px;height: 100%;"
        >
          <div class="daily-card chart-box" style="height: 100%;">
            <h4>本{{ type }}实际完成任务与接收任务对比</h4>
            <echart-module
              :id="'daily-right'"
              :config="chartConfig1"
              :datas="chartData1"
              style="height: calc(100% - 32px);"
            ></echart-module>
          </div>
        </el-col>
      </el-row>
    </div>
    <el-row :gutter="20">
      <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <div class="daily-card">
          <div class="daily-head">
            <div class="daily-head-left">
              <h4>本{{type}}任务接收</h4>
              <span>{{ pageData.RECEIVE }}</span>
            </div>
            <img src="../../../static/img/daliy-0.svg" alt="" srcset="">
          </div>
          <div class="daily-head-left-info">
            <img :src="`../../../static/img/daliy-${pageData.RECEIVE_RATIO<0?'down':'up'}.svg`" alt="">
            <span :class="{active:pageData.RECEIVE_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.RECEIVE_RATIO)}%&nbsp; `"></span>
            <span style="font-size: 12px;">较上{{type}}</span>
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <div class="daily-card">
          <div class="daily-head">
            <div class="daily-head-left">
              <h4>本{{type}}任务完成</h4>
              <span >{{ pageData.FINISHE }}</span>
            </div>
            <img src="../../../static/img/daliy-1.svg" alt="" srcset="">
          </div>
          <div class="daily-head-left-info">
            <img :src="`../../../static/img/daliy-${pageData.FINISHE_RATIO<0?'down':'up'}.svg`" alt="">
            <span :class="{active:pageData.FINISHE_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.FINISHE_RATIO)}%&nbsp; `"></span>
            <span style="font-size: 12px;">较上{{type}}</span>
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <div class="daily-card">
          <div class="daily-head">
            <div class="daily-head-left">
              <h4>本{{type}}任务剩余</h4>
              <span >{{ pageData.SURPLUS }}</span>
            </div>
            <img src="../../../static/img/daliy-2.svg" alt="" srcset="">
          </div>
          <div class="daily-head-left-info">
            <img :src="`../../../static/img/daliy-${pageData.SURPLUS_RATIO<0?'down':'up'}.svg`" alt="">
            <span :class="{active:pageData.SURPLUS_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.SURPLUS_RATIO)}%&nbsp; `"></span>
            <span style="font-size: 12px;">较上{{type}}</span>
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <div class="daily-card">
          <div class="daily-head">
            <div class="daily-head-left">
              <h4>本{{type}}检测费用</h4>
              <span>¥{{ handlePrice(pageData.PRICE) }}</span>
            </div>
            <img src="../../../static/img/daliy-3.svg" alt="" srcset="">
          </div>
          <div class="daily-head-left-info">
            <img :src="`../../../static/img/daliy-${pageData.PRICE_RATIO<0?'down':'up'}.svg`" alt="">
            <span :class="{active:pageData.PRICE_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.PRICE_RATIO)}%&nbsp; `"></span>
            <span style="font-size: 12px;">较上{{type}}</span>
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <div class="daily-card">
          <div class="daily-head">
            <div class="daily-head-left">
              <h4>本{{type}}检测工时</h4>
              <span>{{pageData.COST}}</span>
            </div>
            <img src="../../../static/img/daliy-4.svg" alt="" srcset="">
          </div>
          <div class="daily-head-left-info">
            <img :src="`../../../static/img/daliy-${pageData.COST_RATIO<0?'down':'up'}.svg`" alt="">
            <span :class="{active:pageData.COST_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.COST_RATIO)}%&nbsp; `"></span>
            <span style="font-size: 12px;">较上{{type}}</span>
          </div>
        </div>
      </el-col>
      <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <div class="daily-card">
          <div class="daily-head">
            <div class="daily-head-left">
              <h4>本{{type}}检测人员</h4>
              <span >{{ pageData.PERSON }}</span>
            </div>
            <img src="../../../static/img/daliy-5.svg" alt="" srcset="">
          </div>
          <div class="daily-head-left-info">
            <img :src="`../../../static/img/daliy-${pageData.PERSON_RATIO<0?'down':'up'}.svg`" alt="">
            <span :class="{active:pageData.PERSON_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.PERSON_RATIO)}%&nbsp; `"></span>
            <span style="font-size: 12px;">较上{{type}}</span>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="height: calc(100% - 200px);">
      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px;height: 100%;">
        <div class="daily-card chart-box" style="height: 100%;">
          <h4>本{{type}}任务接收量</h4>
          <echart-module :id="'daily-left'" :config="chartConfig0" :datas="chartData0" style="height: calc(100% - 32px);"></echart-module>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px;height: 100%;">
        <div class="daily-card chart-box" style="height: 100%;">
          <h4>本{{type}}实际完成任务与接收任务对比</h4>
          <echart-module :id="'daily-right'" :config="chartConfig1" :datas="chartData1" style="height: calc(100% - 32px);"></echart-module>
        </div>
      </el-col>
    </el-row>
  </div>
</div>
</template>
<script>
import EchartModule from '../tool/echart.vue'
import {
        getYearAndMonthAndDays
    } from '../../util/date'
import EchartModule from "../tool/echart.vue";
import { getYearAndMonthAndDays } from "../../util/date";
export default {
  components: {EchartModule},
  data(){
    return{
      chartConfig0:{
        height: '',
        isLoading:false,
        type:'line'
  components: { EchartModule },
  data() {
    return {
      chartConfig0: {
        height: "",
        isLoading: false,
        type: "line"
      },
      chartData0:{
        xData:[],
        yData:[
      chartData0: {
        xData: [],
        yData: [
          {
            title:'任务接收量',
            data:[]
            title: "任务接收量",
            data: []
          }
        ]
      },
      chartConfig1:{
        height: '',
        isLoading:false,
        type:'bar'
      chartConfig1: {
        height: "",
        isLoading: false,
        type: "bar"
      },
      chartData1:{
        xData:[],
        yData:[
      chartData1: {
        xData: [],
        yData: [
          {
            title:'接收',
            data:[]
            title: "接收",
            data: []
          },
          {
            title:'完成',
            data:[]
          },
            title: "完成",
            data: []
          }
        ]
      },
      pageData:{},
      loading:false,
      timers:null,
      type:'周',
      time:{
        week:'',
        month:'',
        year:'',
      pageData: {},
      loading: false,
      timers: null,
      type: "周",
      time: {
        week: "",
        month: "",
        year: ""
      },
      startTime:'',
      endTime:''
    }
      startTime: "",
      endTime: ""
    };
  },
  watch:{
    type(val){
      switch(val){
        case '周':
          this.time.week = new Date()
          this.changeTime(val,this.time.week)
  watch: {
    type(val) {
      switch (val) {
        case "周":
          this.time.week = new Date();
          this.changeTime(val, this.time.week);
          break;
        case '月':
          this.time.month = new Date()
          this.changeTime(val,this.time.month)
        case "月":
          this.time.month = new Date();
          this.changeTime(val, this.time.month);
          break;
        case '年':
          this.time.year = new Date()
          this.changeTime(val,this.time.year)
        case "年":
          this.time.year = new Date();
          this.changeTime(val, this.time.year);
          break;
      }
    }
  },
  mounted(){
    this.changeTime(this.type)
  mounted() {
    this.changeTime(this.type);
    // this.timers&&clearInterval(this.timers);
    // setInterval(this.changeTime(this.type),1000*60*5)
  },
  methods:{
    init(){
      this.chartConfig0.isLoading = false
      this.chartConfig1.isLoading = false
  methods: {
    init() {
      this.chartConfig0.isLoading = false;
      this.chartConfig1.isLoading = false;
      this.loading = true;
      this.$axios.get(this.$api.report.businessStatisticsByDay+'?startTime='+this.startTime+'&endTime='+this.endTime+'&type='+this.type).then(res => {
        if (res.code == 201) return
        this.pageData = this.HaveJson(res.data)
        console.log(3333,res.data)
        let xData = res.data.DAYS.map(m=>{
          let arr = m.split('-')
          if(this.type=='年'){
            return `${arr[1]}月`
          }else{
            return `${arr[1]}-${arr[2]}`
          }
        })
        this.chartData0.xData = xData
        this.chartData1.xData = xData
        this.chartData0.yData[0].data = this.pageData.RECETENDAYS
        this.chartData1.yData[0].data = this.pageData.RECETENDAYS
        this.chartData1.yData[1].data = this.pageData.FINISHTENDAYS
        this.loading = false;
        this.chartConfig0.isLoading = true
        this.chartConfig1.isLoading = true
      })
      this.$axios
        .get(
          this.$api.report.businessStatisticsByDay +
            "?startTime=" +
            this.startTime +
            "&endTime=" +
            this.endTime +
            "&type=" +
            this.type
        )
        .then(res => {
          if (res.code == 201) return;
          this.pageData = this.HaveJson(res.data);
          let xData = res.data.DAYS.map(m => {
            let arr = m.split("-");
            if (this.type == "年") {
              return `${arr[1]}月`;
            } else {
              return `${arr[1]}-${arr[2]}`;
            }
          });
          this.chartData0.xData = xData;
          this.chartData1.xData = xData;
          this.chartData0.yData[0].data = this.pageData.RECETENDAYS;
          this.chartData1.yData[0].data = this.pageData.RECETENDAYS;
          this.chartData1.yData[1].data = this.pageData.FINISHTENDAYS;
          this.loading = false;
          this.chartConfig0.isLoading = true;
          this.chartConfig1.isLoading = true;
        });
    },
    handleData(val){
      if(val){
        let num = Math.abs(val)*100
    handleData(val) {
      if (val) {
        let num = Math.abs(val) * 100;
        return num.toFixed(0);
      }else{
        return '0'
      } else {
        return "0";
      }
    },
    changeTime(type,m){
      if(m){
        switch(type){
          case '周':
            this.startTime  = getYearAndMonthAndDays(new Date(this.time.week.getTime() - 24 * 60 * 60 * 1000))
            this.endTime = getYearAndMonthAndDays(new Date(this.time.week.getTime() + 24 * 60 * 60 * 1000 * 5))
    changeTime(type, m) {
      if (m) {
        switch (type) {
          case "周":
            this.startTime = getYearAndMonthAndDays(
              new Date(this.time.week.getTime() - 24 * 60 * 60 * 1000)
            );
            this.endTime = getYearAndMonthAndDays(
              new Date(this.time.week.getTime() + 24 * 60 * 60 * 1000 * 5)
            );
            break;
          case '月':
          case "月":
            const year = new Date(this.time.month).getFullYear();
            const month = new Date(this.time.month).getMonth();
            const day = new Date(year, month + 1, 0).getDate(); //
            const month = new Date(this.time.month).getMonth() + 1;
            const day = new Date(year, month, 0).getDate(); //
            // 设置起始日期和结束日期
            this.startTime = `${year}-${month + 1}-01`
            this.endTime = `${year}-${month + 1}-${day}` // 月末
            this.startTime = `${year}-${month > 9 ? "0" + month : month}-01`;
            this.endTime = `${year}-${month > 9 ? "0" + month : month}-${day}`; // 月末
            break;
          case '年':
          case "年":
            const year0 = new Date(this.time.year).getFullYear();
            this.startTime = `${year0}-01-01`; // 年初
            this.endTime = `${year0}-12-31`; // 年末
            break;
        }
      }else{
        this.startTime = getYearAndMonthAndDays(new Date((new Date).getTime() - 24 * 60 * 60 * 1000))
        this.endTime = getYearAndMonthAndDays(new Date((new Date).getTime() + 24 * 60 * 60 * 1000 * 5))
        this.time.week = new Date()
      } else {
        this.startTime = getYearAndMonthAndDays(
          new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
        );
        this.endTime = getYearAndMonthAndDays(
          new Date(new Date().getTime() + 24 * 60 * 60 * 1000 * 5)
        );
        this.time.week = new Date();
      }
      this.init()
      this.init();
    },
    handlePrice(val){
      if(val>999999){
        return (val/1000000).toFixed(2)+'百万';
      }else if(val>9999){
        return (val/10000).toFixed(2)+'万';
      }else{
    handlePrice(val) {
      if (val > 999999) {
        return (val / 1000000).toFixed(2) + "百万";
      } else if (val > 9999) {
        return (val / 10000).toFixed(2) + "万";
      } else {
        return val;
      }
    }
  },
  deactivated(){
    this.timers&&clearInterval(this.timers);
  deactivated() {
    this.timers && clearInterval(this.timers);
  }
}
};
</script>
<style scoped>
.daily-main{
.daily-main {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
.daily-content{
.daily-content {
  padding: 20px 0;
  box-sizing: border-box;
}
.daily-card{
.daily-card {
  width: 100%;
  background: #FFFFFF;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 6px 6px 54px 0px rgba(0,0,0,0.05);
  box-shadow: 6px 6px 54px 0px rgba(0, 0, 0, 0.05);
  padding: 16px;
  box-sizing: border-box;
}
.daily-head{
.daily-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.daily-head-left h4{
.daily-head-left h4 {
  color: #202224;
  font-size: 16px;
  font-weight: 400;
@@ -330,34 +488,35 @@
  opacity: 0.8;
}
.daily-head-left>span{
  font-family: Nunito Sans-Bold;color: #202224;
.daily-head-left > span {
  font-family: Nunito Sans-Bold;
  color: #202224;
  font-weight: bold;
  font-size: 24px;
  display: inline-block;
  margin-bottom: 12px;
}
.daily-head-left-info{
.daily-head-left-info {
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #202224;
}
.num{
  color: #00B69B;
.num {
  color: #00b69b;
}
.num.active{
  color: #F93C65;
.num.active {
  color: #f93c65;
}
.chart-box{
.chart-box {
  padding: 16px 24px;
  box-sizing: border-box;
}
.chart-box h4{
.chart-box h4 {
  color: #202224;
  font-family: PingFang SC-Regular;
  font-weight: 400;
@@ -365,7 +524,7 @@
  margin-bottom: 16px;
}
.chart{
.chart {
  width: 100%;
  height: 450px;
}
src/components/view/b4-inspection-item-statistics.vue
@@ -3,7 +3,7 @@
    <div class="inspection-content" style="height:100%">
      <div class="time" style="margin-bottom: 10px;">
        <el-radio-group v-model="type" size="small">
          <el-radio-button label="周" ></el-radio-button>
          <el-radio-button label="周"></el-radio-button>
          <el-radio-button label="月"></el-radio-button>
          <el-radio-button label="年"></el-radio-button>
        </el-radio-group>
@@ -11,401 +11,558 @@
          v-model="time.week"
          type="week"
          format="yyyy 第 WW 周"
          placeholder="选择周" size="small" v-if="type=='周'" @change="m=>changeTime(type,m)">
          placeholder="选择周"
          size="small"
          v-if="type == '周'"
          @change="m => changeTime(type, m)"
        >
        </el-date-picker>
        <el-date-picker
          v-model="time.month"
          type="month"
          placeholder="选择月" size="small" v-if="type=='月'" @change="m=>changeTime(type,m)">
          placeholder="选择月"
          size="small"
          v-if="type == '月'"
          @change="m => changeTime(type, m)"
        >
        </el-date-picker>
        <el-date-picker
          v-model="time.year"
          type="year"
          placeholder="选择年" size="small" v-if="type=='年'" @change="m=>changeTime(type,m)">
          placeholder="选择年"
          size="small"
          v-if="type == '年'"
          @change="m => changeTime(type, m)"
        >
        </el-date-picker>
      </div>
      <el-row :gutter="20">
        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="inspection-card">
            <div class="inspection-head">
              <div class="inspection-head-left">
                <h4>本{{type}}项目接收</h4>
                <span >{{ pageData.RECEVICE }}</span>
                <h4>本{{ type }}项目接收</h4>
                <span>{{ pageData.RECEVICE }}</span>
              </div>
              <img src="../../../static/img/daliy-0.svg" alt="" srcset="">
              <img src="../../../static/img/daliy-0.svg" alt="" srcset="" />
            </div>
            <div class="inspection-head-left-info">
              <img :src="`../../../static/img/daliy-${pageData.RECEIVE_RATIO<0?'down':'up'}.svg`" alt="">
              <span :class="{active:pageData.RECEIVE_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.RECEIVE_RATIO)}%&nbsp; `"></span>
              <span style="font-size: 12px;">较上{{type}}</span>
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.RECEIVE_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.RECEIVE_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.RECEIVE_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="inspection-card">
            <div class="inspection-head">
              <div class="inspection-head-left">
                <h4>本{{type}}项目完成</h4>
                <span >{{ pageData.FINISHE }}</span>
                <h4>本{{ type }}项目完成</h4>
                <span>{{ pageData.FINISHE }}</span>
              </div>
              <img src="../../../static/img/daliy-1.svg" alt="" srcset="">
              <img src="../../../static/img/daliy-1.svg" alt="" srcset="" />
            </div>
            <div class="inspection-head-left-info">
              <img :src="`../../../static/img/daliy-${pageData.FINISHE_RATIO<0?'down':'up'}.svg`" alt="">
              <span :class="{active:pageData.FINISHE_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.FINISHE_RATIO)}%&nbsp; `"></span>
              <span style="font-size: 12px;">较上{{type}}</span>
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.FINISHE_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.FINISHE_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.FINISHE_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div class="inspection-card">
            <div class="inspection-head">
              <div class="inspection-head-left">
                <h4>本{{type}}项目剩余</h4>
                <span >{{ pageData.SURPLUS }}</span>
                <h4>本{{ type }}项目剩余</h4>
                <span>{{ pageData.SURPLUS }}</span>
              </div>
              <img src="../../../static/img/daliy-2.svg" alt="" srcset="">
              <img src="../../../static/img/daliy-2.svg" alt="" srcset="" />
            </div>
            <div class="inspection-head-left-info">
              <img :src="`../../../static/img/daliy-${pageData.SURPLUS_RATIO<0?'down':'up'}.svg`" alt="">
              <span :class="{active:pageData.SURPLUS_RATIO<0}" class="num" v-html="`&nbsp; ${handleData(pageData.SURPLUS_RATIO)}%&nbsp; `"></span>
              <span style="font-size: 12px;">较上{{type}}</span>
              <img
                :src="
                  `../../../static/img/daliy-${
                    pageData.SURPLUS_RATIO < 0 ? 'down' : 'up'
                  }.svg`
                "
                alt=""
              />
              <span
                :class="{ active: pageData.SURPLUS_RATIO < 0 }"
                class="num"
                v-html="`&nbsp; ${handleData(pageData.SURPLUS_RATIO)}%&nbsp; `"
              ></span>
              <span style="font-size: 12px;">较上{{ type }}</span>
            </div>
          </div>
        </el-col>
        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
          <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;">
            <h4 style="margin-bottom: 5px;">本{{type}}项目合格率</h4>
            <echart-module :id="'inspection-qualified'" :config="chartConfig2" :datas="chartData2" style="align-self: center;"></echart-module>
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div
            class="inspection-card inspection-head"
            style="flex-direction: column;padding-bottom: 5px;"
          >
            <h4 style="margin-bottom: 5px;">本{{ type }}项目合格率</h4>
            <echart-module
              :id="'inspection-qualified'"
              :config="chartConfig2"
              :datas="chartData2"
              style="align-self: center;"
            ></echart-module>
          </div>
        </el-col>
        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
          <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;">
            <h4 style="margin-bottom: 5px;">本{{type}}项目完成率</h4>
            <echart-module :id="'inspection-complete'" :config="chartConfig3" :datas="chartData3" style="align-self: center;"></echart-module>
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div
            class="inspection-card inspection-head"
            style="flex-direction: column;padding-bottom: 5px;"
          >
            <h4 style="margin-bottom: 5px;">本{{ type }}项目完成率</h4>
            <echart-module
              :id="'inspection-complete'"
              :config="chartConfig3"
              :datas="chartData3"
              style="align-self: center;"
            ></echart-module>
          </div>
        </el-col>
        <el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="4" style="margin-bottom: 16px;">
          <div class="inspection-card inspection-head" style="flex-direction: column;padding-bottom: 5px;">
            <h4 style="margin-bottom: 5px;">本{{type}}项目延期率</h4>
            <echart-module :id="'inspection-extension'" :config="chartConfig4" :datas="chartData4" style="align-self: center;"></echart-module>
        <el-col
          :xs="12"
          :sm="8"
          :md="6"
          :lg="4"
          :xl="4"
          style="margin-bottom: 16px;"
        >
          <div
            class="inspection-card inspection-head"
            style="flex-direction: column;padding-bottom: 5px;"
          >
            <h4 style="margin-bottom: 5px;">本{{ type }}项目延期率</h4>
            <echart-module
              :id="'inspection-extension'"
              :config="chartConfig4"
              :datas="chartData4"
              style="align-self: center;"
            ></echart-module>
          </div>
        </el-col>
      </el-row>
      <el-row :gutter="20" style="height: calc(100% - 200px);">
        <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px; height: 100%;">
        <el-col
          :xs="24"
          :sm="24"
          :md="12"
          :lg="12"
          :xl="12"
          style="margin-bottom: 16px; height: 100%;"
        >
          <div class="inspection-card chart-box" style="height: 100%;">
            <h4>本{{type}}项目接收量</h4>
            <echart-module :id="'inspection-left'" :config="chartConfig0" :datas="chartData0" style="height: calc(100% - 32px);"></echart-module>
            <h4>本{{ type }}项目接收量</h4>
            <echart-module
              :id="'inspection-left'"
              :config="chartConfig0"
              :datas="chartData0"
              style="height: calc(100% - 32px);"
            ></echart-module>
          </div>
        </el-col>
        <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" style="margin-bottom: 16px;height: 100%;">
        <el-col
          :xs="24"
          :sm="24"
          :md="12"
          :lg="12"
          :xl="12"
          style="margin-bottom: 16px;height: 100%;"
        >
          <div class="inspection-card chart-box" style="height: 100%;">
            <h4>本{{type}}实际完成项目与接收项目对比</h4>
            <echart-module :id="'inspection-right'" :config="chartConfig1" :datas="chartData1" style="height: calc(100% - 32px);"></echart-module>
            <h4>本{{ type }}实际完成项目与接收项目对比</h4>
            <echart-module
              :id="'inspection-right'"
              :config="chartConfig1"
              :datas="chartData1"
              style="height: calc(100% - 32px);"
            ></echart-module>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
  </template>
</template>
  <script>
  import EchartModule from '../tool/echart.vue'
  import {
        getYearAndMonthAndDays
    } from '../../util/date'
  export default {
    components: {EchartModule},
    data(){
      return{
        chartConfig0:{
          height: '',
          isLoading:true,
          type:'line'
        },
        chartData0:{
          xData:[],
          yData:[
            {
              title:'项目接收量',
              data:[]
            }
          ]
        },
        chartConfig1:{
          height: '',
          isLoading:true,
          type:'bar'
        },
        chartData1:{
          xData:[],
          yData:[
            {
              title:'接收',
              data:[]
            },
            {
              title:'完成',
              data:[]
            },
          ]
        },
        chartConfig2:{
          height: '103px',
          width:'140px',
          isLoading:true,
          type:'pie'
        },
        chartData2:{
          title:'项目合格率',
          percentage:'0',
          color:['#1CCAB8','#E1E4E8'],
          data:[
            {
              name:'合格',
              value:'0'
            },
            {
              name:'不合格',
              value:'0'
            },
          ]
        },
        chartConfig3:{
          height: '103px',
          width:'140px',
          isLoading:true,
          type:'pie'
        },
        chartData3:{
          title:'项目完成率',
          percentage:'0',
          color:['#FBB647','#E1E4E8'],
          data:[
            {
              name:'完成',
              value:'0'
            },
            {
              name:'未完成',
              value:'0'
            },
          ]
        },
        chartConfig4:{
          height: '103px',
          width:'140px',
          isLoading:true,
          type:'pie'
        },
        chartData4:{
          title:'项延期率',
          percentage:'0',
          color:['#FF3838','#E1E4E8'],
          data:[
            {
              name:'延期',
              value:'0'
            },
            {
              name:'未延期',
              value:'0'
            },
          ]
        },
        loading:false,
        pageData:{},
        timers:null,
        type:'周',
        time:{
          week:'',
          month:'',
          year:'',
        },
        startTime:'',
        endTime:''
      }
    },
    watch:{
    type(val){
      switch(val){
        case '周':
          this.time.week = new Date()
          this.changeTime(val,this.time.week)
<script>
import EchartModule from "../tool/echart.vue";
import { getYearAndMonthAndDays } from "../../util/date";
export default {
  components: { EchartModule },
  data() {
    return {
      chartConfig0: {
        height: "",
        isLoading: true,
        type: "line"
      },
      chartData0: {
        xData: [],
        yData: [
          {
            title: "项目接收量",
            data: []
          }
        ]
      },
      chartConfig1: {
        height: "",
        isLoading: true,
        type: "bar"
      },
      chartData1: {
        xData: [],
        yData: [
          {
            title: "接收",
            data: []
          },
          {
            title: "完成",
            data: []
          }
        ]
      },
      chartConfig2: {
        height: "103px",
        width: "140px",
        isLoading: true,
        type: "pie"
      },
      chartData2: {
        title: "项目合格率",
        percentage: "0",
        color: ["#1CCAB8", "#E1E4E8"],
        data: [
          {
            name: "合格",
            value: "0"
          },
          {
            name: "不合格",
            value: "0"
          }
        ]
      },
      chartConfig3: {
        height: "103px",
        width: "140px",
        isLoading: true,
        type: "pie"
      },
      chartData3: {
        title: "项目完成率",
        percentage: "0",
        color: ["#FBB647", "#E1E4E8"],
        data: [
          {
            name: "完成",
            value: "0"
          },
          {
            name: "未完成",
            value: "0"
          }
        ]
      },
      chartConfig4: {
        height: "103px",
        width: "140px",
        isLoading: true,
        type: "pie"
      },
      chartData4: {
        title: "项延期率",
        percentage: "0",
        color: ["#FF3838", "#E1E4E8"],
        data: [
          {
            name: "延期",
            value: "0"
          },
          {
            name: "未延期",
            value: "0"
          }
        ]
      },
      loading: false,
      pageData: {},
      timers: null,
      type: "周",
      time: {
        week: "",
        month: "",
        year: ""
      },
      startTime: "",
      endTime: ""
    };
  },
  watch: {
    type(val) {
      switch (val) {
        case "周":
          this.time.week = new Date();
          this.changeTime(val, this.time.week);
          break;
        case '月':
          this.time.month = new Date()
          this.changeTime(val,this.time.month)
        case "月":
          this.time.month = new Date();
          this.changeTime(val, this.time.month);
          break;
        case '年':
          this.time.year = new Date()
          this.changeTime(val,this.time.year)
        case "年":
          this.time.year = new Date();
          this.changeTime(val, this.time.year);
          break;
      }
    }
  },
    mounted(){
      this.changeTime(this.type)
      // this.timers&&clearInterval(this.timers);
      // setInterval(this.changeTime(this.type),1000*60*5)
    },
    methods:{
      init(){
      this.chartConfig0.isLoading = false
      this.chartConfig1.isLoading = false
      this.chartConfig2.isLoading = false
      this.chartConfig3.isLoading = false
      this.chartConfig4.isLoading = false
  mounted() {
    this.changeTime(this.type);
    // this.timers&&clearInterval(this.timers);
    // setInterval(this.changeTime(this.type),1000*60*5)
  },
  methods: {
    init() {
      this.chartConfig0.isLoading = false;
      this.chartConfig1.isLoading = false;
      this.chartConfig2.isLoading = false;
      this.chartConfig3.isLoading = false;
      this.chartConfig4.isLoading = false;
      this.loading = true;
      this.$axios.get(this.$api.report.testProductByDay+'?startTime='+this.startTime+'&endTime='+this.endTime+'&type='+this.type).then(res => {
        if (res.code == 201) return
        this.pageData = this.HaveJson(res.data)
        let xData = res.data.DAYS.map(m=>{
          let arr = m.split('-')
          if(this.type=='年'){
            return `${arr[1]}月`
          }else{
            return `${arr[1]}-${arr[2]}`
          }
        })
        this.chartData0.xData = xData
        this.chartData1.xData = xData
        this.chartData0.yData[0].data = this.pageData.RECETENDAYS
        this.chartData1.yData[0].data = this.pageData.RECETENDAYS
        this.chartData1.yData[1].data = this.pageData.FINISHTENDAYS
        this.chartData2.percentage = (this.pageData.ACCEPT_RATE_TODAY*100).toFixed(0)+'%'
        this.chartData3.percentage = (this.pageData.FINISH_RATE_TODAY*100).toFixed(0)+'%'
        this.chartData4.percentage = (this.pageData.DELAY_RATE_TODAY*100).toFixed(0)+'%'
        this.chartData2.data[0].value = this.pageData.ACCEPT
        this.chartData2.data[1].value = this.pageData.FINISHE - this.pageData.ACCEPT
        this.loading = false;
        this.chartData3.data[0].value = this.pageData.FINISHE
        this.chartData3.data[1].value = this.pageData.RECEVICE - this.pageData.FINISHE
        this.chartData4.data[0].value = this.pageData.SURPLUS
        this.chartData4.data[1].value = this.pageData.RECEVICE - this.pageData.SURPLUS
        this.chartConfig0.isLoading = true
        this.chartConfig1.isLoading = true
        this.chartConfig2.isLoading = true
        this.chartConfig3.isLoading = true
        this.chartConfig4.isLoading = true
      })
      },
      handleData(val){
        if(val){
          let num = Math.abs(val)*100
          return num.toFixed(0);
        }else{
          return '0'
        }
      },
      changeTime(type,m){
        if(m){
          switch(type){
            case '周':
              this.startTime  = getYearAndMonthAndDays(new Date(this.time.week.getTime() - 24 * 60 * 60 * 1000))
              this.endTime = getYearAndMonthAndDays(new Date(this.time.week.getTime() + 24 * 60 * 60 * 1000 * 5))
              break;
            case '月':
              const year = new Date(this.time.month).getFullYear();
              const month = new Date(this.time.month).getMonth();
              const day = new Date(year, month + 1, 0).getDate(); //
              // 设置起始日期和结束日期
              this.startTime = `${year}-${month + 1}-01`
              this.endTime = `${year}-${month + 1}-${day}` // 月末
              break;
            case '年':
              const year0 = new Date(this.time.year).getFullYear();
              this.startTime = `${year0}-01-01`; // 年初
              this.endTime = `${year0}-12-31`; // 年末
              break;
          }
        }else{
          this.startTime = getYearAndMonthAndDays(new Date((new Date).getTime() - 24 * 60 * 60 * 1000))
          this.endTime = getYearAndMonthAndDays(new Date((new Date).getTime() + 24 * 60 * 60 * 1000 * 5))
          this.time.week = new Date()
        }
        this.init()
      this.$axios
        .get(
          this.$api.report.testProductByDay +
            "?startTime=" +
            this.startTime +
            "&endTime=" +
            this.endTime +
            "&type=" +
            this.type
        )
        .then(res => {
          if (res.code == 201) return;
          this.pageData = this.HaveJson(res.data);
          let xData = res.data.DAYS.map(m => {
            let arr = m.split("-");
            if (this.type == "年") {
              return `${arr[1]}月`;
            } else {
              return `${arr[1]}-${arr[2]}`;
            }
          });
          this.chartData0.xData = xData;
          this.chartData1.xData = xData;
          this.chartData0.yData[0].data = this.pageData.RECETENDAYS;
          this.chartData1.yData[0].data = this.pageData.RECETENDAYS;
          this.chartData1.yData[1].data = this.pageData.FINISHTENDAYS;
          this.chartData2.percentage =
            (this.pageData.ACCEPT_RATE_TODAY * 100).toFixed(0) + "%";
          this.chartData3.percentage =
            (this.pageData.FINISH_RATE_TODAY * 100).toFixed(0) + "%";
          this.chartData4.percentage =
            (this.pageData.DELAY_RATE_TODAY * 100).toFixed(0) + "%";
          this.chartData2.data[0].value = this.pageData.ACCEPT;
          this.chartData2.data[1].value =
            this.pageData.FINISHE - this.pageData.ACCEPT;
          this.loading = false;
          this.chartData3.data[0].value = this.pageData.FINISHE;
          this.chartData3.data[1].value =
            this.pageData.RECEVICE - this.pageData.FINISHE;
          this.chartData4.data[0].value = this.pageData.SURPLUS;
          this.chartData4.data[1].value =
            this.pageData.RECEVICE - this.pageData.SURPLUS;
          this.chartConfig0.isLoading = true;
          this.chartConfig1.isLoading = true;
          this.chartConfig2.isLoading = true;
          this.chartConfig3.isLoading = true;
          this.chartConfig4.isLoading = true;
        });
    },
    handleData(val) {
      if (val) {
        let num = Math.abs(val) * 100;
        return num.toFixed(0);
      } else {
        return "0";
      }
    },
    deactivated(){
      this.timers&&clearInterval(this.timers);
    changeTime(type, m) {
      if (m) {
        switch (type) {
          case "周":
            this.startTime = getYearAndMonthAndDays(
              new Date(this.time.week.getTime() - 24 * 60 * 60 * 1000)
            );
            this.endTime = getYearAndMonthAndDays(
              new Date(this.time.week.getTime() + 24 * 60 * 60 * 1000 * 5)
            );
            break;
          case "月":
            const year = new Date(this.time.month).getFullYear();
            const month = new Date(this.time.month).getMonth() + 1;
            const day = new Date(year, month, 0).getDate(); //
            // 设置起始日期和结束日期
            this.startTime = `${year}-${month > 9 ? "0" + month : month}-01`;
            this.endTime = `${year}-${month > 9 ? "0" + month : month}-${day}`; // 月末
            break;
          case "年":
            const year0 = new Date(this.time.year).getFullYear();
            this.startTime = `${year0}-01-01`; // 年初
            this.endTime = `${year0}-12-31`; // 年末
            break;
        }
      } else {
        this.startTime = getYearAndMonthAndDays(
          new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
        );
        this.endTime = getYearAndMonthAndDays(
          new Date(new Date().getTime() + 24 * 60 * 60 * 1000 * 5)
        );
        this.time.week = new Date();
      }
      this.init();
    }
  },
  deactivated() {
    this.timers && clearInterval(this.timers);
  }
  </script>
};
</script>
  <style scoped>
  .inspection-main{
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .inspection-content{
    padding: 20px 0;
    box-sizing: border-box;
  }
  .inspection-card{
    width: 100%;
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: 6px 6px 54px 0px rgba(0,0,0,0.05);
    padding: 16px;
<style scoped>
.inspection-main {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
.inspection-content {
  padding: 20px 0;
  box-sizing: border-box;
  }
}
.inspection-card {
  width: 100%;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 6px 6px 54px 0px rgba(0, 0, 0, 0.05);
  padding: 16px;
  box-sizing: border-box;
}
  .inspection-head{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
.inspection-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
  .inspection-head h4{
    color: #202224;
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 20px;
    opacity: 0.8;
  }
.inspection-head h4 {
  color: #202224;
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 20px;
  opacity: 0.8;
}
  .inspection-head-left>span{
    font-family: Nunito Sans-Bold;color: #202224;
    font-weight: bold;
    font-size: 24px;
    display: inline-block;
    margin-bottom: 18px;
  }
.inspection-head-left > span {
  font-family: Nunito Sans-Bold;
  color: #202224;
  font-weight: bold;
  font-size: 24px;
  display: inline-block;
  margin-bottom: 18px;
}
  .inspection-head-left-info{
    display: flex;
    align-items: center;
    font-size: 16px;
    color: #202224;
  }
.inspection-head-left-info {
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #202224;
}
  .num{
    color: #00B69B;
  }
.num {
  color: #00b69b;
}
  .num.active{
    color: #F93C65;
  }
.num.active {
  color: #f93c65;
}
  .chart-box{
    padding: 16px 24px;
    box-sizing: border-box;
  }
.chart-box {
  padding: 16px 24px;
  box-sizing: border-box;
}
  .chart-box h4{
    color: #202224;
    font-family: PingFang SC-Regular;
    font-weight: 400;
    font-size: 24px;
    margin-bottom: 16px;
  }
.chart-box h4 {
  color: #202224;
  font-family: PingFang SC-Regular;
  font-weight: 400;
  font-size: 24px;
  margin-bottom: 16px;
}
  .chart{
    width: 100%;
    height: 450px;
  }
  </style>
.chart {
  width: 100%;
  height: 450px;
}
</style>
src/components/view/b4-site-hours-statistics.vue
@@ -5,32 +5,56 @@
      <el-date-picker
        v-model="month"
        type="month"
        placeholder="选择月" style="margin-right: 20px;" @change="changeTime">
        placeholder="选择月"
        style="margin-right: 20px;"
        @change="changeTime"
      >
      </el-date-picker>
    </div>
    <el-row :gutter="20" class="card" v-loading="loading">
      <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="8" v-for="(item,index) in siteList" :key="index">
        <div class="card-item" :style="`background: url(../../../static/img/site/bg-${item.bg}.png) no-repeat;background-size:100% 100%;margin-bottom:16px`">
          <h3 :style="`color:${item.color};font-weight: 500;font-size: 28px;`" class="card-item-title">
            <img :src="`../../../static/img/site/${item.name}.png`" alt="" style="width: 30px;height: 30px;margin-right: 10px;">
      <el-col
        :xs="24"
        :sm="12"
        :md="12"
        :lg="8"
        :xl="8"
        v-for="(item, index) in siteList"
        :key="index"
      >
        <div
          class="card-item"
          :style="
            `background: url(../../../static/img/site/bg-${item.bg}.png) no-repeat;background-size:100% 100%;margin-bottom:16px`
          "
        >
          <h3
            :style="`color:${item.color};font-weight: 500;font-size: 28px;`"
            class="card-item-title"
          >
            <img
              :src="`../../../static/img/site/${item.name}.png`"
              alt=""
              style="width: 30px;height: 30px;margin-right: 10px;"
            />
            <span>{{ item.name }}站点</span>
          </h3>
          <el-table
            :data="item.tableData"
            style="width: 100%;margin-bottom: 14px;" height="410px" size="mini"border v-loading="item.loading">
            <el-table-column
              type="index"
              label="序号"
              width="60">
            style="width: 100%;margin-bottom: 14px;"
            height="410px"
            size="mini"
            border
            v-loading="item.loading"
          >
            <el-table-column type="index" label="序号" width="60">
              <template #default="scope">
              <!-- 计算序号 -->
              {{ (item.page.current - 1) * item.page.size + scope.$index + 1 }}
            </template>
                <!-- 计算序号 -->
                {{
                  (item.page.current - 1) * item.page.size + scope.$index + 1
                }}
              </template>
            </el-table-column>
            <el-table-column
              prop="sampleName"
              label="样品名称"
              width="90">
            <el-table-column prop="sampleName" label="样品名称" width="90">
              <template #default="scope">
                <el-tooltip
                  class="item"
@@ -38,13 +62,13 @@
                  :content="scope.row.sampleName"
                  placement="top"
                >
                  <div class="single-line-ellipsis">{{ scope.row.sampleName }}</div>
                  <div class="single-line-ellipsis">
                    {{ scope.row.sampleName }}
                  </div>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              prop="sampleCode"
              label="样品编号">
            <el-table-column prop="sampleCode" label="样品编号">
              <template #default="scope">
                <el-tooltip
                  class="item"
@@ -52,17 +76,15 @@
                  :content="scope.row.sampleCode"
                  placement="top"
                >
                  <div class="single-line-ellipsis">{{ scope.row.sampleCode }}</div>
                  <div class="single-line-ellipsis">
                    {{ scope.row.sampleCode }}
                  </div>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              prop="num"
              label="次数" width="70">
            <el-table-column prop="num" label="次数" width="70">
            </el-table-column>
            <el-table-column
              prop="hours"
              label="检验时长" width="100">
            <el-table-column prop="hours" label="检验时长" width="100">
            </el-table-column>
          </el-table>
          <el-pagination
@@ -70,7 +92,11 @@
            :page-size="item.page.size"
            :current-page="item.page.current"
            layout="prev, pager, next"
            :total="item.page.total" small style="text-align: right;" @current-change="m=>changePage(m,item)">
            :total="item.page.total"
            small
            style="text-align: right;"
            @current-change="m => changePage(m, item)"
          >
          </el-pagination>
        </div>
      </el-col>
@@ -80,251 +106,255 @@
<script>
export default {
  data(){
  data() {
    return {
      month:'',
      siteList:[
      month: "",
      siteList: [
        {
          name:'电路试验',
          color:'#FABE63',
          bg:'黄色',
          tableData:[],
          page:{
          name: "电路试验",
          color: "#FABE63",
          bg: "黄色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'远场',
          color:'#6F83FF',
          bg:'紫色',
          tableData:[],
          page:{
          name: "远场",
          color: "#6F83FF",
          bg: "紫色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'近场',
          color:'#53B3F9',
          bg:'蓝色',
          tableData:[],
          page:{
          name: "近场",
          color: "#53B3F9",
          bg: "蓝色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'振动',
          color:'#6F83FF',
          bg:'紫色',
          tableData:[],
          page:{
          name: "振动",
          color: "#6F83FF",
          bg: "紫色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'淋雨',
          color:'#53B3F9',
          bg:'蓝色',
          tableData:[],
          page:{
          name: "淋雨",
          color: "#53B3F9",
          bg: "蓝色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'高低温',
          color:'#80CD62',
          bg:'绿色',
          tableData:[],
          page:{
          name: "高低温",
          color: "#80CD62",
          bg: "绿色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'盐雾',
          color:'#6F83FF',
          bg:'紫色',
          tableData:[],
          page:{
          name: "盐雾",
          color: "#6F83FF",
          bg: "紫色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'风载',
          color:'#53B3F9',
          bg:'蓝色',
          tableData:[],
          page:{
          name: "风载",
          color: "#53B3F9",
          bg: "蓝色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'跌落',
          color:'#FABE63',
          bg:'黄色',
          tableData:[],
          page:{
          name: "跌落",
          color: "#FABE63",
          bg: "黄色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'老化',
          color:'#80CD62',
          bg:'绿色',
          tableData:[],
          page:{
          name: "老化",
          color: "#80CD62",
          bg: "绿色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'静压',
          color:'#53B3F9',
          bg:'蓝色',
          tableData:[],
          page:{
          name: "静压",
          color: "#53B3F9",
          bg: "蓝色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'冲击',
          color:'#6F83FF',
          bg:'紫色',
          tableData:[],
          page:{
          name: "冲击",
          color: "#6F83FF",
          bg: "紫色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
          loading: false
        },
        {
          name:'功率容量',
          color:'#80CD62',
          bg:'绿色',
          tableData:[],
          page:{
          name: "功率容量",
          color: "#80CD62",
          bg: "绿色",
          tableData: [],
          page: {
            current: 1,
            size: 9,
            total:0
            total: 0
          },
          loading:false,
        },
          loading: false
        }
      ],
      startTime:null,
      endTime:null,
      loading:false,
    }
      startTime: null,
      endTime: null,
      loading: false
    };
  },
  mounted(){
    this.month = new Date()
    this.changeTime()
  mounted() {
    this.month = new Date();
    this.changeTime();
  },
  methods:{
    init(){
      this.loading = true
      this.$axios.post(this.$api.report.timeByStation, {
        startTime:this.startTime,
        endTime:this.endTime,
        current: 1,
        size: 9
      }).then(res => {
        this.loading = false
        if (res.code === 201) {
          return
        }
        for(let m in res.data){
          this.siteList.forEach(item=>{
            if(item.name==m){
              item.page.total = res.data[m].total
              item.tableData = res.data[m].records
            }
          })
        }
      })
  methods: {
    init() {
      this.loading = true;
      this.$axios
        .post(this.$api.report.timeByStation, {
          startTime: this.startTime,
          endTime: this.endTime,
          current: 1,
          size: 9
        })
        .then(res => {
          this.loading = false;
          if (res.code === 201) {
            return;
          }
          for (let m in res.data) {
            this.siteList.forEach(item => {
              if (item.name == m) {
                item.page.total = res.data[m].total;
                item.tableData = res.data[m].records;
              }
            });
          }
        });
    },
    changePage(current,row){
      row.page.current = current
      row.loading = true
      this.$axios.post(this.$api.report.timeByStation, {
        startTime:this.startTime,
        endTime:this.endTime,
        current: current,
        size: row.page.size,
        sonLaboratory:row.name
      }).then(res => {
        row.loading = false
        if (res.code === 201) {
          return
        }
        row.tableData = res.data[row.name].records
        row.page.total = res.data[row.name].total
      })
    changePage(current, row) {
      row.page.current = current;
      row.loading = true;
      this.$axios
        .post(this.$api.report.timeByStation, {
          startTime: this.startTime,
          endTime: this.endTime,
          current: current,
          size: row.page.size,
          sonLaboratory: row.name
        })
        .then(res => {
          row.loading = false;
          if (res.code === 201) {
            return;
          }
          row.tableData = res.data[row.name].records;
          row.page.total = res.data[row.name].total;
        });
    },
    changeTime(){
    changeTime() {
      const year = new Date(this.month).getFullYear();
      const month = new Date(this.month).getMonth()+1;
      const month = new Date(this.month).getMonth() + 1;
      const day = new Date(year, month + 1, 0).getDate(); //
      // 设置起始日期和结束日期
      this.startTime = `${year}-${month>9?'0'+month:month}-01`
      this.endTime = `${year}-${month>9?'0'+month:month}-${day}` // 月末
      this.siteList.forEach(item=>{
        item.page.current = 1
      })
      this.init()
      this.startTime = `${year}-${month > 9 ? "0" + month : month}-01`;
      this.endTime = `${year}-${month > 9 ? "0" + month : month}-${day}`; // 月末
      this.siteList.forEach(item => {
        item.page.current = 1;
      });
      this.init();
    }
  }
}
};
</script>
<style scoped>
.title{
.title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}
.card{
.card {
  height: calc(100vh - 156px);
  overflow-y: auto;
}
.card-item{
.card-item {
  height: 540px;
  box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.05);
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.05);
  padding: 20px 10px 10px 20px;
  box-sizing: border-box;
}
.card-item-title{
.card-item-title {
  display: flex;
  align-items: center;
  margin-bottom: 20px;