图片逻辑

This commit is contained in:
yangrd 2025-03-27 11:15:56 +08:00
parent 8a7ab9c495
commit 72fbce4c13
3 changed files with 56 additions and 58 deletions

View File

@ -16,7 +16,11 @@ class ArtRepairLog extends CellsysEvent {
this.datetime = params.datetime; this.datetime = params.datetime;
this.geometry = params.geometry; this.geometry = params.geometry;
this.geometryName = params.geometry_name; this.geometryName = params.geometry_name;
this.images = params.images; if(params.images){
this.images = params.images.map(url=>{
return new ArtImage(url)
});
}
// if (params.images) { // if (params.images) {
// this.artworkImages = params.images.map((url) => { // this.artworkImages = params.images.map((url) => {
// return new ArtImage(url); // return new ArtImage(url);

View File

@ -17,7 +17,7 @@ class GodownEntry {
this.contractor = params.contractor; //接收方 this.contractor = params.contractor; //接收方
this.stand = params.stand; //支架 this.stand = params.stand; //支架
this.packingType = params.packing_type; //装箱类型 this.packingType = params.packing_type; //装箱类型
this.padding = params._padding; //支撑物 this.padding = params.padding||[]; //支撑物
this.remark = params.remark; //备注 this.remark = params.remark; //备注
if(params.images){ if(params.images){
this.images = params.images.map(url=>{ this.images = params.images.map(url=>{

View File

@ -1,64 +1,58 @@
import { EditTask } from './artUtil.js'; import { EditTask } from "./artUtil.js";
import { artApi } from './artApi'; import { artApi } from "./artApi";
import ArtImage from './artImage';
class Material { class Material {
constructor(params) { constructor(params) {
if (!params) { if (!params) {
params = {}; params = {};
}
this.id = params.id;
this.name = params.name;
this.description = params.description;
this.images = [];
if (params.images) {
this.images = params.images.map((url) => {
return new ArtImage(url);
});
}
this.materialTypeId = params.material_type_id; //材料类型ID
this.materialType = params.material_type;
this.creator = params.creator;
this.updater = params.updater;
this.createTime = params.create_time;
this.updateTime = params.update_time;
} }
//封面图(表格展示缩略图) this.id = params.id;
get imageUrlPreviewPath() { this.name = params.name;
if (this.images && this.images.length > 0) { this.description = params.description;
return this.images[0].compressionUrl; this.images = params.images || null;
} this.materialTypeId = params.material_type_id; //材料类型ID
this.materialType = params.material_type;
this.creator = params.creator;
this.updater = params.updater;
this.createTime = params.create_time;
this.updateTime = params.update_time;
}
//封面图(表格展示缩略图)
get imageUrlPreviewPath() {
if (this.images && this.images.length > 0) {
return this.images[0].previewPath;
} }
get imageUrlimgPath() { }
if (this.images && this.images.length > 0) { get imageUrlimgPath() {
return this.images[0].url; if (this.images && this.images.length > 0) {
} return this.images[0].imgPath;
} }
updateMaterial(params) { }
let { name, description, images } = params; updateMaterial(params) {
let editTask = new EditTask(artApi.materialUpdate); let { name, description, images } = params;
editTask.addParam('_id', this.id); let editTask = new EditTask(artApi.materialUpdate);
editTask.addParam('_description', description); editTask.addParam("_id", this.id);
editTask.addParam('_name', name); editTask.addParam("_description", description);
editTask.addParam('_images', images); editTask.addParam("_name", name);
return new Promise((resolve, reject) => { editTask.addParam("_images", images);
editTask return new Promise((resolve, reject) => {
.execute() editTask
.then((res) => { .execute()
if (res.data) { .then((res) => {
let material = new Material(res.data); if (res.data) {
resolve(material); let material = new Material(res.data);
} resolve(material);
}) }
.catch((err) => { })
reject(err); .catch((err) => {
}); reject(err);
}); });
} });
deleteMaterial(params) { }
let editTask = new EditTask(artApi.materialDelete); deleteMaterial(params) {
editTask.addParam('_id', this.id); let editTask = new EditTask(artApi.materialDelete);
return editTask.execute(); editTask.addParam("_id", this.id);
} return editTask.execute();
}
} }
export default Material; export default Material;