|
@@ -50,10 +50,11 @@ export class TextbookComponent implements OnInit {
|
|
|
|
|
|
//相关权限配置
|
|
//相关权限配置
|
|
@Input('filterObj') filterObj: any = {
|
|
@Input('filterObj') filterObj: any = {
|
|
|
|
+ status: [],
|
|
showMore: false, //显示更多字段
|
|
showMore: false, //显示更多字段
|
|
isCheck: true,
|
|
isCheck: true,
|
|
noStared: false, //非推荐
|
|
noStared: false, //非推荐
|
|
- status: [],
|
|
|
|
|
|
+ team:false, //只获取当前部门或下级部门所属用户提交的教材
|
|
btns: {
|
|
btns: {
|
|
edit: false, //编辑
|
|
edit: false, //编辑
|
|
isDelete: false, //删除权限
|
|
isDelete: false, //删除权限
|
|
@@ -71,7 +72,7 @@ export class TextbookComponent implements OnInit {
|
|
lang: {
|
|
lang: {
|
|
listOfFilter: [
|
|
listOfFilter: [
|
|
{ value: '中文', text: '中文' },
|
|
{ value: '中文', text: '中文' },
|
|
- { value: '英语', text: '英语' },
|
|
|
|
|
|
+ { value: '英文', text: '英文' },
|
|
{ value: '其他外国语', text: '其他外国语' },
|
|
{ value: '其他外国语', text: '其他外国语' },
|
|
{ value: '中国少数名族语言', text: '中国少数名族语言' },
|
|
{ value: '中国少数名族语言', text: '中国少数名族语言' },
|
|
],
|
|
],
|
|
@@ -185,28 +186,57 @@ export class TextbookComponent implements OnInit {
|
|
}
|
|
}
|
|
async getTextbook(val?: string, exported?: boolean): Promise<any[] | void> {
|
|
async getTextbook(val?: string, exported?: boolean): Promise<any[] | void> {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
- let query = new Parse.Query('EduTextbook');
|
|
|
|
- if (val) {
|
|
|
|
- let query1 = Parse.Query.fromJSON('EduTextbook', {
|
|
|
|
- where: {
|
|
|
|
- $or: [
|
|
|
|
- {
|
|
|
|
- title: { $regex: `.*${val}.*` },
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- let query2 = Parse.Query.fromJSON('EduTextbook', {
|
|
|
|
|
|
+ // let query = new Parse.Query('EduTextbook');
|
|
|
|
+ // if (val) {
|
|
|
|
+ let query1 = Parse.Query.fromJSON('EduTextbook', {
|
|
|
|
+ where: {
|
|
|
|
+ $or: [
|
|
|
|
+ {
|
|
|
|
+ title: { $regex: `.*${val || ''}.*` },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ ISBN: { $regex: `.*${val || ''}.*` },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ author: { $regex: `.*${val || ''}.*` },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ // let query2 = Parse.Query.fromJSON('EduTextbook', {
|
|
|
|
+ // where: {
|
|
|
|
+ // $or: [
|
|
|
|
+ // {
|
|
|
|
+ // ISBN: { $regex: `.*${val || ''}.*` },
|
|
|
|
+ // },
|
|
|
|
+ // ],
|
|
|
|
+ // },
|
|
|
|
+ // });
|
|
|
|
+ let query = Parse.Query.or(query1);
|
|
|
|
+ if(this.filterObj.team){
|
|
|
|
+ let childrens = await this.tbookSer.getChild(this.tbookSer.profile.user.department?.objectId)
|
|
|
|
+ let query3 = Parse.Query.fromJSON('EduTextbook', {
|
|
where: {
|
|
where: {
|
|
$or: [
|
|
$or: [
|
|
{
|
|
{
|
|
- ISBN: { $regex: `.*${val}.*` },
|
|
|
|
|
|
+ user: {
|
|
|
|
+ $inQuery: {
|
|
|
|
+ where: {
|
|
|
|
+ 'department':{$in: [childrens],}
|
|
|
|
+ },
|
|
|
|
+ className: '_User',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
},
|
|
},
|
|
],
|
|
],
|
|
},
|
|
},
|
|
- });
|
|
|
|
- query = Parse.Query.or(query1, query2);
|
|
|
|
|
|
+ })
|
|
|
|
+ query = Parse.Query.and(
|
|
|
|
+ query3,
|
|
|
|
+ Parse.Query.or(query1)
|
|
|
|
+ )
|
|
}
|
|
}
|
|
|
|
+ // }
|
|
// this.uid && query.equalTo('user',this.tbookSer.profile.user?.objectId);
|
|
// this.uid && query.equalTo('user',this.tbookSer.profile.user?.objectId);
|
|
for (const key in this.filters) {
|
|
for (const key in this.filters) {
|
|
const element = this.filters[key];
|
|
const element = this.filters[key];
|