From 72fbce4c13a91cdcfbf0b134421e47e63eb720d3 Mon Sep 17 00:00:00 2001 From: yangrd <1020519285@qq.com> Date: Thu, 27 Mar 2025 11:15:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- artRepairLog.js | 6 ++- godownEntry.js | 2 +- material.js | 106 +++++++++++++++++++++++------------------------- 3 files changed, 56 insertions(+), 58 deletions(-) diff --git a/artRepairLog.js b/artRepairLog.js index 4ea1fb7..d392e06 100644 --- a/artRepairLog.js +++ b/artRepairLog.js @@ -16,7 +16,11 @@ class ArtRepairLog extends CellsysEvent { this.datetime = params.datetime; this.geometry = params.geometry; 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) { // this.artworkImages = params.images.map((url) => { // return new ArtImage(url); diff --git a/godownEntry.js b/godownEntry.js index ef8e948..e6f187d 100644 --- a/godownEntry.js +++ b/godownEntry.js @@ -17,7 +17,7 @@ class GodownEntry { this.contractor = params.contractor; //接收方 this.stand = params.stand; //支架 this.packingType = params.packing_type; //装箱类型 - this.padding = params._padding; //支撑物 + this.padding = params.padding||[]; //支撑物 this.remark = params.remark; //备注 if(params.images){ this.images = params.images.map(url=>{ diff --git a/material.js b/material.js index 1af144a..e672c1d 100644 --- a/material.js +++ b/material.js @@ -1,64 +1,58 @@ -import { EditTask } from './artUtil.js'; -import { artApi } from './artApi'; -import ArtImage from './artImage'; +import { EditTask } from "./artUtil.js"; +import { artApi } from "./artApi"; class Material { - constructor(params) { - if (!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; + constructor(params) { + if (!params) { + params = {}; } - //封面图(表格展示缩略图) - get imageUrlPreviewPath() { - if (this.images && this.images.length > 0) { - return this.images[0].compressionUrl; - } + this.id = params.id; + this.name = params.name; + this.description = params.description; + 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) { - return this.images[0].url; - } + } + get imageUrlimgPath() { + if (this.images && this.images.length > 0) { + return this.images[0].imgPath; } - updateMaterial(params) { - let { name, description, images } = params; - let editTask = new EditTask(artApi.materialUpdate); - editTask.addParam('_id', this.id); - editTask.addParam('_description', description); - editTask.addParam('_name', name); - editTask.addParam('_images', images); - return new Promise((resolve, reject) => { - editTask - .execute() - .then((res) => { - if (res.data) { - let material = new Material(res.data); - resolve(material); - } - }) - .catch((err) => { - reject(err); - }); + } + updateMaterial(params) { + let { name, description, images } = params; + let editTask = new EditTask(artApi.materialUpdate); + editTask.addParam("_id", this.id); + editTask.addParam("_description", description); + editTask.addParam("_name", name); + editTask.addParam("_images", images); + return new Promise((resolve, reject) => { + editTask + .execute() + .then((res) => { + if (res.data) { + let material = new Material(res.data); + resolve(material); + } + }) + .catch((err) => { + reject(err); }); - } - deleteMaterial(params) { - let editTask = new EditTask(artApi.materialDelete); - editTask.addParam('_id', this.id); - return editTask.execute(); - } + }); + } + deleteMaterial(params) { + let editTask = new EditTask(artApi.materialDelete); + editTask.addParam("_id", this.id); + return editTask.execute(); + } } export default Material;