|  | @@ -287,7 +287,7 @@
 | 
	
		
			
				|  |  |                :cell-style="cellStyle"
 | 
	
		
			
				|  |  |                class="elTable"
 | 
	
		
			
				|  |  |                @selection-change="handleSelectionChange"
 | 
	
		
			
				|  |  | -              :max-height="myHeight"
 | 
	
		
			
				|  |  | +              :max-height="myHeight2"
 | 
	
		
			
				|  |  |             >
 | 
	
		
			
				|  |  |              <el-table-column label="序号" align="center" type="index" width="50px">
 | 
	
		
			
				|  |  |                <template slot-scope="scope">
 | 
	
	
		
			
				|  | @@ -367,7 +367,8 @@ export default {
 | 
	
		
			
				|  |  |        uploadImageUrl: process.env.VUE_APP_BASE_API + 'authdata/uploaderimage',
 | 
	
		
			
				|  |  |        rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
 | 
	
		
			
				|  |  |        cellStyle: { padding: 0 + 'px' },
 | 
	
		
			
				|  |  | -      myHeight:document.documentElement.clientHeight - 85- 150
 | 
	
		
			
				|  |  | +      myHeight: document.documentElement.clientHeight - 85 - 150,
 | 
	
		
			
				|  |  | +      myHeight2:  document.documentElement.clientHeight - 150
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    computed: {
 | 
	
	
		
			
				|  | @@ -407,15 +408,20 @@ export default {
 | 
	
		
			
				|  |  |      async handlegetBigDataRecode() {
 | 
	
		
			
				|  |  |         const obj = {
 | 
	
		
			
				|  |  |          startTime: '',
 | 
	
		
			
				|  |  | -        endTime:"",
 | 
	
		
			
				|  |  | +        endTime: "",
 | 
	
		
			
				|  |  | +        eqId:this.see.temp.eqId
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        if (this.getdataListParm.parammaps.inputDatetime == '' || this.getdataListParm.parammaps.inputDatetime == null) {
 | 
	
		
			
				|  |  |          this.getdataListParm.parammaps.inputDatetime = ''
 | 
	
		
			
				|  |  | -        obj.startTime = ''
 | 
	
		
			
				|  |  | -        obj.endTime = ''
 | 
	
		
			
				|  |  | +        const currentYear = new Date().getFullYear();
 | 
	
		
			
				|  |  | +        obj.startTime =  `${currentYear}-01-01`;
 | 
	
		
			
				|  |  | +        obj.endTime = `${currentYear}-12-31`;
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  |          obj.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
 | 
	
		
			
				|  |  | -        obj.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
 | 
	
		
			
				|  |  | +        const year = new Date(this.getdataListParm.parammaps.inputDatetime).getFullYear();
 | 
	
		
			
				|  |  | +        const month = new Date(this.getdataListParm.parammaps.inputDatetime).getMonth() + 1; // 月份从0开始
 | 
	
		
			
				|  |  | +        const lastDay = new Date(year, month, 0).getDate(); // 获取当前月份的最后一天
 | 
	
		
			
				|  |  | +        obj.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}') + '-' + lastDay;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        const { data } = await getBigDataRecode(obj)
 | 
	
		
			
				|  |  |        console.log(data, '记录')
 | 
	
	
		
			
				|  | @@ -495,8 +501,12 @@ export default {
 | 
	
		
			
				|  |  |          this.getdataListParm.parammaps.startTime = ''
 | 
	
		
			
				|  |  |          this.getdataListParm.parammaps.endTime = ''
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  | -        this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
 | 
	
		
			
				|  |  | -        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
 | 
	
		
			
				|  |  | +        this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime, '{y}-{m}') + '-01'
 | 
	
		
			
				|  |  | +        const year = new Date(this.getdataListParm.parammaps.inputDatetime).getFullYear();
 | 
	
		
			
				|  |  | +        const month = new Date(this.getdataListParm.parammaps.inputDatetime).getMonth() + 1; // 月份从0开始
 | 
	
		
			
				|  |  | +        const lastDay = new Date(year, month, 0).getDate(); // 获取当前月份的最后一天
 | 
	
		
			
				|  |  | +        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}') + '-' + lastDay;
 | 
	
		
			
				|  |  | +        // this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      if (this.getdataListParm.parammaps.departmentId == undefined) { this.getdataListParm.parammaps.departmentId = '' }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -614,33 +624,29 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // 处理每一行数据,生成与表头对应的字段
 | 
	
		
			
				|  |  | - processData(downLoadList, filterVal, tHeader) {
 | 
	
		
			
				|  |  | -   return downLoadList.map(item => {
 | 
	
		
			
				|  |  | -     let row = {};
 | 
	
		
			
				|  |  | -     // 遍历 filterVal,根据顺序提取相应字段的值
 | 
	
		
			
				|  |  | -     filterVal.forEach((key, index) => {
 | 
	
		
			
				|  |  | -       // 如果是 1 到 31 天的数据,处理工作时长和加油量
 | 
	
		
			
				|  |  | -       if (key.includes('工作时长') || key.includes('加油量')) {
 | 
	
		
			
				|  |  | -        // 对应工作时长
 | 
	
		
			
				|  |  | -         item.day.forEach((child,indexl) => {
 | 
	
		
			
				|  |  | -            if (tHeader[index].includes('工作时长')) {
 | 
	
		
			
				|  |  | -              row[tHeader[index]] = item.hours[indexl];
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -             // 对应加油量
 | 
	
		
			
				|  |  | -            if (tHeader[index].includes('加油量')) {
 | 
	
		
			
				|  |  | -              row[tHeader[index]] = item.diesel[indexl];
 | 
	
		
			
				|  |  | +processData(downLoadList, filterVal, tHeader) {
 | 
	
		
			
				|  |  | +    return downLoadList.map(item => {
 | 
	
		
			
				|  |  | +        let row = {};
 | 
	
		
			
				|  |  | +        // 遍历 filterVal,根据顺序提取相应字段的值
 | 
	
		
			
				|  |  | +        filterVal.forEach((key, index) => {
 | 
	
		
			
				|  |  | +            // 如果是 1 到 31 天的数据,处理工作时长和加油量
 | 
	
		
			
				|  |  | +            if (key.includes('时长')) {
 | 
	
		
			
				|  |  | +                // 对应工作时长
 | 
	
		
			
				|  |  | +                const dayIndex = parseInt(key.split('(')[0]) - 1; // 获取天数索引
 | 
	
		
			
				|  |  | +                row[key] = item.hours[dayIndex] || '0'; // 如果没有数据则默认为0
 | 
	
		
			
				|  |  | +            } else if (key.includes('加油量')) {
 | 
	
		
			
				|  |  | +                // 对应加油量
 | 
	
		
			
				|  |  | +                const dayIndex = parseInt(key.split('(')[0]) - 1; // 获取天数索引
 | 
	
		
			
				|  |  | +                row[key] = item.diesel[dayIndex] || '0'; // 如果没有数据则默认为0
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                // 其他字段直接赋值
 | 
	
		
			
				|  |  | +                row[key] = item[key] || ''; // 如果没有数据则默认为空
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -          })
 | 
	
		
			
				|  |  | -      } else {
 | 
	
		
			
				|  |  | -        // 其他字段直接赋值
 | 
	
		
			
				|  |  | -        row[filterVal[index]] = item[key];
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        return row;
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | -    return row;
 | 
	
		
			
				|  |  | -  });
 | 
	
		
			
				|  |  |  },
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      handleDownload() {
 | 
	
		
			
				|  |  |        this.$alert('设备大数据正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
 | 
	
		
			
				|  |  |        this.isPercentage = true
 | 
	
	
		
			
				|  | @@ -655,16 +661,31 @@ export default {
 | 
	
		
			
				|  |  |        }, 1000)
 | 
	
		
			
				|  |  |        if (this.getdataListParm.parammaps.inputDatetime == '' || this.getdataListParm.parammaps.inputDatetime == null) {
 | 
	
		
			
				|  |  |          this.getdataListParm.parammaps.inputDatetime = ''
 | 
	
		
			
				|  |  | -        this.getdataListParm.parammaps.startTime = ''
 | 
	
		
			
				|  |  | -        this.getdataListParm.parammaps.endTime = ''
 | 
	
		
			
				|  |  | +        const currentYear = new Date().getFullYear();
 | 
	
		
			
				|  |  | +        this.getdataListParm.parammaps.startTime = `${currentYear}-01-01`;
 | 
	
		
			
				|  |  | +        this.getdataListParm.parammaps.endTime = `${currentYear}-12-31`;
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  |          this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+'-01'
 | 
	
		
			
				|  |  | -        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}')+ '-31'
 | 
	
		
			
				|  |  | +        const year = new Date(this.getdataListParm.parammaps.inputDatetime).getFullYear();
 | 
	
		
			
				|  |  | +        const month = new Date(this.getdataListParm.parammaps.inputDatetime).getMonth() + 1; // 月份从0开始
 | 
	
		
			
				|  |  | +        const lastDay = new Date(year, month, 0).getDate(); // 获取当前月份的最后一天
 | 
	
		
			
				|  |  | +        this.getdataListParm.parammaps.endTime = parseTime(this.getdataListParm.parammaps.inputDatetime,'{y}-{m}') + '-' + lastDay;
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        if( this.getdataListParm.parammaps.departmentId == undefined){ this.getdataListParm.parammaps.departmentId = ''}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +       // 对于多选的牧场,根据数组的名称来转换 pastureArr =》 pastureId TODO:
 | 
	
		
			
				|  |  | +      if (this.getdataListParm.parammaps.pastureArr && this.getdataListParm.parammaps.pastureArr.length > 0) {
 | 
	
		
			
				|  |  | +        const arr = this.findAllPasture.filter((item) => {
 | 
	
		
			
				|  |  | +          if (this.getdataListParm.parammaps.pastureArr.includes(item.name)) {
 | 
	
		
			
				|  |  | +            return item
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        const ids = arr.map((child) => { return child.id })
 | 
	
		
			
				|  |  | +        this.getdataListParm.parammaps.pastureId = ids.toString();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        const obj = JSON.parse(JSON.stringify(this.getdataListParm.parammaps));
 | 
	
		
			
				|  |  | -      obj.pastureId = Cookies.get('pastureid');
 | 
	
		
			
				|  |  | +      // obj.pastureId = Cookies.get('pastureid');
 | 
	
		
			
				|  |  |        delete obj.pastureArr
 | 
	
		
			
				|  |  |        getDownLoadData(obj).then(response => {
 | 
	
		
			
				|  |  |          var downLoadList = response.data.list.map((child) => {
 | 
	
	
		
			
				|  | @@ -678,15 +699,15 @@ export default {
 | 
	
		
			
				|  |  |          const days = downLoadList[0].day;
 | 
	
		
			
				|  |  |          const currentData = downLoadList[0];
 | 
	
		
			
				|  |  |          let filterVal = []
 | 
	
		
			
				|  |  | -        const filterVal0 = ['pastureName', 'eqClassName', 'eqName', 'eqCode', 'status', 'purchaseDate', 'financeCode', 'departmentName', 'employeName', 'license', 'duration', 'cardCode', 'cardType', 'enable'];
 | 
	
		
			
				|  |  | +        const filterVal0 = ['date','pastureName', 'eqClassName', 'eqName', 'eqCode', 'status', 'purchaseDate', 'financeCode', 'departmentName', 'employeName', 'license', 'duration', 'cardCode', 'cardType', 'enable'];
 | 
	
		
			
				|  |  |          filterVal = [...filterVal0];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 添加每一天的 hours 和 diesel 数据
 | 
	
		
			
				|  |  |          currentData.day.forEach(day => {
 | 
	
		
			
				|  |  | -          filterVal.push(`${day}天(工作时长)`); // 添加对应的 hours
 | 
	
		
			
				|  |  | +          filterVal.push(`${day}(时长)`); // 添加对应的 hours
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          currentData.day.forEach(day => {
 | 
	
		
			
				|  |  | -          filterVal.push(`${day}天(加油量)`); // 添加对应的 diesel
 | 
	
		
			
				|  |  | +          filterVal.push(`${day}(加油量)`); // 添加对应的 diesel
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (response.data.list !== '') {
 | 
	
	
		
			
				|  | @@ -698,9 +719,10 @@ export default {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          const table = this.$refs.table;
 | 
	
		
			
				|  |  |          const labels = table.columns.map((column) => column.label !== '序号' && column.label !== '操作' ? column.label : null).filter(label => label !== null);
 | 
	
		
			
				|  |  | -        const tHeader = [...labels, ...currentData.day.map(d => `${d}天(工作时长)`), ...currentData.day.map(d => `${d}天(加油量)`)];
 | 
	
		
			
				|  |  | +        const tHeader = ['日期',...labels, ...currentData.day.map(d => `${d}(时长)`), ...currentData.day.map(d => `${d}(加油量)`)];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          const processedData = this.processData(downLoadList, filterVal, tHeader);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          const elecExcelDatas = [
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              tHeader: tHeader,
 | 
	
	
		
			
				|  | @@ -711,7 +733,7 @@ export default {
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |          ];
 | 
	
		
			
				|  |  |          console.log(elecExcelDatas, 'elecExcelDatas')
 | 
	
		
			
				|  |  | -        json2excel(elecExcelDatas, '设备大数据', true, 'xlsx')
 | 
	
		
			
				|  |  | +        json2excel(elecExcelDatas, '设备大数据', false, 'xlsx')
 | 
	
		
			
				|  |  |       })
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |  
 |