|
@@ -146,12 +146,12 @@ export class TextbookComponent implements OnInit {
|
|
};
|
|
};
|
|
//筛选条件
|
|
//筛选条件
|
|
filters: filter | any = {
|
|
filters: filter | any = {
|
|
- lang: { type: 'string', value: [] },
|
|
|
|
- majorPoniter: { type: 'string', value: [] },
|
|
|
|
- editionUnit: { type: 'string', value: [] },
|
|
|
|
- approval: { type: 'string', value: [] },
|
|
|
|
- carrierShape: { type: 'string', value: [] },
|
|
|
|
- department: { type: 'pointer', value: [] },
|
|
|
|
|
|
+ lang: { type: 'EduTextbookVolume', value: [] },
|
|
|
|
+ majorPoniter: { type: 'EduTextbookVolume', value: [] },
|
|
|
|
+ editionUnit: { type: 'EduTextbookVolume', value: [] },
|
|
|
|
+ approval: { type: 'EduTextbook', value: [] },
|
|
|
|
+ carrierShape: { type: 'EduTextbookVolume', value: [] },
|
|
|
|
+ department: { type: 'EduTextbook', value: [] },
|
|
};
|
|
};
|
|
loading: boolean = false;
|
|
loading: boolean = false;
|
|
checkedAll: boolean = false; //全选
|
|
checkedAll: boolean = false; //全选
|
|
@@ -197,31 +197,63 @@ export class TextbookComponent implements OnInit {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
// let query = new Parse.Query('EduTextbook');
|
|
// let query = new Parse.Query('EduTextbook');
|
|
// if (val) {
|
|
// if (val) {
|
|
- let query1 = Parse.Query.fromJSON('EduTextbook', {
|
|
|
|
|
|
+ let queryParams:any = {
|
|
where: {
|
|
where: {
|
|
$or: [
|
|
$or: [
|
|
{
|
|
{
|
|
title: { $regex: `.*${val || ''}.*` },
|
|
title: { $regex: `.*${val || ''}.*` },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- ISBN: { $regex: `.*${val || ''}.*` },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- author: { $regex: `.*${val || ''}.*` },
|
|
|
|
- },
|
|
|
|
|
|
+ childrens: {
|
|
|
|
+ $inQuery: {
|
|
|
|
+ where: {
|
|
|
|
+ "$or": [
|
|
|
|
+ {
|
|
|
|
+ ISBN: { $regex: `.*${val || ''}.*` },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ author: { $regex: `.*${val || ''}.*` },
|
|
|
|
+ },
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ className: 'EduTextbookVolume',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ }
|
|
],
|
|
],
|
|
},
|
|
},
|
|
- });
|
|
|
|
- // let query2 = Parse.Query.fromJSON('EduTextbook', {
|
|
|
|
- // where: {
|
|
|
|
- // $or: [
|
|
|
|
- // {
|
|
|
|
- // ISBN: { $regex: `.*${val || ''}.*` },
|
|
|
|
- // },
|
|
|
|
- // ],
|
|
|
|
- // },
|
|
|
|
- // });
|
|
|
|
|
|
+ }
|
|
|
|
+ let query1 = Parse.Query.fromJSON('EduTextbook', queryParams);
|
|
let query = Parse.Query.or(query1);
|
|
let query = Parse.Query.or(query1);
|
|
|
|
+ let queryParams2:any = {
|
|
|
|
+ where: {}
|
|
|
|
+ }
|
|
|
|
+ for (const key in this.filters) {
|
|
|
|
+ const element = this.filters[key];
|
|
|
|
+ if (element.value?.length > 0 && element.type == 'EduTextbookVolume') {
|
|
|
|
+ if(!queryParams2['where']['childrens']){
|
|
|
|
+ queryParams2['where']['childrens']= {
|
|
|
|
+ '$inQuery':{
|
|
|
|
+ 'where': {
|
|
|
|
+ // '$or':[
|
|
|
|
+ [key]: { $in: element.value }
|
|
|
|
+ // ]
|
|
|
|
+ },
|
|
|
|
+ className: 'EduTextbookVolume',
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ queryParams2['where']['childrens']['$inQuery']['where'][key] = { $in: element.value }
|
|
|
|
+ }
|
|
|
|
+ }else if(element.value?.length > 0 && element.type == 'EduTextbook'){
|
|
|
|
+ queryParams2['where'][key] = { $in: element.value }
|
|
|
|
+ }
|
|
|
|
+ // query.containedIn(key, element.value);
|
|
|
|
+ }
|
|
|
|
+ let vrifly = Object.keys(queryParams2['where']).some(item=> Object.values(item).length > 0)
|
|
|
|
+ if(vrifly){
|
|
|
|
+ query = Parse.Query.and(Parse.Query.fromJSON('EduTextbook', queryParams2), query);
|
|
|
|
+ }
|
|
if (this.filterObj.team) {
|
|
if (this.filterObj.team) {
|
|
let childrens = await this.tbookSer.getChild(
|
|
let childrens = await this.tbookSer.getChild(
|
|
this.tbookSer.profile.user.department?.objectId
|
|
this.tbookSer.profile.user.department?.objectId
|
|
@@ -242,14 +274,10 @@ export class TextbookComponent implements OnInit {
|
|
],
|
|
],
|
|
},
|
|
},
|
|
});
|
|
});
|
|
- query = Parse.Query.and(query3, Parse.Query.or(query1));
|
|
|
|
- }
|
|
|
|
- // }
|
|
|
|
- // this.uid && query.equalTo('user',this.tbookSer.profile.user?.objectId);
|
|
|
|
- for (const key in this.filters) {
|
|
|
|
- const element = this.filters[key];
|
|
|
|
- if (element.value?.length > 0) {
|
|
|
|
- query.containedIn(key, element.value);
|
|
|
|
|
|
+ if(vrifly){
|
|
|
|
+ query = Parse.Query.and(query3, Parse.Query.fromJSON('EduTextbook', queryParams2), query);
|
|
|
|
+ }else{
|
|
|
|
+ query = Parse.Query.and(query3, query);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.eduProcess?.id && query.equalTo('eduProcess', this.eduProcess.id);
|
|
this.eduProcess?.id && query.equalTo('eduProcess', this.eduProcess.id);
|