165 lines
5.5 KiB
JavaScript
165 lines
5.5 KiB
JavaScript
export default {
|
|
toObjData(excelData) {
|
|
return excelData.map(item => {
|
|
const monitorTime = new Date();
|
|
monitorTime.setFullYear(item[0]);
|
|
monitorTime.setMonth(item[7] - 1);
|
|
monitorTime.setDate(item[8]);
|
|
monitorTime.setHours(item[9]);
|
|
monitorTime.setMinutes(item[10]);
|
|
let quarter = 1;
|
|
const month = item[7]
|
|
if (month < 4) {
|
|
quarter = 1
|
|
} else if (month < 7) {
|
|
quarter = 2
|
|
} else if (month < 10) {
|
|
quarter = 3
|
|
} else {
|
|
quarter = 4
|
|
}
|
|
const row = {
|
|
regionCode: "450100",
|
|
monitorYear: item[0],
|
|
gridLength: item[1],
|
|
gridWidth: item[2],
|
|
place: item[3],
|
|
gridNo: item[4],
|
|
area: item[5],
|
|
source: item[6],
|
|
monitorMonth: item[7],
|
|
monitorDay: item[8],
|
|
monitorHour: item[9],
|
|
monitorMinute: item[10],
|
|
indexLeq: item[11],
|
|
indexSd: item[12],
|
|
indexL10: item[13],
|
|
indexL50: item[14],
|
|
indexL90: item[15],
|
|
indexLmax: item[16],
|
|
indexLmin: item[17],
|
|
station: item[18],
|
|
monitorInstrumentModel: item[19],
|
|
monitorInstrumentCode: item[20],
|
|
beforeMonitorValue: item[21],
|
|
afterMonitorValue: item[22],
|
|
soundPressureValue: item[23],
|
|
soundInstrumentModel: item[24],
|
|
soundInstrumentCode: item[25],
|
|
city: '南宁',
|
|
regionLevel: "市级",
|
|
monitorTime: monitorTime.getTime(),
|
|
quarter
|
|
}
|
|
|
|
if (row.monitorHour >= 6 && row.monitorHour < 22) {
|
|
row.timeSlot = "昼"
|
|
}else{
|
|
row.timeSlot = "夜"
|
|
}
|
|
if (row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90) {
|
|
throw new Error(row.place + "数值有误")
|
|
}
|
|
return row;
|
|
})
|
|
|
|
},
|
|
toPlaceData(excelData) {
|
|
return excelData.map(item => {
|
|
return {
|
|
place: item[0],
|
|
placeLng: item[1],
|
|
placeLat: item[2],
|
|
motorway: item[3],
|
|
motorwayType: item[4],
|
|
motorwayLevel: item[5],
|
|
refObj: item[6],
|
|
people: item[7],
|
|
station: item[8],
|
|
monitorInstrumentModel: item[9],
|
|
monitorInstrumentCode: item[10],
|
|
beforeMonitorValue: item[11],
|
|
afterMonitorValue: item[12],
|
|
soundPressureValue: item[13],
|
|
soundInstrumentModel: item[14],
|
|
soundInstrumentCode: item[15],
|
|
|
|
}
|
|
})
|
|
|
|
},
|
|
// 解析县级数据
|
|
toAreaObjData(excelData) {
|
|
return excelData.map(item => {
|
|
const monitorTime = new Date();
|
|
monitorTime.setFullYear(item[1]);
|
|
monitorTime.setMonth(item[14] - 1);
|
|
monitorTime.setDate(item[15]);
|
|
monitorTime.setHours(item[16]);
|
|
monitorTime.setMinutes(item[17]);
|
|
let quarter = 1;
|
|
const month = item[14]
|
|
if (month < 4) {
|
|
quarter = 1
|
|
} else if (month < 7) {
|
|
quarter = 2
|
|
} else if (month < 10) {
|
|
quarter = 3
|
|
} else {
|
|
quarter = 4
|
|
}
|
|
let timeSlot = "夜";
|
|
if (item[16] >= 6 && item[16] <= 22) {
|
|
timeSlot = "昼"
|
|
}
|
|
const row = {
|
|
regionCode: item[0],
|
|
regionLevel: "县级",
|
|
monitorYear: item[1],
|
|
placeCode: item[2],
|
|
place: item[3],
|
|
placeLng: item[4],
|
|
placeLat: item[5],
|
|
road: item[6],
|
|
roadLength: item[7],
|
|
roadWidth: item[8],
|
|
motorway: item[9],
|
|
motorwayType: item[10],
|
|
motorwayLevel: item[11],
|
|
refObj: item[12],
|
|
people: item[13],
|
|
monitorMonth: item[14],
|
|
monitorDay: item[15],
|
|
monitorHour: item[16],
|
|
monitorMinute: item[17],
|
|
smallTrafficFlow: item[18],
|
|
largeTrafficFlow: item[19],
|
|
indexLeq: item[20],
|
|
indexL10: item[21],
|
|
indexL50: item[22],
|
|
indexL90: item[23],
|
|
indexLmax: item[24],
|
|
indexLmin: item[25],
|
|
indexSd: item[26],
|
|
station: item[27],
|
|
monitorInstrumentModel: item[28],
|
|
monitorInstrumentCode: item[29],
|
|
beforeMonitorValue: item[30],
|
|
afterMonitorValue: item[31],
|
|
soundPressureValue: item[32],
|
|
soundInstrumentModel: item[33],
|
|
soundInstrumentCode: item[34],
|
|
remark: item[35],
|
|
city: '南宁',
|
|
timeSlot,
|
|
monitorTime: monitorTime.getTime(),
|
|
quarter
|
|
|
|
}
|
|
if(row.indexL10 < row.indexL50 || row.indexL50 < row.indexL90){
|
|
throw new Error(row.place + "数值有误")
|
|
}
|
|
return row;
|
|
})
|
|
}
|
|
} |