cellsysArt/ReportBase.js

175 lines
5.6 KiB
JavaScript
Raw Normal View History

2024-12-26 10:28:43 +08:00
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}
2024-12-30 09:53:02 +08:00
this.conditionMapping = {};
2024-12-26 10:28:43 +08:00
this.grids = {
gridsNumber: 4,
2024-12-30 09:53:02 +08:00
gridsImgs: [],
2024-12-26 10:28:43 +08:00
};
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;
2024-12-30 09:53:02 +08:00
2024-12-26 10:28:43 +08:00
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;
}
2024-12-30 09:53:02 +08:00
if (reportBase.grids) {//宫格图
2024-12-26 10:28:43 +08:00
this.grids = reportBase.grids;
}
2024-12-30 09:53:02 +08:00
if (reportBase.conditionMapping) {
if (reportBase.conditionMapping.images) {
this.conditionMapping['images'] = reportBase.conditionMapping.images;
}
if (reportBase.conditionMapping.legend) {
this.conditionMapping['legend'] = reportBase.conditionMapping.legend;
}
}
if (reportBase.conditionTypes) {
2024-12-26 10:52:50 +08:00
this.conditionTypes = reportBase.conditionTypes;
2024-12-26 10:28:43 +08:00
}
2024-12-30 09:53:02 +08:00
if (reportBase.conditionImageList) {
this.conditionImageList = reportBase.conditionImageList;
}
if (reportBase.conditionInfo) {
this.conditionInfo = reportBase.conditionInfo;
}
2024-12-26 10:28:43 +08:00
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;
}
2024-12-30 09:53:02 +08:00
setImagesLegend(imgSrc, legend) {
2024-12-26 10:28:43 +08:00
this.conditionMapping['images'] = imgSrc;
this.conditionMapping['legend'] = legend;
}
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;