diff --git a/artApi.js b/artApi.js index 5c7acd4..a3e4dfb 100644 --- a/artApi.js +++ b/artApi.js @@ -1,37 +1,44 @@ 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",//查询状况检查 - viewRepairRecord:"/rpc/viewRepairRecord" //查询修复档案列表 + 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", //查询状况检查 + viewRepairRecord: "/rpc/viewRepairRecord", //查询修复档案列表 + repairRecordInsert: "/rpc/repairRecordInsert", //创建修复档案 + repairRecordUpdate: "/rpc/repairRecordUpdate", //编辑修复档案 + repairRecordDelete: "/rpc/repairRecordDelete", //删除修复档案 + viewRepairPlan: "/rpc/viewRepairPlan", //修复档案发起归档 + repairPlanInsert: "/rpc/repairPlanInsert", //创建修复方案 + repairPlanUpdate: "/rpc/repairPlanUpdate", //修改修复方案 + repairPlanDelete: "/rpc/repairPlanDelete", //删除修复方案 }; export { artApi }; diff --git a/artEnum.js b/artEnum.js index 547dc9d..0ace892 100644 --- a/artEnum.js +++ b/artEnum.js @@ -1,12 +1,20 @@ export const artStatus = { - 0: '未入库', - 1: '已入库', - 2: '已出库', - 3: '修复中', + 1: "未入库", + 2: "已入库", + 3: "已出库", + 4: "修复中", }; //入库记录状态 export const godownEntryStatus = { - 0: '未签名', - 1: '已入库', + 0: "未签名", + 1: "已入库", }; +//0-未审核 1-审核中 2-审核通过 3-审核不通过 4-方案变更 +export const artRepairPlanStatus = { + 0:'未审核', + 1:'审核中', + 2:'审核通过', + 3:'审核不通过', + 4:'方案变更' +} \ No newline at end of file diff --git a/artRepairEvent.js b/artRepairEvent.js new file mode 100644 index 0000000..ef609b9 --- /dev/null +++ b/artRepairEvent.js @@ -0,0 +1,16 @@ +import ArtImage from "./artImage"; + +class ArtRepairEvent { + constructor(params = {}) { + this.id = params.id; + this.name = params.name; + this.description = params.description; + + this.creator = params.creator; + this.updater = params.updater; + this.createTime = params.create_time; + this.updateTime = params.update_time; + } +} + +export default ArtRepairEvent; diff --git a/artRepairFile.js b/artRepairFile.js index d6e32e1..ac01ceb 100644 --- a/artRepairFile.js +++ b/artRepairFile.js @@ -1,12 +1,126 @@ -class ArtRepairFile { - constructor(params={}) { - this.id = params.id; - this.name = params.name; - this.description = params.description; - this.conditionCheckId = params.condition_check_id; //关联的状况检查记录id - this.artworkRecordId = params.artwork_record_id; //关联的艺术品id - } +import ArtImage from "./artImage"; +import { formatterMillisecond } from "./utils/date"; +import { artApi } from "./artApi"; +import { + EditTask, + Operator, + Query, + QueryTask, +} from "@airkoon/cellsys/cellsysUtil"; +import ConditionReport from "./conditionReport"; +import ArtRepairPlan from "./artRepairPlan"; +class ArtRepairFile { + constructor(params = {}) { + this.id = params.id; + this.name = params.name; + this.description = params.description; + this.conditionCheckId = params.condition_check_id; //关联的状况检查记录id + this.creator = params.creator; + this.updater = params.updater; + this.createTime = params.create_time; + this.updateTime = params.update_time; + this.artworkRecord = { + artworkRecordId: params.artwork_record_id, //关联的艺术品id + }; + if (params.artwork_record) { + let { record_number, old_name, images } = params.artwork_record; + this.artworkRecord["recordNumber"] = record_number; + this.artworkRecord["oldName"] = old_name; + this.artworkRecord["artworkImages"] = images.map((url) => { + return new ArtImage(url); + }); + } + this.tags = []; + if (params.tag_name) { + this.tags = params.tag_name.map((name) => { + return { name: name }; + }); + } + } + + //艺术品封面图 + get coverImageUrl() { + if (this.artworkRecord && this.artworkRecord["artworkImages"].length > 0) { + return this.artworkRecord["artworkImages"][0].compressionUrl; + } + } + + //艺术品封面图 + get oldNameFormat() { + return `《${this.artworkRecord["oldName"]}》`; + } + + get updateTimeFormat() { + return formatterMillisecond(this.updateTime); + } + + queryConditionReport() { + if (!this.conditionCheckId) { + throw new Error("没有状况检查记录信息!"); + } + let query = new Query(); + + query.addFilter("id", Operator.Equals, this.conditionCheckId); //病害报告模板 + let queryTask = new QueryTask(artApi.viewConditionCheck, false); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + let resArr = res.map((item) => { + return new ConditionReport(item); + }); + resolve(resArr); + }) + .catch((err) => { + reject(err); + }); + }); + } + + //更新修复档案信息 + updateRepairFile(params = {}) { + let { name, description, conditionCheckId } = params; + let editTask = new EditTask(artApi.repairRecordUpdate); + editTask.addParam("_id", this.id); + editTask.addParam("_description", description); + editTask.addParam("_name", name); + editTask.addParam("_condition_check_id", conditionCheckId); + debugger; + return new Promise((resolve, reject) => { + editTask + .execute() + .then((res) => { + if (res.data) { + let artRepairFile = new ArtRepairFile(res.data); + resolve(artRepairFile); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + //创建修复方案 + createRepairPlan(params) { + let editTask = new EditTask(artApi.repairPlanInsert); + editTask.addParam('_repair_record_id', this.id); + editTask.addParam('_name', params.name); + editTask.addParam('_repair_nodes', params.repairNodes); + return new Promise((resolve, reject) => { + editTask + .execute() + .then((res) => { + if (res.data) { + let artRepairFile = new ArtRepairPlan(res.data); + resolve(artRepairFile); + } + }) + .catch((err) => { + reject(err); + }); + }); + } } -export default ArtRepairFile \ No newline at end of file +export default ArtRepairFile; diff --git a/artRepairPlan.js b/artRepairPlan.js new file mode 100644 index 0000000..181b817 --- /dev/null +++ b/artRepairPlan.js @@ -0,0 +1,77 @@ +import ArtImage from "./artImage"; +import {formatterMillisecond} from "./utils/date"; +import {EditTask} from "@airkoon/cellsys/cellsysUtil"; +import {artApi} from "./artApi"; +import {artRepairPlanStatus} from "./artEnum"; + +class ArtRepairPlan { + constructor(params = {}) { + + this.id = params.id; + this.name = params.name; + this.repairRecordId = params.repair_record_id; + this.repairNodes = params.repair_nodes; + this.creatorSignatureImage = params.creator_signature_image; + this.status = params.status; + this.creator = params.creator; + this.updater = params.updater; + this.createTime = params.create_time; + this.updateTime = params.update_time; + this.artworkRecord = { + artworkRecordId: params.artwork_record_id, //关联的艺术品id + }; + if (params.artwork_record) { + let { record_number, old_name, images } = params.artwork_record; + this.artworkRecord["recordNumber"] = record_number; + this.artworkRecord["oldName"] = old_name; + this.artworkRecord["artworkImages"] = images.map((url) => { + return new ArtImage(url); + }); + } + } + //艺术品封面图 + get coverImageUrl() { + if (this.artworkRecord && this.artworkRecord["artworkImages"].length > 0) { + return this.artworkRecord["artworkImages"][0].compressionUrl; + } + } + + //艺术品封面图 + get oldNameFormat() { + return `《${this.artworkRecord["oldName"]}》`; + } + + get updateTimeFormat() { + return formatterMillisecond(this.updateTime); + } + get statusMsg() { + return artRepairPlanStatus[this.status]; + } + updateRepairPlan(params={}){ + let editTask = new EditTask(artApi.repairPlanUpdate); + editTask.addParam("_id", this.id); + editTask.addParam("_repair_record_id", params.repairRecordId); + editTask.addParam("_name", params.name); + editTask.addParam("_repair_nodes", params.repairNodes); + return new Promise((resolve, reject) => { + editTask + .execute() + .then((res) => { + if (res.data) { + let artRepairFile = new ArtRepairPlan(res.data); + resolve(artRepairFile); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + deleteRepairPlan(){ + let editTask = new EditTask(artApi.repairPlanDelete); + editTask.addParam("_id", this.id); + return editTask.execute() + } + +} +export default ArtRepairPlan; \ No newline at end of file diff --git a/artSystem.js b/artSystem.js index 9dc5c86..b4e1dec 100644 --- a/artSystem.js +++ b/artSystem.js @@ -1,321 +1,384 @@ -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'; +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"; import ArtRepairFile from "./artRepairFile"; +import ArtRepairPlan from "./artRepairPlan"; +import * as http from "@airkoon/cellsys/utils/axios"; 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']); + 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["name"], 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["name"], 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); }); - } - 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); - }); + 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); } - //查询艺术品一级分类 - 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); - }); - }); + if (filter) { + filter.forEach((item) => { + query.addFilter(item["name"], item["operator"], item["value"]); + }); } - 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); - }); - }); + if (order) { + query.setOrder(order); + } else { + query.setOrder({ id: "desc" }); } - //查询国家数据 - 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.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); }); - } - 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); - }); + 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 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']); + //查询报告列表(应用列表) + 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); }); - } - 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); - }); + 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 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); //病害报告模板 } - - //查询报告列表(应用列表) - 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.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); + }); + }); + } + //查询系统修复档案列表 + static queryRepairFiles(params) { + let query = new Query(); + let { filter, pageInfo } = params; + if (filter) { + filter.forEach((item) => { + query.addFilter(item["name"], item["operator"], item["value"]); + }); + } + let queryTask = new QueryTask(artApi.viewRepairRecord, !!pageInfo); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new ArtRepairFile(item); + }); + resolve(res); + } else { + reject(new Error("修复档案数据格式异常")); + } + } else { + let resArr = res.map((item) => { + return new ArtRepairFile(item); }); - } - 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); - }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); }); + }); + } + static queryRepairPlan(params) { + let query = new Query(); + let { filter, pageInfo } = params; + if (filter) { + filter.forEach((item) => { + query.addFilter(item["name"], item["operator"], item["value"]); + }); } - - 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); - }); - }); - } - //查询系统修复档案列表 - static queryRepairFiles(params){ - let query = new Query(); - let { filter,pageInfo } = params; - if (filter) { - filter.forEach((item) => { - query.addFilter(item['field'], item['operator'], item['value']); + let queryTask = new QueryTask(artApi.viewRepairPlan, !!pageInfo); + return new Promise((resolve, reject) => { + queryTask + .execute(query) + .then((res) => { + if (pageInfo) { + if (res.data) { + res.data = res.data.map((item) => { + return new ArtRepairPlan(item); + }); + resolve(res); + } else { + reject(new Error("修复方案数据格式异常")); + } + } else { + let resArr = res.map((item) => { + return new ArtRepairPlan(item); }); - } - let queryTask = new QueryTask(artApi.viewRepairRecord, !!pageInfo); - return new Promise((resolve, reject) => { - queryTask - .execute(query) - .then((res) => { - if (pageInfo) { - if (res.data) { - res.data = res.data.map((item) => { - return new ArtRepairFile(item); - }); - resolve(res); - }else{ - reject(new Error("修复档案数据格式异常")); - } - } else { - let resArr = res.map((item) => { - return new ArtRepairFile(item); - }); - resolve(resArr); - } - }) - .catch((err) => { - reject(err); - }); + resolve(resArr); + } + }) + .catch((err) => { + reject(err); }); - } + }); + } + + //统一图片上传 + static uploadImage(params = {}) { + let { files, module } = params; + let fd = new FormData(); + fd.append("file", files); + fd.append("module", module); + return http.post(`/v2${artApi.artUploadPicture}`, fd, { + headers: { + "Content-Type": "multipart/form-data", + }, + }); + } } export default ArtSystem; diff --git a/cellsysArt.js b/cellsysArt.js index 705dab3..cfec6d4 100644 --- a/cellsysArt.js +++ b/cellsysArt.js @@ -1,13 +1,15 @@ -import ArtSystem from "./artSystem"; import ArtImage from "./artImage"; import { artStatus } from "./artEnum"; import { EditTask, EditType, + Operator, Query, QueryTask, } from "@airkoon/cellsys/cellsysUtil"; import { artApi } from "./artApi"; +import ArtRepairFile from "./artRepairFile"; +import ConditionReport from "./conditionReport"; class CellsysArt { constructor(params = {}) { @@ -60,6 +62,10 @@ class CellsysArt { } } + get statusMsg() { + return artStatus[this.status]; + } + get artworkImagesUrl() { if (this.artworkImages.length > 0) { return this.artworkImages.map((artImage) => { @@ -143,13 +149,59 @@ class CellsysArt { }); } - queryEventlist() { + //创建修复档案 + createRepairFile(params = {}) { + let { name, description, conditionCheckId } = params; + let editTask = new EditTask(artApi.repairRecordInsert); + editTask.addParam("_artwork_record_id", this.id); + editTask.addParam("_description", description); + editTask.addParam("_name", name); + editTask.addParam("_condition_check_id", conditionCheckId); return new Promise((resolve, reject) => { - ArtSystem.queryArtworkEvent({ - artworkId: this.id, - }) + editTask + .execute() .then((res) => { - resolve(res); + if (res.data) { + let artRepairFile = new ArtRepairFile(res.data); + resolve(artRepairFile); + } + }) + .catch((err) => { + reject(err); + }); + }); + } + + //查询修复状况检查记录 + queryConditionRecords(params = {}) { + let query = new Query(); + query.addFilter("artwork_record_id", Operator.Equals, this.id); //病害报告模板 + let { filter, pageInfo } = params; + if (filter) { + filter.forEach((item) => { + query.addFilter(item["name"], item["operator"], item["value"]); + }); + } + let queryTask = new QueryTask(artApi.viewConditionCheck, !!pageInfo); + 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 { + reject(new Error("状况检查记录数据格式异常!")); + } + } else { + let resArr = res.map((item) => { + return new ConditionReport(item); + }); + resolve(resArr); + } }) .catch((err) => { reject(err); diff --git a/components/Pagination/index.vue b/components/Pagination/index.vue new file mode 100644 index 0000000..e9028c7 --- /dev/null +++ b/components/Pagination/index.vue @@ -0,0 +1,247 @@ + + + + + + + + {{ currentPage }}/{{ totalPage }} + + + + + + + + 跳转 + + + + + + + + diff --git a/components/Signature/index.vue b/components/Signature/index.vue new file mode 100644 index 0000000..3e45625 --- /dev/null +++ b/components/Signature/index.vue @@ -0,0 +1,103 @@ + + + + + + 请使用移动端设备扫描二维码进行电子签名 + + + + + + + + diff --git a/components/Signature/write.vue b/components/Signature/write.vue new file mode 100644 index 0000000..0b2ad31 --- /dev/null +++ b/components/Signature/write.vue @@ -0,0 +1,190 @@ + + + + + + + + + + + + diff --git a/components/chooseArtwork.vue b/components/chooseArtwork.vue new file mode 100644 index 0000000..245b2f3 --- /dev/null +++ b/components/chooseArtwork.vue @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 暂无图片 + + + + {{ art.oldNameFormat }} + 艺术家:{{ art.author || "未知" }} + 状态:{{ art.statusMsg }} + + + + + + + + + + + + diff --git a/conditionReport.js b/conditionReport.js index b741a14..5db4db2 100644 --- a/conditionReport.js +++ b/conditionReport.js @@ -1,92 +1,90 @@ - -import {EditTask} from "@airkoon/cellsys/cellsysUtil"; -import {artApi} from "./artApi"; +import { EditTask } from "@airkoon/cellsys/cellsysUtil"; +import { artApi } from "./artApi"; +import { formatterMillisecond } from "./utils/date"; 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.tags = []; - if (params.tag_name) { - this.tags = params.tag_name.map((name) => { - return { name: 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; + 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.tags = []; + if (params.tag_name) { + this.tags = params.tag_name.map((name) => { + return { name: name }; + }); } - get coverImageCompress() { - return this.coverImage.compressionUrl; + 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 createTimeFormat() { + return formatterMillisecond(this.createTime); + } + get coverImageUrl() { + if (this.modelOptions.coverImage) { + return this.modelOptions.coverImage; } + } + 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(); + } - - - - - 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(); - } + conditionCheckDelete(params) { + let editTask = new EditTask(artApi.conditionCheckDelete); + editTask.addParam("_id", params.id); + return editTask.execute(); + } } export default ConditionReport; diff --git a/utils/utils.js b/utils/utils.js new file mode 100644 index 0000000..66ebc30 --- /dev/null +++ b/utils/utils.js @@ -0,0 +1,14 @@ +export function base64toFile(dataurl, filename = "file") { + let arr = dataurl.split(","); + let mime = arr[0].match(/:(.*?);/)[1]; + let suffix = mime.split("/")[1]; + let bstr = window.atob(arr[1]); + let n = bstr.length; + let u8arr = new Uint8Array(n); + while (n--) { + u8arr[n] = bstr.charCodeAt(n); + } + return new File([u8arr], `${filename}.${suffix}`, { + type: mime, + }); +}
请使用移动端设备扫描二维码进行电子签名
艺术家:{{ art.author || "未知" }}
状态:{{ art.statusMsg }}