import { artApi } from './artApi'; import { formatterMillisecond } from './utils/date'; import { Query, QueryTask, EditTask } from './artUtil'; import CellsysArt from './cellsysArt'; import ArtSystem from './artSystem'; 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; } } //查询艺术品档案详细信息 queryArtworkDetail() { let editTask = new EditTask(artApi.artworkDetails); editTask.addParam('_id', this.artworkRecordId); return new Promise((resolve, reject) => { editTask .execute() .then((res) => { if (res.data) { let cellsysArt = new CellsysArt(res.data); resolve(cellsysArt); } }) .catch((err) => { reject(err); }); }); } 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(); } //查询状况检查关联的设备数据记录 //查询设备数据 queryEquipmentDatas(params = {}) { let { filter, pageInfo } = params; if (!filter) { filter = []; } filter.push({ name: 'condition_check_id', operator: '=', value: this.id, }); return ArtSystem.viewArtworkEquipmentData({ filter, pageInfo }); } } export default ConditionReport;