Compare commits
	
		
			5 Commits
		
	
	
		
			71f548cb3b
			...
			projects/m
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					8da6dc6232 | ||
| 
						 | 
					3e2661581e | ||
| ec5e47a416 | |||
| 
						 | 
					99d60a14bd | ||
| 
						 | 
					6409d2d348 | 
@@ -1,8 +1,8 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zhp
 | 
			
		||||
 * @Date: 2024-04-15 10:49:13
 | 
			
		||||
 * @LastEditTime: 2024-07-17 08:55:15
 | 
			
		||||
 * @LastEditors: zhp
 | 
			
		||||
 * @LastEditTime: 2024-07-24 14:48:25
 | 
			
		||||
 * @LastEditors: DY
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
@@ -39,7 +39,7 @@
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item v-show="listQuery.type === 3" label="时间范围" prop="reportTime">
 | 
			
		||||
          <el-date-picker size="small" clearable v-model="listQuery.start" value-format="yyyy-MM-dd" type="year"
 | 
			
		||||
            placeholder="开始时间">
 | 
			
		||||
            placeholder="开始时间" @change="getYear">
 | 
			
		||||
          </el-date-picker>
 | 
			
		||||
          ~
 | 
			
		||||
          <el-date-picker size="small" clearable v-model="listQuery.end" value-format="yyyy-MM-dd" type="year" placeholder="结束时间"
 | 
			
		||||
@@ -265,6 +265,8 @@ export default {
 | 
			
		||||
      this.listQuery.endDate = null
 | 
			
		||||
      this.listQuery.startDate = null
 | 
			
		||||
      this.listQuery.reportTime = null
 | 
			
		||||
      this.listQuery.start = null
 | 
			
		||||
      this.listQuery.end = null
 | 
			
		||||
    },
 | 
			
		||||
    otherMethods(val) {
 | 
			
		||||
      this.detailOrUpdateVisible = true;
 | 
			
		||||
@@ -282,20 +284,14 @@ export default {
 | 
			
		||||
        this.listQuery.reportTime = []
 | 
			
		||||
        this.listQuery.start = undefined
 | 
			
		||||
        this.listQuery.end = undefined
 | 
			
		||||
        // console.log();
 | 
			
		||||
      } else {
 | 
			
		||||
        this.listQuery.startDate = this.listQuery.start
 | 
			
		||||
        this.listQuery.endDate = this.listQuery.end
 | 
			
		||||
      }
 | 
			
		||||
      if (!this.listQuery.start && !this.listQuery.end) {
 | 
			
		||||
        this.listQuery.startDate = undefined
 | 
			
		||||
        this.listQuery.endDate = undefined
 | 
			
		||||
      }
 | 
			
		||||
      // console.log(e);
 | 
			
		||||
    },
 | 
			
		||||
    onValueChange(picker, k) { // 选中近k周后触发的操作
 | 
			
		||||
      if (this.listQuery.start && this.listQuery.end) {
 | 
			
		||||
        console.log(this.listQuery.reportTime)
 | 
			
		||||
        // console.log(this.listQuery.start, this.listQuery.end - this.listQuery.start)
 | 
			
		||||
        this.date1 = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
 | 
			
		||||
        this.date2 = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
 | 
			
		||||
        const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000);
 | 
			
		||||
@@ -309,11 +305,15 @@ export default {
 | 
			
		||||
          this.listQuery.startDate = moment(this.listQuery.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
 | 
			
		||||
          this.listQuery.endDate = moment(this.listQuery.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD')
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (!this.listQuery.start && !this.listQuery.end) {
 | 
			
		||||
        console.log(this.listQuery.startDate, this.listQuery.endDate)
 | 
			
		||||
      } else {
 | 
			
		||||
        this.listQuery.startDate = undefined
 | 
			
		||||
        this.listQuery.endDate = undefined
 | 
			
		||||
      }
 | 
			
		||||
      // if (!this.listQuery.start && !this.listQuery.end) {
 | 
			
		||||
      //   this.listQuery.startDate = undefined
 | 
			
		||||
      //   this.listQuery.endDate = undefined
 | 
			
		||||
      // }
 | 
			
		||||
    },
 | 
			
		||||
    changeDayTime() {
 | 
			
		||||
      if (this.listQuery.reportTime) {
 | 
			
		||||
@@ -359,7 +359,7 @@ export default {
 | 
			
		||||
        this.$message.warning('请选择时间维度!')
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
      if (!this.listQuery.startDate) {
 | 
			
		||||
      if (!this.listQuery.startDate || !this.listQuery.endDate) {
 | 
			
		||||
        this.$message.warning('请选择时间范围!')
 | 
			
		||||
      } else {
 | 
			
		||||
        await getProduceDataPage(this.listQuery).then(res => {
 | 
			
		||||
@@ -392,8 +392,8 @@ export default {
 | 
			
		||||
      // 工厂名称 this.factoryListabbr
 | 
			
		||||
      const factoryNameArray = (this.listQuery.factory.length === 0 || this.listQuery.factory.length === this.factoryListabbr.length) ? [0, 1] : this.listQuery.factory
 | 
			
		||||
      const seriesArray = []
 | 
			
		||||
      typeArray.forEach((type, typeIndex) => {
 | 
			
		||||
        factoryNameArray.forEach((fac, facIndex) => {
 | 
			
		||||
      factoryNameArray.forEach((fac, facIndex) => {
 | 
			
		||||
        typeArray.forEach((type, typeIndex) => {  
 | 
			
		||||
          const series = {
 | 
			
		||||
            data: Array(xAxisData.length).fill(0),
 | 
			
		||||
            type: 'bar',
 | 
			
		||||
@@ -407,27 +407,26 @@ export default {
 | 
			
		||||
          seriesArray.push(series)
 | 
			
		||||
        })
 | 
			
		||||
      })
 | 
			
		||||
      // 构造series的data
 | 
			
		||||
      const seriesDataArray = []
 | 
			
		||||
      Object.values(data).forEach((item) => {
 | 
			
		||||
        let seriesData = []
 | 
			
		||||
        // item[0].datestr 为日期
 | 
			
		||||
        typeArray.forEach(t => {
 | 
			
		||||
          const zidr = ['chipYield', 'componentYield', 'bipvProductOutput'][t]
 | 
			
		||||
 | 
			
		||||
      // 按工厂分
 | 
			
		||||
      const arrayByFacArray = Object.groupBy(dataList, (member) => member.factory)
 | 
			
		||||
      // const seriesDataArray = []
 | 
			
		||||
      let n = 0
 | 
			
		||||
      Object.values(arrayByFacArray).forEach((item) => {
 | 
			
		||||
        typeArray.forEach(type => {
 | 
			
		||||
          const typeName = ['chipYield', 'componentYield', 'bipvProductOutput'][type]
 | 
			
		||||
          let seriesData = Array(xAxisData.length).fill(0)
 | 
			
		||||
          item.forEach(it => {
 | 
			
		||||
            seriesData.push(it[zidr])
 | 
			
		||||
            xAxisData.forEach((x, xindex) => {
 | 
			
		||||
              if (x === it['datestr']) {
 | 
			
		||||
                seriesData[xindex] = it[typeName]
 | 
			
		||||
              }
 | 
			
		||||
            })
 | 
			
		||||
          })
 | 
			
		||||
          seriesArray[n].data = seriesData
 | 
			
		||||
          n ++
 | 
			
		||||
        })
 | 
			
		||||
        seriesDataArray.push(seriesData)
 | 
			
		||||
      })
 | 
			
		||||
      for (let y = 0; y < seriesArray.length; y ++) {
 | 
			
		||||
        const days = []
 | 
			
		||||
        seriesDataArray.forEach(a => {
 | 
			
		||||
          days.push(a[y])
 | 
			
		||||
        })
 | 
			
		||||
        // 赋值完成
 | 
			
		||||
        seriesArray[y].data = days
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // 添加工厂
 | 
			
		||||
      const validSeriesArray = []
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user