From b8ab35e7a4251cf12d18f7ecddec16d8349e3146 Mon Sep 17 00:00:00 2001 From: ag <2663588772@qq.com> Date: Thu, 26 Dec 2024 10:28:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + ReportArt.js | 43 +++++++ ReportBase.js | 164 ++++++++++++++++++++++++++ artApi.js | 36 ++++++ artCounty.js | 9 ++ artEnum.js | 12 ++ artImage.js | 49 ++++++++ artReport.js | 24 ++++ artSystem.js | 285 +++++++++++++++++++++++++++++++++++++++++++++ artUser.js | 9 ++ cellsysArt.js | 161 +++++++++++++++++++++++++ conditionReport.js | 89 ++++++++++++++ godownEntry.js | 162 ++++++++++++++++++++++++++ outBoundReview.js | 76 ++++++++++++ outbound.js | 151 ++++++++++++++++++++++++ package-lock.json | 120 +++++++++++++++++++ package.json | 14 +++ repairEvent.js | 13 +++ utils/date.js | 173 +++++++++++++++++++++++++++ wareHouse.js | 101 ++++++++++++++++ wareHouseType.js | 100 ++++++++++++++++ 21 files changed, 1793 insertions(+) create mode 100644 .gitignore create mode 100644 ReportArt.js create mode 100644 ReportBase.js create mode 100644 artApi.js create mode 100644 artCounty.js create mode 100644 artEnum.js create mode 100644 artImage.js create mode 100644 artReport.js create mode 100644 artSystem.js create mode 100644 artUser.js create mode 100644 cellsysArt.js create mode 100644 conditionReport.js create mode 100644 godownEntry.js create mode 100644 outBoundReview.js create mode 100644 outbound.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 repairEvent.js create mode 100644 utils/date.js create mode 100644 wareHouse.js create mode 100644 wareHouseType.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..34977ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +.idea \ No newline at end of file diff --git a/ReportArt.js b/ReportArt.js new file mode 100644 index 0000000..e1cf832 --- /dev/null +++ b/ReportArt.js @@ -0,0 +1,43 @@ + +class ReportArt{ + constructor(params) { + if(!params){ + params = {}; + } + this.artworkId = params.id || null;//艺术品id、 + this.artworkOldName = params.oldName || "无";//艺术品原名 + this.author = params.author || "无";//作者 + this.createPeriod = params.createPeriod || "无";//创作年代 + this.materialName = params.materialName || "无";//材质 + this.artworkImages = params.artworkImages || "";//艺术品图片 + this.actualNumber=params.actualNumber || 1;//数量 + this.shippingContainerType = [];//包装类型 + this.packingMaterials = [];//填充物 + this.transportPurpose = [];//运输目的 + } + + setAttribute(art){ + this.artworkId = art.artworkRecordId || null;//艺术品id、 + this.artworkOldName = art.artworkOldName || "无";//艺术品原名 + this.author = art.author || "无";//作者 + this.createPeriod = art.createPeriod || "无";//创作年代 + this.materialName = art.materialName || "无";//材质 + this.artworkImages = art.artworkImages || "";//艺术品图片 + this.actualNumber=art.actualNumber || 1;//数量 + + if(art.transportPurpose.length > 0){ + this.transportPurpose = art.transportPurpose; + } + if(art.shippingContainerType.length > 0){ + this.shippingContainerType =art.shippingContainerType; + } + if(art.packingMaterials.length > 0){ + this.packingMaterials = art.packingMaterials; + } + } + setMaterials(val){ + this.materials = val; + } +} + +export default ReportArt \ No newline at end of file diff --git a/ReportBase.js b/ReportBase.js new file mode 100644 index 0000000..6115e30 --- /dev/null +++ b/ReportBase.js @@ -0,0 +1,164 @@ +import {formatterDate} from '@/utils/date'; + +class ReportBase { + constructor(params) { + if (!params) { + params = {}; + } + this.documentNumber = formatterDate(new Date(), 'YYYYMMDDHHmmss'); + this.reportName = params.reportName || null; + this.checkDate = params.checkDate || new Date().getTime(); + this.checkLocation = params.checkLocation || ''; + this.checkLocationGeometry = params.checkLocationGeometry || null; //geometry格式 + this.consignor = params.consignor || ''; //托运方 + this.actualNumber = params.actualNumber || 1; + this.checkBy = params.checkBy || ''; + this.reportBy = params.reportBy || ''; + this.coverImage = params.coverImage; //报告封面图 + this.conditionTypes = []; + this.conditionInfo = null; //状况类型补充说明 + this.conditionImageList = []; // 局部详情图{title,description,image} + this.conditionMapping = []; + this.grids = { + gridsNumber: 4, + gridsImgs: [ + + ], + }; + this.conservation = params.conservation || null; + this.suggest = params.suggest || null; + this.environmentTemperature = params.environmentTemperature || null; //不带单位 + this.environmentHumidity = params.environmentHumidity || null; //不带单位 + this.logo = null; + // this.coverLogo = `${window.GLOBAL["BASE_URL"]}/AppTemplate/conditionReport/images/reportLogo.png`; + // this.organizationName = params.organizationName; + // this.organizationEmail = 'ja.atelier@hotmail.com'; + // this.organizationPhone = '+86-13911819084 / +33 (0)7.82.15.72.97'; + // this.signatureInfo = { + // "weChatImg": `${window.GLOBAL["BASE_URL"]}/AppTemplate/conditionReport/images/erm.png`, + // "signer": "Jia Peng", + // "signerInfo":"Conservator - Restorer of the cultural heritage recognized by the Direction of the museums of France (D.M.F)\n" + + // "Professor of Conservation-Restoration & Material research of Art of Guangzhou Academy of Fine Art (GAFA)\n" + + // "Director of Guangdong Provincial Key Laboratory of Conservation-Restoration & Materials Research of Artworks" + // } + } + + setAttribute(reportBase) { + if (!reportBase) { + return; + } + if (reportBase.documentNumber) { + this.documentNumber = reportBase.documentNumber; + } + if (reportBase.checkDate) { + this.checkDate = reportBase.checkDate; + } + if (reportBase.actualNumber) { + this.actualNumber = reportBase.actualNumber; + } + this.reportName = reportBase.reportName; + + this.checkLocation = reportBase.checkLocation; + this.consignor = reportBase.consignor; + + this.checkBy = reportBase.checkBy; + this.reportBy = reportBase.reportBy; + if (reportBase.coverImage) { + this.coverImage = reportBase.coverImage; + } + if (reportBase.conservation) { + this.conservation = reportBase.conservation; + } + if (reportBase.suggest) { + this.suggest = reportBase.suggest; + } + if(reportBase.grids){//宫格图 + this.grids = reportBase.grids; + } + if(reportBase.conditionTypes){ + this.conditionType = reportBase.conditionTypes; + } + this.checkLocationGeometry = reportBase.checkLocationGeometry || null; //geometry格式 + this.environmentTemperature = reportBase.environmentTemperature || null; + this.environmentHumidity = reportBase.environmentHumidity || null; + } + + setReportBy(val) { + this.reportBy = val; + } + + setCoverImage(imageSrc) { + this.coverImage = imageSrc; + } + + setConditionTypes(val) { + this.conditionTypes = val || []; + } + + setConditionInfo(val) { + this.conditionInfo = val; + } + + + setConditionImageList(fileList) { + this.conditionImageList = fileList; + } + + setImagesLegend(imgSrc,legend) { + this.conditionMapping['images'] = imgSrc; + this.conditionMapping['legend'] = legend; + } + + setImages(imgSrc) { + this.conditionMapping = imgSrc; + } + + + setConservation(val) { + this.conservation = val; + } + + setSuggest(val) { + this.suggest = val; + } + + setLogo(val) { + this.logo = window.GLOBAL["BASE_URL"] + val; + } + + setCoverLogo(val) { + this.coverLogo = val; + } + + setOrgName(val) { + this.organizationName = val; + } + + setOrgEmail(val) { + this.organizationEmail = val; + } + + setOrgPhone(val) { + this.organizationPhone = val; + } + + setGrids(gridNumber, girdList) { + this.grids['gridsNumber'] = gridNumber; + this.grids['gridsImgs'] = girdList; + } + + setCheckLocation(checkLocation) { + this.checkLocation = checkLocation; + } + + setCheckLocationGeometry(geometry) { + if (geometry) { + this.checkLocationGeometry = { + type: 'Point', + coordinates: geometry.coordinates, + }; + } + } +} + +export default ReportBase; diff --git a/artApi.js b/artApi.js new file mode 100644 index 0000000..4d59c16 --- /dev/null +++ b/artApi.js @@ -0,0 +1,36 @@ +const artApi = { + country: '/rpc/view_country_code', //查询国家数据 + artworkRepair: '/rpc/view_art_artwork_repair_rel', + artworkRecord: '/rpc/view_art_artwork_record', //查询档案 + artworkDetails: '/rpc/view_art_artwork_detail', //查看档案详情 + artUploadPicture: '/rpc/artUploadPicture', //图片上传 + artArtworkRecordInsert: '/rpc/artArtworkRecordInsert', //创建档案 + artArtworkRecordDelete: '/rpc/artArtworkRecordDelete', //删除艺术品档案 + artArtworkRecordUpdate: '/rpc/artArtworkRecordUpdate', //编辑艺术品档案 + viewWareHouseType: '/rpc/ViewWareHouseType', //查询仓库类型 + wareHouseTypeInsert: '/rpc/wareHouseTypeInsert', //创建仓库类型 + wareHouseTypeUpdate: '/rpc/wareHouseTypeUpdate', //修改仓库类型 + wareHouseTypeDelete: '/rpc/wareHouseTypeDelete', //删除仓库类型 + wareHouseInsert: '/rpc/wareHouseInsert', //创建仓库 + wareHouseUpdate: '/rpc/wareHouseUpdate', //修改仓库 + wareHouseDelete: '/rpc/wareHouseDelete', //删除仓库 + viewWareHouse: '/rpc/viewWareHouse', //查询仓库 + countInWareHouse: '/rpc/countArtworkInWareHouse', //盘点数据 + wareHouseEntryInsert: '/rpc/wareHouseEntryInsert', //新增入库 + wareHouseEntryUpdate: '/rpc/wareHouseEntryUpdate', //修改入库 + wareHouseEntryDelete: '/rpc/wareHouseEntryDelete', //删除入库 + viewWareHouseEntry: '/rpc/viewWareHouseEntry', //查询入库 + wareHouseOutboundInsert: '/rpc/wareHouseOutboundInsert', //新增出库记录 + wareHouseOutboundUpdate: '/rpc/wareHouseOutboundUpdate', //修改出库记录 + wareHouseOutboundDelete: '/rpc/wareHouseOutboundDelete', //删除出库记录 + viewWareHouseOutbound: '/rpc/viewWareHouseOutbound', //c查询出库记录 + wareHouseOutboundReviewInsert: '/rpc/wareHouseOutboundReviewInsert', //创建出库申请审核 + wareHouseOutboundReviewUpdate: '/rpc/wareHouseOutboundReviewUpdate', //审核出库申请 + viewWareHouseOutboundReview: '/rpc/viewWareHouseOutboundReview', //查询出库记录审核 + conditionCheckInsert: "/rpc/conditionCheckInsert", //创建状况检查 + conditionCheckUpdate: "/rpc/conditionCheckUpdate", //修改状况检查 + conditionCheckDelete: "/rpc/conditionCheckDelete",//删除状况检查 + viewConditionCheck: "/rpc/viewConditionCheck",//查询状况检查 +}; + +export { artApi }; diff --git a/artCounty.js b/artCounty.js new file mode 100644 index 0000000..47f657b --- /dev/null +++ b/artCounty.js @@ -0,0 +1,9 @@ +class ArtCounty { + constructor(params = {}) { + this.id = params.id; + this.name = params.name; + this.alpha3Code = params.alpha_3_code; + } +} + +export default ArtCounty; diff --git a/artEnum.js b/artEnum.js new file mode 100644 index 0000000..547dc9d --- /dev/null +++ b/artEnum.js @@ -0,0 +1,12 @@ +export const artStatus = { + 0: '未入库', + 1: '已入库', + 2: '已出库', + 3: '修复中', +}; + +//入库记录状态 +export const godownEntryStatus = { + 0: '未签名', + 1: '已入库', +}; diff --git a/artImage.js b/artImage.js new file mode 100644 index 0000000..c2bfcd8 --- /dev/null +++ b/artImage.js @@ -0,0 +1,49 @@ +class ArtImage { + constructor(url) { + this.url = url; //原图路径 + } + + get compressionUrl() { + return formatCompression(this.url); + } + + get previewUrl() { + return formatPreview(this.url); + } +} + +function formatCompression(url) { + if (!url) return; + if (url.indexOf('blob:') !== -1) return url; //本地文件流直接放行 + if (url.indexOf('/compression/') !== -1) { + url = url.replace('/compression/', '/'); + } + if (url.indexOf('/preview/') !== -1) { + url = url.replace('/preview/', '/'); + } + let imgSrc = url; + let splitList = imgSrc.split('/'); + let fileName = splitList[splitList.length - 1]; + fileName = fileName.split('.')[0] + '.jpg'; //图片服务压缩过的图片统一都是jpg格式,因此这里需要更好图片后缀 + splitList.pop(); //移除掉文件名部分 + return splitList.join('/') + '/compression/' + fileName; +} + +//转化预览图路径 +function formatPreview(url) { + if (!url) return; + if (url.indexOf('blob:') !== -1) return url; //本地文件流直接放行 + if (url.indexOf('/preview/') !== -1) return url; + if (url.indexOf('/compression/') !== -1) { + url = url.replace('/compression/', '/'); + } + let imgSrc = url; + let splitList = imgSrc.split('/'); + let fileName = splitList[splitList.length - 1]; + fileName = fileName.split('.')[0] + '.jpg'; //图片服务压缩过的图片统一都是jpg格式,因此这里需要更好图片后缀 + splitList.pop(); //移除掉文件名部分 + + return splitList.join('/') + '/preview/' + fileName; +} + +export default ArtImage; diff --git a/artReport.js b/artReport.js new file mode 100644 index 0000000..b11b957 --- /dev/null +++ b/artReport.js @@ -0,0 +1,24 @@ +import CellsysApp from "@airkoon/cellsys/cellsysApp"; + +class ArtReport extends CellsysApp{ + constructor(params) { + super(params); + this.reportName = params.name; + this.artId = null; + this.artNumber = 1; + this.documentNumber = null; + let modelOptions = params.model_options; + if(modelOptions){ + this.artId = modelOptions.artworkId; + let reportInformation = modelOptions.reportInformation; + if(reportInformation){ + this.artNumber = reportInformation.artworkNumber; + this.documentNumber = reportInformation.documentNumber; + } + + } + + } +} + +export default ArtReport \ No newline at end of file diff --git a/artSystem.js b/artSystem.js new file mode 100644 index 0000000..18a7934 --- /dev/null +++ b/artSystem.js @@ -0,0 +1,285 @@ +import { Query, QueryTask, QueryType, Operator } from '@airkoon/cellsys/cellsysUtil.js'; +import ConditionReport from './conditionReport'; +import { artApi } from './artApi'; +import CellsysArt from './cellsysArt'; +import CellsysEventType from '@airkoon/cellsys/cellsysEventType'; +import ArtCounty from './artCounty'; +import { EditTask } from '@airkoon/cellsys/cellsysUtil'; + +class ArtSystem { + constructor(orgId) { } + static orgId = window.CELLSYSORG ? window.CELLSYSORG.id : null; + //查询艺术品材质字典 + static queryMaterials(params = {}) { + let query = new Query(); + let { filter } = params; + if (filter) { + filter.forEach((item) => { + query.addFilter(item['field'], item['operator'], item['value']); + }); + } + query.addFilter('dict_type', Operator.Equals, 'material'); + let queryTask = new QueryTask(QueryType.sysDictData, false); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + resolve(res); + }) + .catch((err) => { + reject(err); + }); + }); + } + //查询艺术品一级分类 + static queryArtCategoryOne() { + let query = new Query(); + query.addFilter('parent_id', Operator.Equals, 1); + query.setOrder({ sort: 'asc' }); + let queryTask = new QueryTask(QueryType.sysCategoryData, false); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + resolve(res); + }) + .catch((err) => { + reject(err); + }); + }); + } + static queryArtCategoryById(parentId) { + let query = new Query(); + query.addFilter('parent_id', Operator.Equals, parentId); + let queryTask = new QueryTask(QueryType.sysCategoryData, false); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + resolve(res); + }) + .catch((err) => { + reject(err); + }); + }); + } + //查询国家数据 + static queryCountry(params = {}) { + let query = new Query(); + let { pageInfo, order, filter } = params; + if (filter) { + filter.forEach((item) => { + query.addFilter(item['field'], item['operator'], item['value']); + }); + } + let queryTask = new QueryTask(artApi.country, !!pageInfo); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new ArtCounty(item); + }); + resolve(res); + } + } else { + let resArr = res.map((item) => { + return new ArtCounty(item); + }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + + //查询艺术片档案 + static queryArtworks(params = {}) { + let query = new Query(); + let { pageInfo, order, filter } = params; + + if (pageInfo) { + query.setCurrPage(pageInfo.currPage); + query.setPageSize(pageInfo.pageSize); + } + if (filter) { + filter.forEach((item) => { + query.addFilter(item['name'], item['operator'], item['value']); + }); + } + if (order) { + query.setOrder(order); + } else { + query.setOrder({ id: 'desc' }); + } + let queryTask = new QueryTask(artApi.artworkRecord, pageInfo ? true : false); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new CellsysArt(item); + }); + resolve(res); + } + } else { + let resArr = res.map((item) => { + return new CellsysArt(item); + }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + + //创建艺术品档案 + static createArtwork(params = {}) { + let editTask = new EditTask(artApi.artArtworkRecordInsert); + editTask.addParam('_oldname', params.oldName); + editTask.addParam('_countryId', params.country.id); + editTask.addParam('_countryCode', params.country.code); + editTask.addParam('_author', params.author); + editTask.addParam('_create_period', params.createPeriod); + editTask.addParam('_actual_number', params.actualNumber); + editTask.addParam('_length', params.length); + editTask.addParam('_width', params.width); + editTask.addParam('_height', params.height); + if (params.material) { + editTask.addParam('_material', params.material.dict_code); + } + if (params.categoryOne) { + editTask.addParam('_category_one', params.categoryOne.id); + editTask.addParam('_category_one_code', params.categoryOne.code); + } + if (params.categoryTwo) { + editTask.addParam('_category_two', params.categoryTwo.id); + editTask.addParam('_category_two_code', params.categoryTwo.code); + } + if (params.categoryThree) { + editTask.addParam('_category_three', params.categoryThree.id); + } + editTask.addParam('_original_registration_number', params.originalRegistrationNumber); + editTask.addParam('_remark', params.remarks); + editTask.addParam('_images', params.images); + return new Promise((resolve, reject) => { + editTask + .execute() + .then((res) => { + if (res.data) { + let cellsysArt = new CellsysArt(res.data); + resolve(cellsysArt); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + + //查询报告列表(应用列表) + static queryConditionsReports(params) { + if (!params) { + params = {}; + } + let query = new Query(); + let pageInfo = params.pageInfo; + let order = params.order; + if (pageInfo) { + query.setCurrPage(pageInfo.currPage); + query.setPageSize(pageInfo.pageSize); + } + if (order) { + query.setOrder(order); + } else { + query.setOrder({ id: 'desc' }); + } + // query.addFilter('model_id', Operator.Equals, 23); //病害报告模板 + let filter = params.filter; + if (filter) { + filter.forEach((item) => { + query.addFilter(item['name'], item['operator'], item['value']); //病害报告模板 + }); + } + let queryTask = new QueryTask(artApi.viewConditionCheck, pageInfo ? true : false); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new ConditionReport(item); + }); + resolve(res); + } + } else { + let resArr = res.map((item) => { + return new ConditionReport(item); + }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + + static queryArtworkByRepairId(params) { + let query = new Query(); + let artworkId = params.artworkId; + let eventSetId = params.eventSetId; + if (artworkId) { + query.addFilter('artwork.id', Operator.Equals, artworkId); //病害报告模板 + } + if (eventSetId) { + query.addFilter('event_set.id', Operator.Equals, eventSetId); //病害报告模板 + } + let queryTask = new QueryTask(artApi.artworkRepair, false); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + let resArr = res.map((item) => { + return new CellsysArt(item.artwork); + }); + resolve(resArr); + }) + .catch((err) => { + reject(err); + }); + }); + } + static queryArtworkEvent(params) { + let query = new Query(); + let artworkId = params.artworkId; + if (artworkId) { + query.addFilter('artwork.id', Operator.Equals, artworkId); //病害报告模板 + } + let queryTask = new QueryTask(artApi.artworkRepair, false); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + let resArr = res.map((item) => { + return new CellsysEventType(item.event_set); + }); + resolve(resArr); + }) + .catch((err) => { + reject(err); + }); + }); + } +} + +export default ArtSystem; diff --git a/artUser.js b/artUser.js new file mode 100644 index 0000000..19e7cdf --- /dev/null +++ b/artUser.js @@ -0,0 +1,9 @@ +import CellsysUser from '@airkoon/cellsys/cellsysUser.js'; + +class ArtUser extends CellsysUser { + constructor(params = {}) { + super(params); + } +} + +export default ArtUser; diff --git a/cellsysArt.js b/cellsysArt.js new file mode 100644 index 0000000..705dab3 --- /dev/null +++ b/cellsysArt.js @@ -0,0 +1,161 @@ +import ArtSystem from "./artSystem"; +import ArtImage from "./artImage"; +import { artStatus } from "./artEnum"; +import { + EditTask, + EditType, + Query, + QueryTask, +} from "@airkoon/cellsys/cellsysUtil"; +import { artApi } from "./artApi"; + +class CellsysArt { + constructor(params = {}) { + this.id = params.id; + this.oldName = params.old_name; //不带书名号 + this.recordNumber = params.record_number; + this.artworkName = params.artwork_name; + this.author = params.author; + this.createPeriod = params.create_period; + this.actualNumber = params.actual_number || 1; + this.materialId = params.material_id; + this.materialName = params.material_name; + this.countryId = params.country_id; + this.countryName = params.country_name; + this.length = params.length; + this.width = params.width; + this.height = params.height; + this.categoryOne = params.category_one; + this.categoryOneName = params.category_one_name; + this.categoryTwo = params.category_two; + this.categoryTwoName = params.category_two_name; + this.categoryThree = params.category_three; + this.categoryThreeName = params.category_three_name; + this.originalRegistrationNumber = params.original_registration_number; + this.remark = params.remark; + this.creator = params.creator; + this.updater = params.updater; + this.status = params.status; + this.artworkImages = []; + if (params.images) { + this.artworkImages = params.images.map((url) => { + return new ArtImage(url); + }); + } + this.tags = []; + if (params.tag_name) { + this.tags = params.tag_name.map((name) => { + return { name: name }; + }); + } + } + get oldNameFormat() { + //带书名号 + return `《${this.oldName}》`; + } + //封面图 + get coverImageUrl() { + if (this.artworkImages.length > 0) { + return this.artworkImages[0].compressionUrl; + } + } + + get artworkImagesUrl() { + if (this.artworkImages.length > 0) { + return this.artworkImages.map((artImage) => { + return artImage.url; + }); + } + } + + get statusMsg() { + return artStatus[this.status]; + } + + //查看艺术品详情 + getDetails() { + let editTask = new EditTask(artApi.artworkDetails); + editTask.addParam("_id", this.id); + return new Promise((resolve, reject) => { + editTask + .execute() + .then((res) => { + if (res.data) { + let cellsysArt = new CellsysArt(res.data); + //todo 详情字段填充 + resolve(cellsysArt); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + + //编辑艺术品档案 + updateArtwork(params = {}) { + let editTask = new EditTask(artApi.artArtworkRecordUpdate); + editTask.addParam("_id", params.id); + editTask.addParam("_oldname", params.oldName); + editTask.addParam("_author", params.author); + editTask.addParam("_create_period", params.createPeriod); + editTask.addParam("_length", params.length); + editTask.addParam("_width", params.width); + editTask.addParam("_height", params.height); + if (params.material) { + editTask.addParam("_material", params.material.dict_code); + } + editTask.addParam( + "_original_registration_number", + params.originalRegistrationNumber + ); + editTask.addParam("_remark", params.remarks); + editTask.addParam("_images", params.images); + return new Promise((resolve, reject) => { + editTask + .execute() + .then((res) => { + if (res.data) { + let cellsysArt = new CellsysArt(res.data); + resolve(cellsysArt); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + + //删除艺术品档案 + removeArtwork(params = {}) { + let editTask = new EditTask(artApi.artArtworkRecordDelete); + editTask.addParam("_id", this.id); + editTask.addParam("_password", params.password); + return new Promise((resolve, reject) => { + editTask + .execute() + .then((res) => { + resolve(res); + }) + .catch((err) => { + reject(err); + }); + }); + } + + queryEventlist() { + return new Promise((resolve, reject) => { + ArtSystem.queryArtworkEvent({ + artworkId: this.id, + }) + .then((res) => { + resolve(res); + }) + .catch((err) => { + reject(err); + }); + }); + } +} + +export default CellsysArt; diff --git a/conditionReport.js b/conditionReport.js new file mode 100644 index 0000000..02b8cf2 --- /dev/null +++ b/conditionReport.js @@ -0,0 +1,89 @@ +import artReport from './artReport'; +import ArtImage from './artImage'; +import {EditTask} from "@airkoon/cellsys/cellsysUtil"; +import {artApi} from "./artApi"; +import ReportBase from "./ReportBase"; + +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.tagName = params.tag_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 coverImageCompress() { + return this.coverImage.compressionUrl; + } + + + + + + + + static 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(); + } +} + +export default ConditionReport; diff --git a/godownEntry.js b/godownEntry.js new file mode 100644 index 0000000..f89b8cb --- /dev/null +++ b/godownEntry.js @@ -0,0 +1,162 @@ +import { EditTask, Query, QueryTask } from '@airkoon/cellsys/cellsysUtil'; +import { artApi } from './artApi'; +import { formatterMillisecond } from './utils/date'; +import { godownEntryStatus } from './artEnum'; + +//入库记录 +class GodownEntry { + constructor(params = {}) { + this.id = params.id; + this.status = params.status; + this.number = params.number; + this.artworkRecordId = params.artwork_record_id; //艺术品档案id + this.entryTime = params.entry_time; //入库时间 + this.client = params.client; //委托方 + this.contractor = params.contractor; //接收方 + this.stand = params.stand; //支架 + this.packingType = params.packing_type; //装箱类型 + this.support = params.support; //支撑物 + this.remark = params.remark; //备注 + this.images = params.images || []; //现场照片 + this.conditionIssues = params.condition_issues || null; //病害信息 + this.conditionIssuesImages = params.condition_issues_images + ? params.condition_issues_images.map((item) => { + return { + original: item.original || null, //原图 + graphing: item.graphing || null, //遮罩层 + superposition: item.superposition || null, //合并 + }; + }) + : []; //病害图 original graphing superposition + this.wareHouseId = params.ware_house_id; //仓库id + let wareHouse = params.ware_house; + if (wareHouse) { + this.wareHouseName = wareHouse.name; //仓库 + } else { + this.wareHouseName = null; + } + + this.clientSignatureImage = params.client_signature_image || null; // 委托方签名; + this.contractorSignatureImage = params.contractor_signature_image || null; //接收方签名 + let artworkRecord = params.artwork_record; + if (artworkRecord) { + this.artworkRecord = { + recordNumber: artworkRecord.record_number, + author: artworkRecord.author, + oldName: artworkRecord.old_name, + creationPeriodEnd: artworkRecord.creation_period_end, + creationPeriodStart: artworkRecord.creation_period_start, + width: artworkRecord.width, + height: artworkRecord.height, + length: artworkRecord.length, + materialId: artworkRecord.material_id, + }; + } else { + this.artworkRecord = { + recordNumber: null, + author: null, + oldName: null, + creationPeriodEnd: null, + creationPeriodStart: null, + width: null, + height: null, + length: null, + materialId: null, + }; + } + } + get statusMsg() { + return godownEntryStatus[this.status]; + } + get entryTimeFormat() { + return formatterMillisecond(this.entryTime); + } + + static createWareHouseEntry(params) { + let editTask = new EditTask(artApi.wareHouseEntryInsert); + editTask.addParam('_artwork_record_id', params.artworkRecordId); + editTask.addParam('_entry_time', params.entryTime); + editTask.addParam('_client', params.client); + editTask.addParam('_contractor', params.contractor); + editTask.addParam('_stand', params.stand); + editTask.addParam('_packing_type', params.packingType); + editTask.addParam('_support', params.support); + editTask.addParam('_remark', params.remark); + editTask.addParam('_images', params.images); + editTask.addParam('_condition_issues', params.conditionIssues); + editTask.addParam('_condition_issues_images', params.conditionIssuesImages); + editTask.addParam('_ware_house_id', params.wareHouseId); + editTask.addParam('_client_signature_image', params.clientSignatureImage); + editTask.addParam('_contractor_signature_image', params.contractorSignatureImage); + + return editTask.execute(); + } + static queryWareHouseEntry(params = {}) { + let { pageInfo, order, filters } = params; + let query = new Query(); + if (pageInfo) { + query.setCurrPage(pageInfo.currPage); + query.setPageSize(pageInfo.pageSize); + } + if (filters && filters.length > 0) { + filters.forEach((item) => { + query.addFilter(item['name'], item['operator'], item['value']); + }); + } + if (order) { + query.setOrder(order); + } else { + query.setOrder({ id: 'desc' }); + } + let queryTask = new QueryTask(artApi.viewWareHouseEntry, pageInfo); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new GodownEntry(item); + }); + resolve(res); + } + } else { + let resArr = res.map((item) => { + return new GodownEntry(item); + }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + static updateWareHouseEntry(params) { + let editTask = new EditTask(artApi.wareHouseEntryUpdate); + + editTask.addParam('_id', params.id); + editTask.addParam('_status', params.status); + editTask.addParam('_entry_time', params.entryTime); + editTask.addParam('_client', params.client); + editTask.addParam('_contractor', params.contractor); + editTask.addParam('_stand', params.stand); + editTask.addParam('_packing_type', params.packingType); + editTask.addParam('_support', params.support); + editTask.addParam('_remark', params.remark); + editTask.addParam('_images', params.images); + editTask.addParam('_condition_issues', params.conditionIssues); + editTask.addParam('_condition_issues_images', params.conditionIssuesImages); + editTask.addParam('_ware_house_id', params.wareHouseId); + editTask.addParam('_client_signature_image', params.clientSignatureImage); + editTask.addParam('_contractor_signature_image', params.contractorSignatureImage); + + return editTask.execute(); + } + deleteWareHouseEntry() { + let editTask = new EditTask(artApi.wareHouseEntryDelete); + editTask.addParam('_id', this.id); + return editTask.execute(); + } +} +export default GodownEntry; diff --git a/outBoundReview.js b/outBoundReview.js new file mode 100644 index 0000000..0ceb93d --- /dev/null +++ b/outBoundReview.js @@ -0,0 +1,76 @@ +import { EditTask, Query, QueryTask } from '@airkoon/cellsys/cellsysUtil'; +import { artApi } from './artApi'; + +class OutBoundReview { + constructor(params) { + this.id = params.id; + this.artworkRecordName = params.artwork_record_name; //艺术品档 + this.artworkRecordNumber = params.artwork_record_number; //艺术品 + this.wareHouseOutboundId = params.ware_house_outbound_id; + this.reviewerSignatureImage = params.reviewer_signature_image; + this.status = params.status; + this.destination = params.destination; + this.remark = params.remark; + 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; + } + static createWareHouseOutboundReview(params) { + let editTask = new EditTask(artApi.wareHouseOutboundReviewInsert); + editTask.addParam('_ware_house_outbound_id', params.id); + return editTask.execute(); + } + static updateWarehouseOutboundReview(params) { + let editTask = new EditTask(artApi.wareHouseOutboundReviewUpdate); + editTask.addParam('_id', params.id); + editTask.addParam('_reviewer_signature_image', params.reviewerSignatureImage); + editTask.addParam('_status', params.status); + editTask.addParam('_remark', params.remark); + return editTask.execute(); + } + static queryWarehouseOutboundReview(params) { + let { pageInfo, order, filters } = params; + let query = new Query(); + if (pageInfo) { + query.setCurrPage(pageInfo.currPage); + query.setPageSize(pageInfo.pageSize); + } + if (filters && filters.length > 0) { + filters.forEach((item) => { + query.addFilter(item['name'], item['operator'], item['value']); + }); + } + if (order) { + query.setOrder(order); + } else { + query.setOrder({ id: 'desc' }); + } + let queryTask = new QueryTask(artApi.viewWareHouseOutboundReview, pageInfo); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new OutBoundReview(item); + }); + resolve(res); + } + } else { + let resArr = res.map((item) => { + return new OutBoundReview(item); + }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); + }); + }); + } +} +export default OutBoundReview; diff --git a/outbound.js b/outbound.js new file mode 100644 index 0000000..1d776d3 --- /dev/null +++ b/outbound.js @@ -0,0 +1,151 @@ +import { EditTask, Query, QueryTask } from '@airkoon/cellsys/cellsysUtil'; +import { artApi } from './artApi'; +import CellsysArt from './cellsysArt'; + +class Outbound { + constructor(params) { + if (!params) { + params = {}; + } + this.id = params.id; + this.status = params.status; + this.number = params.number; + this.artworkRecordId = params.artwork_record_id; //艺术品档案Id + this.applicant = params.applicant; //出库申请人 + this.recipient = params.recipient; //签收人 + this.recipientSignatureimage = params.recipient_signature_image; //签收人签名图片 + this.reason = params.reason; //出库原因 + this.images = params.images; //附件图片 + this.applicationTime = params.application_time; //申请时间 + this.remark = params.remark; //备注 + this.destination = params.destination; //目的地 + this.destinationGeometry = params.destination_geometry; //目的地坐标 + this.outboundTime = params.outbound_time === 0 ? null : params.outbound_time; //出库时间 + let artworkRecord = params.artwork_record; + if (artworkRecord) { + this.artworkRecord = { + recordNumber: artworkRecord.record_number, + author: artworkRecord.author, + oldName: artworkRecord.old_name, + creationPeriodEnd: artworkRecord.creation_period_end, + creationPeriodStart: artworkRecord.creation_period_start, + width: artworkRecord.width, + height: artworkRecord.height, + length: artworkRecord.length, + materialId: artworkRecord.material_id, + }; + } else { + this.artworkRecord = { + recordNumber: null, + author: null, + oldName: null, + creationPeriodEnd: null, + creationPeriodStart: null, + width: null, + height: null, + length: null, + materialId: null, + }; + } + this.createTime = params.create_time; + this.updateTime = params.update_time; + let creator = params.creator; + this.creator = { + memberId: null, + name: null, + }; + if (creator) { + this.creator = { + memberId: creator.member_id, + name: creator.name, + }; + } + let updater = params.updater; + this.updater = { + memberId: null, + name: null, + }; + if (updater) { + this.updater = { + memberId: updater.member_id, + name: updater.name, + }; + } + //审批 + this.reviewer = params.reviewer; + this.reviewerId = params.reviewer_id; + this.reviewerSignatureimage = params.reviewer_signature_image; + } + static cerateWarehouseOut(params) { + let editTask = new EditTask(artApi.wareHouseOutboundInsert); + editTask.addParam('_artwork_record_id', params.artworkRecordId); + editTask.addParam('_recipient', params.recipient); + editTask.addParam('_recipient_signature_image', params.recipientSignatureimage); + editTask.addParam('_reason', params.reason); + editTask.addParam('_images', params.images); + editTask.addParam('_remark', params.remark); + editTask.addParam('_destination', params.destination); + editTask.addParam('_destination_geometry', params.destinationGeometry); + return editTask.execute(); + } + static updateWarehouseOut(params) { + let editTask = new EditTask(artApi.wareHouseOutboundUpdate); + editTask.addParam('_id', params.id); + editTask.addParam('_artwork_record_id', params.artworkRecordId); + editTask.addParam('_recipient', params.recipient); + editTask.addParam('_recipient_signature_image', params.recipientSignatureimage); + editTask.addParam('_reason', params.reason); + editTask.addParam('_images', params.images); + editTask.addParam('_remark', params.remark); + editTask.addParam('_destination', params.destination); + editTask.addParam('_destination_geometry', params.destinationGeometry); + return editTask.execute(); + } + static deteleWareHouseOut(params) { + let editTask = new EditTask(artApi.wareHouseOutboundDelete); + editTask.addParam('_id', params.id); + return editTask.execute(); + } + static queryWarehouseOut(params) { + let { pageInfo, order, filters } = params; + let query = new Query(); + if (pageInfo) { + query.setCurrPage(pageInfo.currPage); + query.setPageSize(pageInfo.pageSize); + } + if (filters && filters.length > 0) { + filters.forEach((item) => { + query.addFilter(item['name'], item['operator'], item['value']); + }); + } + if (order) { + query.setOrder(order); + } else { + query.setOrder({ id: 'desc' }); + } + let queryTask = new QueryTask(artApi.viewWareHouseOutbound, pageInfo); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new Outbound(item); + }); + resolve(res); + } + } else { + let resArr = res.map((item) => { + return new Outbound(item); + }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); + }); + }); + } +} +export default Outbound; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e23cc00 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,120 @@ +{ + "name": "@airkoon/cellsysArt", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@airkoon/cellsysArt", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@airkoon/cellsys": "git+http://ag:12345678@8.134.38.106:3000/ag/cellsys.git#v1.15.3", + "dayjs": "~1.10.6" + } + }, + "node_modules/@airkoon/cellsys": { + "version": "1.15.3", + "resolved": "git+http://ag:12345678@8.134.38.106:3000/ag/cellsys.git#55f40b09e8364b2576a810436c7bf866d3606de9", + "dependencies": { + "canvg": "~3.0.7" + } + }, + "node_modules/@babel/runtime": { + "version": "7.26.0", + "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, + "node_modules/@types/raf": { + "version": "3.4.3", + "resolved": "https://registry.npmmirror.com/@types/raf/-/raf-3.4.3.tgz", + "integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==" + }, + "node_modules/canvg": { + "version": "3.0.10", + "resolved": "https://registry.npmmirror.com/canvg/-/canvg-3.0.10.tgz", + "integrity": "sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==", + "dependencies": { + "@babel/runtime": "^7.12.5", + "@types/raf": "^3.4.0", + "core-js": "^3.8.3", + "raf": "^3.4.1", + "regenerator-runtime": "^0.13.7", + "rgbcolor": "^1.0.1", + "stackblur-canvas": "^2.0.0", + "svg-pathdata": "^6.0.3" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/core-js": { + "version": "3.39.0", + "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.39.0.tgz", + "integrity": "sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==", + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/dayjs": { + "version": "1.10.8", + "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.10.8.tgz", + "integrity": "sha512-wbNwDfBHHur9UOzNUjeKUOJ0fCb0a52Wx0xInmQ7Y8FstyajiV1NmK1e00cxsr9YrE9r7yAChE0VvpuY5Rnlow==" + }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, + "node_modules/raf": { + "version": "3.4.1", + "resolved": "https://registry.npmmirror.com/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "dependencies": { + "performance-now": "^2.1.0" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "node_modules/rgbcolor": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/rgbcolor/-/rgbcolor-1.0.1.tgz", + "integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==", + "engines": { + "node": ">= 0.8.15" + } + }, + "node_modules/stackblur-canvas": { + "version": "2.7.0", + "resolved": "https://registry.npmmirror.com/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz", + "integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==", + "engines": { + "node": ">=0.1.14" + } + }, + "node_modules/svg-pathdata": { + "version": "6.0.3", + "resolved": "https://registry.npmmirror.com/svg-pathdata/-/svg-pathdata-6.0.3.tgz", + "integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==", + "engines": { + "node": ">=12.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..a0b74aa --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "@airkoon/cellsysArt", + "version": "1.0.0", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "description": "美院相关", + "dependencies": { + "@airkoon/cellsys": "git+http://ag:12345678@8.134.38.106:3000/ag/cellsys.git#v1.15.3", + "dayjs": "~1.10.6" + } +} diff --git a/repairEvent.js b/repairEvent.js new file mode 100644 index 0000000..c2f431f --- /dev/null +++ b/repairEvent.js @@ -0,0 +1,13 @@ +import cellsysEventType from "@airkoon/cellsys/cellsysEventType"; + +class RepairEventSet extends cellsysEventType { + constructor(params) { + super(params); + } + + queryArtwork(){ + + } +} + +export default RepairEventSet \ No newline at end of file diff --git a/utils/date.js b/utils/date.js new file mode 100644 index 0000000..a5828b3 --- /dev/null +++ b/utils/date.js @@ -0,0 +1,173 @@ +/** + * @Author YuanWei + * @Date 2021/01/13 17:39:28 + * @FileName date.js + * @Description: 时间工具类 + */ +import dayjs from 'dayjs'; +import 'dayjs/locale/zh-cn'; + +// import localeData from 'dayjs/plugin/localeData' +import isSameOrAfterPlugin from 'dayjs/plugin/isSameOrAfter'; +import isSameOrBeforePlugin from 'dayjs/plugin/isSameOrBefore'; + +dayjs.locale('zh-cn'); +// dayjs.extend(localeData) +dayjs.extend(isSameOrAfterPlugin); +dayjs.extend(isSameOrBeforePlugin); + +const dateFormat = { + DATE_PATTERN_FLAT: 'YYYY-MM-DD HH:mm:ss', +}; + +/** + * 检查时间字段,字符串则转换为日期对象 + * @param param + * @returns {Date} + */ +const transformParam = function (param) { + return typeof param === 'string' ? new Date(param) : param; +}; + +/** + * 获取当天开始时间 + * @returns {Date} + */ +export const getToDayDate = function () { + return dayjs().startOf('day').toDate(); +}; + +/** + * 获取指定日期的开始日期部分时间 + * @param date + */ +export const getDayDate = function (date) { + return dayjs(transformParam(date)).startOf('day').toDate(); +}; + +/** + * 格式化时间 + * @param date 需要格式化的时间(string|Date) + * @param format 时间格式 + * @returns {string} 返回字符串时间 + */ +export function formatterDate(date, format = dateFormat.DATE_PATTERN_FLAT) { + return dayjs(transformParam(date)).format(format); +} + +/** + * 格式化秒 + * @param second + * @param format + * @returns {string} + */ +export function formatterSecond(second, format = dateFormat.DATE_PATTERN_FLAT) { + return dayjs(new Date(second * 1000)).format(format); +} + +/** + * 格式化毫秒 + * @param millisecond + * @param format + * @returns {string} + */ +export function formatterMillisecond(millisecond, format = dateFormat.DATE_PATTERN_FLAT) { + return dayjs(new Date(millisecond)).format(format); +} + +/** + * 格式化秒或毫秒 + * @param time + * @param format + */ +export function formatterSecondOrMillisecond(time, format = dateFormat.DATE_PATTERN_FLAT) { + let length = String(time).length; + let temp; + try { + temp = parseInt(time); + } catch (e) { + return null; + } + //判断时间是否为负数(小于1970) + if (temp > 0) { + if (length === 13) { + //毫秒级 + return formatterMillisecond(temp, format); + } else if (length === 10) { + //秒级 + return formatterSecond(temp, format); + } else { + return null; + } + } else { + //因为多了负号所以长度加1 + if (length === 14) { + //毫秒级 + return formatterMillisecond(temp, format); + } else if (length === 11) { + //秒级 + return formatterSecond(temp, format); + } else { + return null; + } + } + + // throw new Error('time not is second or millisecond') +} + +/** + * 判断时间是否是今天 + * @param date + * @returns {boolean} + */ +export function isToDay(date) { + return dayjs(new Date()).isSame(transformParam(date), 'day'); +} + +/** + * 是否在今天之前 + * @param date + */ +export function isToDayOrBefore(date) { + return dayjs(new Date()).isSameOrBefore(transformParam(date), 'day'); +} + +/** + * 是否在今天之后 + * @param date + */ +export function isToDayOrAfter(date) { + return dayjs(new Date()).isSameOrAfter(transformParam(date), 'day'); +} + +/** + * 解析日期,返回一个date对象 + * @param date + * @param format + * @returns {Date} + */ +export function parseDate(date, format = dateFormat.DATE_PATTERN_FLAT) { + return dayjs(date, format).toDate(); +} + +/** + * 获取指定日期所在的周一时间 + * @param date + * @returns {Date} + */ +export function getWeekMonday(date) { + return dayjs(transformParam(date)).startOf('week').toDate(); +} +/*毫秒时间戳转换为 “xxxx年xx月xx日” 格式的代码:*/ +export function formatMillisecondsToChineseDateString(milliseconds) { + // 创建一个新的Date对象,使用传入的毫秒时间戳 + const date = new Date(milliseconds); + + // 获取年、月、日 + const year = date.getFullYear(); + const month = date.getMonth() + 1; // getMonth() 返回的月份是从0开始的,所以需要加1 + const day = date.getDate(); + + // 返回格式化的日期字符串 + return `${year}年${month}月${day}日`; +} diff --git a/wareHouse.js b/wareHouse.js new file mode 100644 index 0000000..95a124a --- /dev/null +++ b/wareHouse.js @@ -0,0 +1,101 @@ +import { EditTask, Query, QueryTask } from '@airkoon/cellsys/cellsysUtil'; +import { artApi } from './artApi'; + +class Warehouse { + constructor(params) { + if (!params) { + params = {}; + } + this.orgId = params.org_id; + this.orgName = params.org_name; + this.id = params.id; + this.name = params.name; + this.type = params.type; + this.status = params.status; + this.action = params.action || 0; + this.bufferDistance = params.buffer_distance || 0; + this.radius = params.radius || 0; + this.geometry = params.geometry; + this.typeName = params.type_name; + this.style = params.style ? params.style : {}; + this.description = params.description; + } + static createWarehouse(params) { + let editTask = new EditTask(artApi.wareHouseInsert); + editTask.addParam('_name', params.name); + editTask.addParam('_description', params.description); + editTask.addParam('_geometry', params.geometry); + editTask.addParam('_type', params.type); + editTask.addParam('_status', 1); + editTask.addParam('_action', params.action); + editTask.addParam('_buffer_distance', params.bufferDistance); + editTask.addParam('_radius', params.radius); + return editTask.execute(); + } + static updateWarehouse(params) { + let editTask = new EditTask(artApi.wareHouseUpdate); + editTask.addParam('_type', params.type); + editTask.addParam('_id', params.id); + editTask.addParam('_geometry', params.geometry); + editTask.addParam('_name', params.name); + editTask.addParam('_description', params.description); + editTask.addParam('_action', params.action); + editTask.addParam('_status', 1); + editTask.addParam('_buffer_distance', params.bufferDistance); + editTask.addParam('_radius', params.radius); + return editTask.execute(); + } + static deleteWarehouse(params) { + let editTask = new EditTask(artApi.wareHouseDelete); + editTask.addParam('_id', params.id); + return editTask.execute(); + } + static queryWarehouse(pageInfo, filters, order) { + let query = new Query(); + if (pageInfo) { + query.setCurrPage(pageInfo.currPage); + query.setPageSize(pageInfo.pageSize); + } + if (filters && filters.length > 0) { + filters.forEach((item) => { + query.addFilter(item['name'], item['operator'], item['value']); + }); + } + if (order) { + query.setOrder(order); + } else { + query.setOrder({ id: 'desc' }); + } + let queryTask = new QueryTask(artApi.viewWareHouse, pageInfo); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new Warehouse(item); + }); + resolve(res); + } + } else { + let resArr = res.map((item) => { + return new Warehouse(item); + }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + static countArtworkInWareHouse(params) { + // let query = new Query(); + let editTask = new EditTask(artApi.countInWareHouse); + editTask.addParam('_id', params.id); + editTask.addParam('_type', params.type); + return editTask.execute(); + } +} +export default Warehouse; diff --git a/wareHouseType.js b/wareHouseType.js new file mode 100644 index 0000000..4a53a3f --- /dev/null +++ b/wareHouseType.js @@ -0,0 +1,100 @@ +import { CellsysMarkerStyle } from '@airkoon/cellsys/cellsysStyle'; +import { EditTask, Query, QueryTask } from '@airkoon/cellsys/cellsysUtil'; +import { artApi } from './artApi'; + +class WareHouseType { + constructor(params) { + if (!params) { + params = {}; + } + this.id = params.id; + this.orgId = params.org_id; + this.name = params.name; + this.typeCount = params.type_count; + this.description = params.description; + this.style = params.style ? params.style : CellsysMarkerStyle.getDefaultStyle(); + let creator = params.creator; + this.creator = { + memberId: null, + name: null, + }; + if (creator) { + this.creator = { + memberId: creator.member_id, + name: creator.name, + }; + } + let updater = params.updater; + this.updater = { + memberId: null, + name: null, + }; + if (updater) { + this.updater = { + memberId: updater.member_id, + name: updater.name, + }; + } + } + static createWareHouseType(params) { + let editTask = new EditTask(artApi.wareHouseTypeInsert); + editTask.addParam('_name', params.name); + editTask.addParam('_description', params.description); + editTask.addParam('_style', params.style); + return editTask.execute(); + } + static updateWareHouseType(params) { + let editTask = new EditTask(artApi.wareHouseTypeUpdate); + editTask.addParam('_id', params.id); + editTask.addParam('_name', params.name); + editTask.addParam('_description', params.description); + editTask.addParam('_style', params.style); + return editTask.execute(); + } + static deleteWareHouseType(params) { + let editTask = new EditTask(artApi.wareHouseTypeDelete); + editTask.addParam('_id', params.id); + return editTask.execute(); + } + static queryWareHouseType(pageInfo, filters, order) { + let query = new Query(); + if (pageInfo) { + query.setCurrPage(pageInfo.currPage); + query.setPageSize(pageInfo.pageSize); + } + if (filters && filters.length > 0) { + filters.forEach((item) => { + query.addFilter(item['name'], item['operator'], item['value']); + }); + } + if (order) { + query.setOrder(order); + } else { + query.setOrder({ id: 'desc' }); + } + let queryTask = new QueryTask(artApi.viewWareHouseType, pageInfo); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new WareHouseType(item); + }); + resolve(res); + } + } else { + let resArr = res.map((item) => { + return new WareHouseType(item); + }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); + }); + }); + } +} +export default WareHouseType;