import { formatterDate } from '@/utils/date'; class ReportBase { constructor(params) { if (!params) { params = {}; } this.documentNumber = formatterDate(new Date(), 'YYYYMMDDHHmmss'); this.reportName = params.reportName || null; this.checkDate = params.checkDate || new Date().getTime(); this.checkLocation = params.checkLocation || ''; //目的地详细地址 this.checkLocationGeometry = params.checkLocationGeometry || null; //geometry格式 this.checkBy = params.checkBy || ''; this.reportBy = params.reportBy || ''; this.coverImage = params.coverImage; //报告封面图 this.conditionTypes = []; this.conditionImageList = []; // 状况分析详情图{title,description,image} this.conditionMapping = []; //状况图对象数组 {original,graphing,superposition,legend} legend包含{key,desc,color} this.grids = { gridsNumber: 4, gridsImgs: [], }; this.conservation = params.conservation || null; this.suggest = params.suggest || null; this.environmentTemperature = params.environmentTemperature || null; //不带单位 this.environmentHumidity = params.environmentHumidity || null; //不带单位 this.equipmentData = []; //科学分析-设备数据关联 } setAttribute(reportBase) { if (!reportBase) { return; } if (reportBase.documentNumber) { this.documentNumber = reportBase.documentNumber; } if (reportBase.checkDate) { this.checkDate = reportBase.checkDate; } this.reportName = reportBase.reportName; this.checkLocation = reportBase.checkLocation; this.checkBy = reportBase.checkBy; this.reportBy = reportBase.reportBy; if (reportBase.coverImage) { this.coverImage = reportBase.coverImage; } if (reportBase.conservation) { this.conservation = reportBase.conservation; } if (reportBase.suggest) { this.suggest = reportBase.suggest; } if (reportBase.grids) { //宫格图 this.grids = reportBase.grids; } if (reportBase.conditionMapping) { this.conditionMapping = reportBase.conditionMapping; } if (reportBase.conditionTypes) { this.conditionTypes = reportBase.conditionTypes; } if (reportBase.conditionImageList) { this.conditionImageList = reportBase.conditionImageList; } this.checkLocationGeometry = reportBase.checkLocationGeometry || null; //geometry格式 this.environmentTemperature = reportBase.environmentTemperature || null; this.environmentHumidity = reportBase.environmentHumidity || null; } setReportBy(val) { this.reportBy = val; } setCoverImage(imageSrc) { this.coverImage = imageSrc; } setConditionImageList(fileList) { this.conditionImageList = fileList; } setConditionMapping(items) { this.conditionMapping = items; } setConservation(val) { this.conservation = val; } setSuggest(val) { this.suggest = val; } setLogo(val) { this.logo = window.GLOBAL['BASE_URL'] + val; } setCoverLogo(val) { this.coverLogo = val; } setOrgName(val) { this.organizationName = val; } setOrgEmail(val) { this.organizationEmail = val; } setOrgPhone(val) { this.organizationPhone = val; } setGrids(gridNumber, girdList) { this.grids['gridsNumber'] = gridNumber; this.grids['gridsImgs'] = girdList; } setCheckLocation(checkLocation) { this.checkLocation = checkLocation; } setCheckLocationGeometry(geometry) { if (geometry) { this.checkLocationGeometry = { type: 'Point', coordinates: geometry.coordinates, }; } } setEquipmentData(equDataIds) { this.equipmentData = equDataIds; } } export default ReportBase;