cellsysArt/conditionReport.js
2025-01-03 09:52:13 +08:00

91 lines
3.3 KiB
JavaScript

import { EditTask } from "@airkoon/cellsys/cellsysUtil";
import { artApi } from "./artApi";
import { formatterMillisecond } from "./utils/date";
class ConditionReport {
constructor(params) {
if (!params) {
params = {};
}
this.id = params.id;
this.artworkRecordId = params.artwork_record_id;
this.name = params.name;
this.modelOptions = params.model_options || {};
// let modelOptions = params.model_options;
// if (modelOptions) {
// // this.coverImage = new ArtImage(modelOptions.coverImage);//封面图
// // let reportInformation = modelOptions.reportInformation;//报告信息
// // if (reportInformation) {
// // this.checkBy = reportInformation.checkBy;
// // this.checkDate = reportInformation.checkDate;
// // this.checkLocation = reportInformation.checkLocation;
// // this.documentNumber = reportInformation.documentNumber;
// // this.conservation = reportInformation.conservation;
// // }
// // let artworkInformation = modelOptions.artworkInformation;//作品信息
// //
// // let conditionMapping = modelOptions.conditionMapping;//概况图
// //
// // let examination = modelOptions.examination;//查验情况
// // let grids = modelOptions.grids;//九宫格
// // let details = modelOptions.details;//局部图
// // let conservation = modelOptions.conservation;//查验结果
// // let suggest = modelOptions.suggest;//保存修复建议
// // let coverLogo=modelOptions.coverLogo;//封面logo
// // let logo=modelOptions.logo;
// modelOptions=new ReportBase()
// }
let artworkRecord = params.artwork_record;
if (artworkRecord) {
this.recordNumber = artworkRecord.record_number;
this.oldName = artworkRecord.old_name;
}
this.tags = [];
if (params.tag_name) {
this.tags = params.tag_name.map((name) => {
return { name: name };
});
}
this.createBy = params.create_by;
this.createTime = params.create_time;
this.updateBy = params.update_by;
this.updateTime = params.update_time;
this.creator = params.creator;
this.updater = params.updater;
}
get createTimeFormat() {
return formatterMillisecond(this.createTime);
}
get coverImageUrl() {
if (this.modelOptions.coverImage) {
return this.modelOptions.coverImage;
}
}
conditionCheckInsert(params) {
let editTask = new EditTask(artApi.conditionCheckInsert);
editTask.addParam("_artwork_record_id", params.artworkRecordId);
editTask.addParam("_name", params.name);
editTask.addParam("_model_options", params.modelOptions);
return editTask.execute();
}
conditionCheckUpdate(params) {
let editTask = new EditTask(artApi.conditionCheckUpdate);
editTask.addParam("_id", params.id);
editTask.addParam("_artwork_record_id", params.artworkRecordId);
editTask.addParam("_name", params.name);
editTask.addParam("_model_options", params.modelOptions);
return editTask.execute();
}
conditionCheckDelete(params) {
let editTask = new EditTask(artApi.conditionCheckDelete);
editTask.addParam("_id", params.id);
return editTask.execute();
}
}
export default ConditionReport;