import moment from "moment";

export default {
    // 城市内湖导入
    toInnerCityLakeObjData(excelData, reportDate) {

        return excelData.map(item => {
            const monitorTime = new Date(reportDate);
            const row = {
                monitorTime: monitorTime.getTime(),
                province: "广西壮族自治区",
                city: "南宁",
                pointName: item[0],
                waterTemperature: item[1],
                ph: item[2],
                transparency: item [3],
                dissolvedOxygenSaturation: item [4],
                dissolvedOxygen: item [5],
                permanganateIndex: item [6],
                fiveDayBod: item [7],
                totalNitrogen: item [8],
                ammonia: item [9],
                volatilePhenol: item [10],
                as: item [11],
                hg: item [12],
                cr6: item [13],
                pb: item [14],
                cd: item [15],
                totalPhosphorus: item [16],
                petro: item [17],
                fecalColiforms: item [18],
                cod: item [19],
                chlA: item [20],
                anSaa: item [21],
                s: item [22],
                oxidationReductionPotential: item [23],
                remark: item [24],

            }
            return row;
        })

    },
// 五象湖
    toWuxiangLakeObjData(excelData) {
        return excelData.map(item => {
          let cellVal = item [22];
          let fecalColiforms = cellVal;
          if(typeof  cellVal == "string" && cellVal.split("×").length==2){
            let end = cellVal.split("×")[1];
            let pow = end.substring(end.indexOf("10")+2,end.length);
            let start = cellVal.split("×")[0];
            fecalColiforms = Math.pow(10,Number(pow)) * start;

          }
            const row = {
                province: "广西壮族自治区",
                city: "南宁",
                pointName: item[0],
                monitorTime: moment(item[1], "YYYY年M月D日").valueOf(),
                waterTemperature: item[2],
                dissolvedOxygen: item [3],
                dissolvedOxygenSaturation: item [4],
                transparency: item [5],
                ph: item [6],
                fiveDayBod: item [7],
                permanganateIndex: item [8],
                cod: item [9],
                ammonia: item [10],
                chlA: item [11],
                oxidationReductionPotential: item [12],
                cr6: item [13],
                hg: item [14],
                pb: item [15],
                as: item [16],
                cd: item [17],
                totalPhosphorus: item [18],
                s: item [19],
                petro: item [20],
                totalNitrogen: item [21],
                fecalColiforms,
                anSaa: item [23],
                remark: item [24],

            }
            return row;
        })

    },
    // 专项湖库
    toSpecialLakeData(excelData) {
        return excelData.map(item => {
            const row = {
                province: "广西壮族自治区",
                city: "南宁",
                // nothing: item[0],
                stationName: item[1],
                stationCode: item[2],
                lakeLibraryName: item [3],
                lakeLibraryCode: item [4],
                sectionName: item [5],
                sectionCode: item [6],
                controlAttributes: item [7],
                watershed: item [8],
                monitorTime: new Date(item[9]).getTime(),
                waterPeriodCode: item [10],
                turbidity: item [11],
                wTemp: item [12],
                wd: item [13],
                ph: item [14],
                wCond: item [15],
                transp: item [16],
                dissolvedOxygen: item [17],
                codmn: item [18],
                bod5: item [19],
                nh4N: item [20],
                oils: item [21],
                nTotal: item [22],
                pTotal: item [23],
                chlA: item [24],
                vPhen: item [25],
                wHg: item [26],
                wPb: item [27],
                codcr: item [28],
                wCu: item [29],
                wZn: item [30],
                f: item [31],
                se: item [32],
                as: item [33],
                cd: item [34],
                cr6: item [35],
                cnTotal: item [36],
                anSaa: item [37],
                s: item [38],
                coloOrg: item [39],
                so4: item [40],
                cl: item [41],
                no3N: item [42],
                wFe: item [43],
                wMn: item [44],
                waterQualityCategory: item [45],
                remark: item [46],
                systemCode: item[47],

            }
            return row;
        })

    },

}
