|  | @@ -10,8 +10,8 @@
 | 
	
		
			
				|  |  |                  <el-option v-for="item in accuracy.cattleTpyeList" :key="item.value" :label="item.label"
 | 
	
		
			
				|  |  |                    :value="item.value"> </el-option>
 | 
	
		
			
				|  |  |                </el-select>
 | 
	
		
			
				|  |  | -              <el-select v-model="accuracy.value2" clearable style="width:100px;margin-right: 5px;" class="filter-item" @change="changeformula('1')">
 | 
	
		
			
				|  |  | -                <el-option v-for="item in accuracy.formulaList" :key="item.id" :label="item.name" :value="item.id">
 | 
	
		
			
				|  |  | +              <el-select v-model="accuracy.value2" style="width:100px;margin-right: 5px;" class="filter-item" @change="changeformula('1')">
 | 
	
		
			
				|  |  | +                <el-option v-for="item in accuracy.formulaList" :key="item.value" :label="item.label" :value="item.value">
 | 
	
		
			
				|  |  |                  </el-option>
 | 
	
		
			
				|  |  |                </el-select>
 | 
	
		
			
				|  |  |                <el-date-picker v-model="accuracy.inputDatetime" :clearable="false" class="inputDatetime filter-item"
 | 
	
	
		
			
				|  | @@ -82,13 +82,13 @@
 | 
	
		
			
				|  |  |                  <el-option v-for="item in time.cattleTpyeList" :key="item.value" :label="item.label"
 | 
	
		
			
				|  |  |                    :value="item.value"> </el-option>
 | 
	
		
			
				|  |  |                </el-select>
 | 
	
		
			
				|  |  | -              <el-select v-model="time.value2" clearable style="width:100px;margin-right: 5px;" class="filter-item" @change="changeformula('2')">
 | 
	
		
			
				|  |  | -                <el-option v-for="item in time.formulaList" :key="item.id" :label="item.name" :value="item.id">
 | 
	
		
			
				|  |  | +              <el-select v-model="time.value2" style="width:100px;margin-right: 5px;" class="filter-item" @change="changeformula('2')">
 | 
	
		
			
				|  |  | +                <el-option v-for="item in time.formulaList" :key="item.value" :label="item.label" :value="item.value">
 | 
	
		
			
				|  |  |                  </el-option>
 | 
	
		
			
				|  |  |                </el-select>
 | 
	
		
			
				|  |  |                <el-date-picker v-model="time.inputDatetime" :clearable="false" class="inputDatetime filter-item"
 | 
	
		
			
				|  |  |                  type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
 | 
	
		
			
				|  |  | -                style="width: 250px;" @change="changeDate('2')"/>
 | 
	
		
			
				|  |  | +                style="width: 250px;" :picker-options="pickerOptions" @change="changeDate('2')"/>
 | 
	
		
			
				|  |  |              </div>
 | 
	
		
			
				|  |  |              <div class="time_t_r">
 | 
	
		
			
				|  |  |                <div class="exportTable button" @click="handleChart('time')">切换图表</div>
 | 
	
	
		
			
				|  | @@ -148,8 +148,8 @@
 | 
	
		
			
				|  |  |                    <span class="el-icon-question"></span>
 | 
	
		
			
				|  |  |                  </el-tooltip>
 | 
	
		
			
				|  |  |                </h4>
 | 
	
		
			
				|  |  | -              <el-select v-model="abnormal.value2" clearable style="width:100px;margin-right: 5px;" class="filter-item" @change="changeformula('3')">
 | 
	
		
			
				|  |  | -                <el-option v-for="item in abnormal.formulaList" :key="item.id" :label="item.name" :value="item.id">
 | 
	
		
			
				|  |  | +              <el-select v-model="abnormal.value2" style="width:100px;margin-right: 5px;" class="filter-item" @change="changeformula('3')">
 | 
	
		
			
				|  |  | +                <el-option v-for="item in abnormal.formulaList" :key="item.value" :label="item.label" :value="item.value">
 | 
	
		
			
				|  |  |                  </el-option>
 | 
	
		
			
				|  |  |                </el-select>
 | 
	
		
			
				|  |  |                <el-date-picker v-model="abnormal.inputDatetime" :clearable="false" class="inputDatetime filter-item"
 | 
	
	
		
			
				|  | @@ -275,7 +275,7 @@
 | 
	
		
			
				|  |  |            value2: '',
 | 
	
		
			
				|  |  |            inputDatetime: [new Date(), new Date()],
 | 
	
		
			
				|  |  |            cattleTpyeList: JSON.parse(sessionStorage.downlist).cattle_parent_category,
 | 
	
		
			
				|  |  | -          formulaList: [],
 | 
	
		
			
				|  |  | +          formulaList: JSON.parse(sessionStorage.downlist).formula_list,
 | 
	
		
			
				|  |  |            activeName: 'first',
 | 
	
		
			
				|  |  |            chart1: {
 | 
	
		
			
				|  |  |              isChart: true,
 | 
	
	
		
			
				|  | @@ -306,7 +306,7 @@
 | 
	
		
			
				|  |  |            value2: '',
 | 
	
		
			
				|  |  |            inputDatetime: [new Date(), new Date()],
 | 
	
		
			
				|  |  |            cattleTpyeList: JSON.parse(sessionStorage.downlist).cattle_parent_category,
 | 
	
		
			
				|  |  | -          formulaList: [],
 | 
	
		
			
				|  |  | +          formulaList: JSON.parse(sessionStorage.downlist).formula_list,
 | 
	
		
			
				|  |  |            chart1: {
 | 
	
		
			
				|  |  |              isChart: true,
 | 
	
		
			
				|  |  |              listLoading: false,
 | 
	
	
		
			
				|  | @@ -320,7 +320,7 @@
 | 
	
		
			
				|  |  |            value2: '',
 | 
	
		
			
				|  |  |            inputDatetime: [new Date(), new Date()],
 | 
	
		
			
				|  |  |            cattleTpyeList: JSON.parse(sessionStorage.downlist).cattle_parent_category,
 | 
	
		
			
				|  |  | -          formulaList: [],
 | 
	
		
			
				|  |  | +          formulaList: JSON.parse(sessionStorage.downlist).formula_list,
 | 
	
		
			
				|  |  |            chart1: {
 | 
	
		
			
				|  |  |              isChart: true,
 | 
	
		
			
				|  |  |              listLoading: false,
 | 
	
	
		
			
				|  | @@ -348,17 +348,29 @@
 | 
	
		
			
				|  |  |        // accuracy.inputDatetime
 | 
	
		
			
				|  |  |        this.getTimeFn()
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    mounted() {
 | 
	
		
			
				|  |  | +    mounted() {
 | 
	
		
			
				|  |  | +      this.accuracy.value1 = this.accuracy.cattleTpyeList[0].value
 | 
	
		
			
				|  |  | +      this.time.value1 = this.time.cattleTpyeList[0].value
 | 
	
		
			
				|  |  | +      this.abnormal.value1 = this.abnormal.cattleTpyeList[0].value
 | 
	
		
			
				|  |  | +      this.accuracy.value2 = this.accuracy.formulaList[0].value
 | 
	
		
			
				|  |  | +      this.time.value2 = this.time.formulaList[0].value
 | 
	
		
			
				|  |  | +      this.abnormal.value2 = this.abnormal.formulaList[0].value
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      methods: {
 | 
	
		
			
				|  |  |        getTimeFn() {
 | 
	
		
			
				|  |  |          const that = this
 | 
	
		
			
				|  |  | -        const start = new Date()
 | 
	
		
			
				|  |  | -        const end = new Date()
 | 
	
		
			
				|  |  | -        start.setTime(start.getTime() - 3600 * 1000 * 24 * 1)
 | 
	
		
			
				|  |  | -        end.setTime(end.getTime() - 3600 * 1000 * 24 * 1)
 | 
	
		
			
				|  |  | -        that.accuracy.inputDatetime = [start, end]
 | 
	
		
			
				|  |  | -        that.getFormulaList()
 | 
	
		
			
				|  |  | +        const start1 = new Date()
 | 
	
		
			
				|  |  | +        const end1 = new Date()
 | 
	
		
			
				|  |  | +        start1.setTime(start1.getTime() - 3600 * 1000 * 24 * 1)
 | 
	
		
			
				|  |  | +        end1.setTime(end1.getTime() - 3600 * 1000 * 24 * 1)
 | 
	
		
			
				|  |  | +        that.accuracy.inputDatetime = [start1, end1]
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        const start2 = new Date()
 | 
	
		
			
				|  |  | +        const end2 = new Date()
 | 
	
		
			
				|  |  | +        start2.setTime(start2.getTime() - 3600 * 1000 * 24 * 31)
 | 
	
		
			
				|  |  | +        end2.setTime(end2.getTime() - 3600 * 1000 * 24 * 1)
 | 
	
		
			
				|  |  | +        that.abnormal.inputDatetime = [start2, end2]
 | 
	
		
			
				|  |  | +        // that.getFormulaList()
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |        getFormulaList() {
 | 
	
		
			
				|  |  |          let page = 1
 | 
	
	
		
			
				|  | @@ -370,9 +382,7 @@
 | 
	
		
			
				|  |  |              this.accuracy.formulaList = response.data.list
 | 
	
		
			
				|  |  |              this.time.formulaList = response.data.list
 | 
	
		
			
				|  |  |              this.abnormal.formulaList = response.data.list
 | 
	
		
			
				|  |  | -            this.accuracy.value1 = this.accuracy.cattleTpyeList[0].value
 | 
	
		
			
				|  |  | -            this.time.value1 = this.time.cattleTpyeList[0].value
 | 
	
		
			
				|  |  | -            this.abnormal.value1 = this.abnormal.cattleTpyeList[0].value
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |            } else {
 | 
	
		
			
				|  |  |              this.accuracy.formulaList = []
 | 
	
		
			
				|  |  |              this.time.formulaList = []
 | 
	
	
		
			
				|  | @@ -588,7 +598,20 @@
 | 
	
		
			
				|  |  |          }else if(item == '2'){
 | 
	
		
			
				|  |  |            this.getChart2List()
 | 
	
		
			
				|  |  |          }else if(item == '3'){
 | 
	
		
			
				|  |  | -          this.getChart3List()
 | 
	
		
			
				|  |  | +          if (this.abnormal.inputDatetime) {
 | 
	
		
			
				|  |  | +            const startDate = this.abnormal.inputDatetime[0];
 | 
	
		
			
				|  |  | +            const endDate = this.abnormal.inputDatetime[1];
 | 
	
		
			
				|  |  | +            const days = Math.floor((endDate - startDate) / (1000 * 60 * 60 * 24)) + 1;
 | 
	
		
			
				|  |  | +            console.log('所选天数:', days);
 | 
	
		
			
				|  |  | +            if(days < 7){
 | 
	
		
			
				|  |  | +              this.$message({type: 'error',message: '最少选择7天时间', duration: 2000})
 | 
	
		
			
				|  |  | +            }else if(days > 365){
 | 
	
		
			
				|  |  | +              this.$message({type: 'error',message: '最多选择365天时间', duration: 2000})
 | 
	
		
			
				|  |  | +            }else{
 | 
	
		
			
				|  |  | +              this.getChart3List()
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |        getChart3List() {
 | 
	
	
		
			
				|  | @@ -785,7 +808,16 @@
 | 
	
		
			
				|  |  |          var option = {
 | 
	
		
			
				|  |  |            animation: false,
 | 
	
		
			
				|  |  |            tooltip: {
 | 
	
		
			
				|  |  | -            trigger: 'axis'
 | 
	
		
			
				|  |  | +            trigger: 'axis',
 | 
	
		
			
				|  |  | +            // formatter: function (data) {
 | 
	
		
			
				|  |  | +            //   console.log(data,'====')
 | 
	
		
			
				|  |  | +            //   let rate1 = parseFloat(data[0].value) / parseFloat(data[0].value)+ parseFloat(data[1].value) * 100
 | 
	
		
			
				|  |  | +            //   let rate2 = 100 - rate1
 | 
	
		
			
				|  |  | +            //   var res =
 | 
	
		
			
				|  |  | +            //   // data[0].axisValue+ <br/>+
 | 
	
		
			
				|  |  | +            //    data[0].seriesName+':'+<br/>+data[0].value + '次'+ "<span>总占比rate1%</span>"+<br/>
 | 
	
		
			
				|  |  | +            //    + data[1].seriesName+':'+<br/> +data[1].value + + '次'+ "<span>总占比rate2%</span>"
 | 
	
		
			
				|  |  | +            // }
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            legend: {
 | 
	
		
			
				|  |  |              data: ['正常撒料次数', '异常撒料次数'],
 |