cellsysArt/outBoundReview.js
2024-12-26 10:28:43 +08:00

77 lines
2.9 KiB
JavaScript

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;