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.consignor = params.consignor || ''; //托运方 this.actualNumber = params.actualNumber || 1; this.checkBy = params.checkBy || ''; this.reportBy = params.reportBy || ''; this.coverImage = params.coverImage; //报告封面图 this.conditionTypes = []; this.conditionInfo = null; //状况类型补充说明 this.conditionImageList = []; // 局部详情图{title,description,image} this.conditionMapping = []; 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.logo = null; // this.coverLogo = `${window.GLOBAL["BASE_URL"]}/AppTemplate/conditionReport/images/reportLogo.png`; // this.organizationName = params.organizationName; // this.organizationEmail = 'ja.atelier@hotmail.com'; // this.organizationPhone = '+86-13911819084 / +33 (0)7.82.15.72.97'; // this.signatureInfo = { // "weChatImg": `${window.GLOBAL["BASE_URL"]}/AppTemplate/conditionReport/images/erm.png`, // "signer": "Jia Peng", // "signerInfo":"Conservator - Restorer of the cultural heritage recognized by the Direction of the museums of France (D.M.F)\n" + // "Professor of Conservation-Restoration & Material research of Art of Guangzhou Academy of Fine Art (GAFA)\n" + // "Director of Guangdong Provincial Key Laboratory of Conservation-Restoration & Materials Research of Artworks" // } } setAttribute(reportBase) { if (!reportBase) { return; } if (reportBase.documentNumber) { this.documentNumber = reportBase.documentNumber; } if (reportBase.checkDate) { this.checkDate = reportBase.checkDate; } if (reportBase.actualNumber) { this.actualNumber = reportBase.actualNumber; } this.reportName = reportBase.reportName; this.checkLocation = reportBase.checkLocation; this.consignor = reportBase.consignor; 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.conditionTypes){ this.conditionType = reportBase.conditionTypes; } 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; } setConditionTypes(val) { this.conditionTypes = val || []; } setConditionInfo(val) { this.conditionInfo = val; } setConditionImageList(fileList) { this.conditionImageList = fileList; } setImagesLegend(imgSrc,legend) { this.conditionMapping['images'] = imgSrc; this.conditionMapping['legend'] = legend; } setImages(imgSrc) { this.conditionMapping = imgSrc; } 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, }; } } } export default ReportBase;