71 lines
2.0 KiB
JavaScript
71 lines
2.0 KiB
JavaScript
|
|
import {CellsysType, Operator, Query, QueryTask, QueryType} from "./cellsysUtil";
|
|
|
|
class CellsysTag {
|
|
constructor(params) {
|
|
this.cellsysType = CellsysType.Tag;
|
|
if (!params) {
|
|
params = {};
|
|
}
|
|
let {id, name, description, rel_count, tag_group_id, tag_group_name} = params;
|
|
this.id = id;
|
|
this.name = name;
|
|
this.description = description;
|
|
this.tagGroup = null;
|
|
if(tag_group_id && tag_group_name){
|
|
this.tagGroup = {
|
|
id: tag_group_id,
|
|
name: tag_group_id
|
|
}
|
|
}
|
|
this.relCount = rel_count ? rel_count : 0;
|
|
|
|
}
|
|
|
|
queryModelData(queryParams){
|
|
if(!queryParams) {
|
|
queryParams = {
|
|
"pageInfo":{
|
|
"currPage": 1,
|
|
"pageSize": 0
|
|
}
|
|
}
|
|
}
|
|
let {pageInfo, order} = queryParams;
|
|
let query = new Query();
|
|
if (pageInfo) {
|
|
query.setCurrPage(pageInfo.currPage);
|
|
query.setPageSize(pageInfo.pageSize);
|
|
}
|
|
query.addFilter("tag_id", Operator.Equals, this.id);
|
|
if (order) {
|
|
query.setOrder(order)
|
|
}else{
|
|
query.setOrder({"create_time":"desc"})
|
|
}
|
|
let queryTask = new QueryTask( QueryType.TagModelRel, pageInfo ? true : false);
|
|
return new Promise((resolve, reject) => {
|
|
queryTask
|
|
.execute(query)
|
|
.then((res) => {
|
|
if (pageInfo) {
|
|
if (res.data) {
|
|
|
|
}
|
|
resolve(res);
|
|
} else {
|
|
let resArr = res.map((item) => {
|
|
|
|
});
|
|
resolve(resArr);
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
reject(err);
|
|
});
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
export default CellsysTag; |