cellsysArt/laboratory.js

64 lines
2.3 KiB
JavaScript

import { EditTask } from "./artUtil.js";
import { artApi } from "./artApi";
class Laboratory {
constructor(params) {
if (!params) {
params = {};
}
this.id = params.id;
this.name = params.name;
this.description = params.description;
this.geometry = params.geometry;
this.geometryPosition=params.geometry_position;
this.creator = params.creator;
this.updater = params.updater;
this.createTime = params.create_time;
this.updateTime = params.update_time;
this.style = {
name: "坐标",
fillColor: "#1890ff",
fillOpacity: 1,
rotate: 0,
data: "M526.1121875 122.86625c-158.5603125 0.301875-286.9940625 128.9025-286.9940625 287.53125 0 148.111875 120.916875 303.909375 260.7384375 471.5015625 7.348125 8.829375 16.8534375 13.5796875 26.255625 14.1196875 9.4021875-0.54 18.9075-5.2903125 26.251875-14.1196875 139.8225-167.5921875 260.7403125-323.38875 260.7403125-471.5015625 0-158.6296875-128.4346875-287.229375-286.993125-287.53125zM526.1121875 501.6565625c-61.940625-0.335625-112.089375-50.58375-112.089375-112.5928125s50.14875-112.25625 112.089375-112.5928125c61.9396875 0.335625 112.0846875 50.58375 112.0846875 112.5928125s-50.1440625 112.25625-112.0846875 112.5928125z",
};
}
updateLaboratory(params) {
let editTask = new EditTask(artApi.laboratoryUpdate);
editTask.addParam("_id", this.id);
editTask.addParam("_description", params.description);
editTask.addParam("_name", params.name);
editTask.addParam("_geometry", params.geometry);
editTask.addParam("_geometry_position", params.geometryPosition);
return new Promise((resolve, reject) => {
editTask
.execute()
.then((res) => {
if (res.data) {
let materialType = new Laboratory(res.data);
resolve(materialType);
}
})
.catch((err) => {
reject(err);
});
});
}
deleteLaboratory(params) {
let editTask = new EditTask(artApi.laboratoryDelete);
editTask.addParam("_id", this.id);
return editTask.execute();
}
LaboratoryCountEquipmentIn(params) {
let editTask = new EditTask(artApi.countArtworkEquipmentInLaboratory);
editTask.addParam("_id", this.id);
return editTask.execute();
}
}
export default Laboratory;