70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
import { formatterMillisecond } from './utils/date';
|
|
import { EditTask } from './artUtil';
|
|
import { artApi } from './artApi';
|
|
import ArtSystem from './artSystem';
|
|
import ArtImage from './artImage';
|
|
|
|
class EquipmentData {
|
|
constructor(params) {
|
|
if (!params) {
|
|
params = {};
|
|
}
|
|
this.id = params.id;
|
|
this.name = params.name;
|
|
this.equipmentId = params.equipment_id;
|
|
this.images = [];
|
|
if (params.images) {
|
|
this.images = params.images.map((url) => {
|
|
return new ArtImage(url);
|
|
});
|
|
}
|
|
this.geometry = params.geometry;
|
|
this.data = params.data;
|
|
this.materialId = params.material_id || null;
|
|
this.remarks = params.remarks;
|
|
this.dateTime = params.date_time;
|
|
this.tags = [];
|
|
if (params.tag_name) {
|
|
this.tags = params.tag_name.map((name) => {
|
|
return { name: name };
|
|
});
|
|
}
|
|
this.creator = params.creator;
|
|
this.updater = params.updater;
|
|
this.createTime = params.create_time;
|
|
this.updateTime = params.update_time;
|
|
}
|
|
get dateTimeFormat() {
|
|
return formatterMillisecond(this.dateTime);
|
|
}
|
|
get createTimeFormat() {
|
|
return formatterMillisecond(this.createTime);
|
|
}
|
|
get updateTimeFormat() {
|
|
return formatterMillisecond(this.updateTime);
|
|
}
|
|
deleteEquipmentData() {
|
|
let editTask = new EditTask(artApi.artworkEquipmentDataDelete);
|
|
editTask.addParam('_id', this.id);
|
|
return editTask.execute();
|
|
}
|
|
|
|
//获取关联的材料信息
|
|
queryqueryMateria(params = {}) {
|
|
let { filter, pageInfo } = params;
|
|
if (!filter) {
|
|
filter = [];
|
|
}
|
|
filter.push({
|
|
name: 'id',
|
|
operator: '=',
|
|
value: this.materialId,
|
|
});
|
|
return ArtSystem.queryMaterial({
|
|
filter,
|
|
pageInfo,
|
|
});
|
|
}
|
|
}
|
|
export default EquipmentData;
|