|
@@ -31,7 +31,8 @@ interface filter {
|
|
|
MatButtonModule,
|
|
|
NzRadioModule,
|
|
|
DatePipe,
|
|
|
- NzEmptyModule,NzPopoverModule
|
|
|
+ NzEmptyModule,
|
|
|
+ NzPopoverModule,
|
|
|
],
|
|
|
standalone: true,
|
|
|
providers: [DatePipe],
|
|
@@ -50,6 +51,7 @@ export class TextbookComponent implements OnInit {
|
|
|
@Input('discard') discard: Boolean = false; //是否删除
|
|
|
@Input('eduProcess') eduProcess?: Parse.Object; //流程id,verify存在时需要
|
|
|
@Output() updateCheck: EventEmitter<any> = new EventEmitter<any>();
|
|
|
+ @Output() markScore: EventEmitter<any> = new EventEmitter<any>();
|
|
|
|
|
|
//相关权限配置
|
|
|
@Input('filterObj') filterObj: any = {
|
|
@@ -58,11 +60,9 @@ export class TextbookComponent implements OnInit {
|
|
|
isCheck: true,
|
|
|
noStared: false, //非推荐
|
|
|
team: false, //只获取当前部门或下级部门所属用户的教材,且不限制是否提交
|
|
|
- showText:false, //选择后不展示定位btns,只展示相关教材名称列表
|
|
|
- notContained:[],//不包含教材(查询时自动排除)
|
|
|
- eduReivew:{ //评审相关
|
|
|
-
|
|
|
- },
|
|
|
+ showText: false, //选择后不展示定位btns,只展示相关教材名称列表
|
|
|
+ notContained: [], //不包含教材(查询时自动排除)
|
|
|
+ contained:[], //包含查询(查询只获取在数组内的id)
|
|
|
btns: {
|
|
|
edit: false, //编辑
|
|
|
isDelete: false, //删除权限
|
|
@@ -72,11 +72,15 @@ export class TextbookComponent implements OnInit {
|
|
|
remove: false, //移除推荐
|
|
|
submit: false, //提交
|
|
|
beforSubmit: false, //高校联系人提交至工作联系人
|
|
|
- export: false,//导出附件
|
|
|
+ export: false, //导出附件
|
|
|
verify: false, //提交推荐权限
|
|
|
restore: false, //恢复教材
|
|
|
+ eduReivew: false, //在线预览
|
|
|
+ mark: false, //打分
|
|
|
},
|
|
|
};
|
|
|
+ @Input('scoreMap') scoreMap:any = {} //评分状态
|
|
|
+
|
|
|
listOfColumns: any = {
|
|
|
lang: {
|
|
|
listOfFilter: [
|
|
@@ -169,23 +173,26 @@ export class TextbookComponent implements OnInit {
|
|
|
|
|
|
showLoading: boolean = false; //全局
|
|
|
/* 格式化拓展表字段 */
|
|
|
- fromatFiled(list:Array<Parse.Object>, filed:string):string{
|
|
|
- let arr:Array<string|null> = []
|
|
|
- let isDate = false
|
|
|
- list.forEach((item:Parse.Object)=>{
|
|
|
+ fromatFiled(list: Array<Parse.Object>, filed: string): string {
|
|
|
+ let arr: Array<string | null> = [];
|
|
|
+ let isDate = false;
|
|
|
+ list.forEach((item: Parse.Object) => {
|
|
|
// arr.add(item.get(filed))
|
|
|
- if(isDate || Object.prototype.toString.call(item.get(filed)).indexOf('Date') != -1){
|
|
|
- arr.push(this.datePipe.transform(item.get(filed), 'yyyy-MM'))
|
|
|
- isDate = true
|
|
|
- }else{
|
|
|
- arr.push(item.get(filed))
|
|
|
+ if (
|
|
|
+ isDate ||
|
|
|
+ Object.prototype.toString.call(item.get(filed)).indexOf('Date') != -1
|
|
|
+ ) {
|
|
|
+ arr.push(this.datePipe.transform(item.get(filed), 'yyyy-MM'));
|
|
|
+ isDate = true;
|
|
|
+ } else {
|
|
|
+ arr.push(item.get(filed));
|
|
|
}
|
|
|
- })
|
|
|
- let j = Array.from(arr).join(',')
|
|
|
- if(!isDate){
|
|
|
- j = Array.from(new Set(arr)).join(' ')
|
|
|
+ });
|
|
|
+ let j = Array.from(arr).join(',');
|
|
|
+ if (!isDate) {
|
|
|
+ j = Array.from(new Set(arr)).join(' ');
|
|
|
}
|
|
|
- return j || '-'
|
|
|
+ return j || '-';
|
|
|
}
|
|
|
|
|
|
constructor(
|
|
@@ -200,9 +207,10 @@ export class TextbookComponent implements OnInit {
|
|
|
ngOnInit() {
|
|
|
this.activeRoute.paramMap.subscribe(async (params) => {
|
|
|
// this.eduProcessId = params.get('id');
|
|
|
- Object.keys(this.filterObj?.btns).forEach((key)=> {
|
|
|
- if(this.filterObj[key] && key != 'review' && key != 'verify') this.calc += 70;
|
|
|
- })
|
|
|
+ let arr = ['review', 'verify', 'eduReivew', 'mark'];
|
|
|
+ Object.keys(this.filterObj?.btns).forEach((key) => {
|
|
|
+ if (this.filterObj[key] && !arr.includes(key)) this.calc += 70;
|
|
|
+ });
|
|
|
this.getTextbook();
|
|
|
if (Object.values(this.filterObj?.btns).some((item) => item)) {
|
|
|
this.manage = true;
|
|
@@ -221,9 +229,12 @@ export class TextbookComponent implements OnInit {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- async getTextbook(val?: string, exported?:{excel:boolean, id:boolean}): Promise<any[] | void> {
|
|
|
+ async getTextbook(
|
|
|
+ val?: string,
|
|
|
+ exported?: { excel: boolean; id: boolean }
|
|
|
+ ): Promise<any[] | void> {
|
|
|
this.loading = true;
|
|
|
- let queryParams:any = {
|
|
|
+ let queryParams: any = {
|
|
|
where: {
|
|
|
$or: [
|
|
|
{
|
|
@@ -233,49 +244,56 @@ export class TextbookComponent implements OnInit {
|
|
|
childrens: {
|
|
|
$inQuery: {
|
|
|
where: {
|
|
|
- "$or": [
|
|
|
+ $or: [
|
|
|
{
|
|
|
ISBN: { $regex: `.*${val || ''}.*` },
|
|
|
},
|
|
|
{
|
|
|
author: { $regex: `.*${val || ''}.*` },
|
|
|
},
|
|
|
- ]
|
|
|
+ ],
|
|
|
},
|
|
|
className: 'EduTextbookVolume',
|
|
|
},
|
|
|
},
|
|
|
- }
|
|
|
+ },
|
|
|
],
|
|
|
},
|
|
|
- }
|
|
|
+ };
|
|
|
let query1 = Parse.Query.fromJSON('EduTextbook', queryParams);
|
|
|
let query = Parse.Query.or(query1);
|
|
|
- let queryParams2:any = {
|
|
|
- where: {}
|
|
|
- }
|
|
|
+ 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': {
|
|
|
- [key]: { $in: element.value }
|
|
|
+ if (!queryParams2['where']['childrens']) {
|
|
|
+ queryParams2['where']['childrens'] = {
|
|
|
+ $inQuery: {
|
|
|
+ where: {
|
|
|
+ [key]: { $in: element.value },
|
|
|
},
|
|
|
className: 'EduTextbookVolume',
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- queryParams2['where']['childrens']['$inQuery']['where'][key] = { $in: element.value }
|
|
|
+ },
|
|
|
+ };
|
|
|
+ } 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 }
|
|
|
+ } else if (element.value?.length > 0 && element.type == 'EduTextbook') {
|
|
|
+ queryParams2['where'][key] = { $in: 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);
|
|
|
+ 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) {
|
|
|
let childrens = await this.tbookSer.getChild(
|
|
@@ -297,9 +315,13 @@ export class TextbookComponent implements OnInit {
|
|
|
],
|
|
|
},
|
|
|
});
|
|
|
- if(vrifly){
|
|
|
- query = Parse.Query.and(query3, Parse.Query.fromJSON('EduTextbook', queryParams2), query);
|
|
|
- }else{
|
|
|
+ if (vrifly) {
|
|
|
+ query = Parse.Query.and(
|
|
|
+ query3,
|
|
|
+ Parse.Query.fromJSON('EduTextbook', queryParams2),
|
|
|
+ query
|
|
|
+ );
|
|
|
+ } else {
|
|
|
query = Parse.Query.and(query3, query);
|
|
|
}
|
|
|
}
|
|
@@ -308,7 +330,9 @@ export class TextbookComponent implements OnInit {
|
|
|
this.recommend && query.equalTo('recommend', true);
|
|
|
this.filterObj?.noStared && query.notEqualTo('recommend', true);
|
|
|
this.uid && query.equalTo('user', this.uid);
|
|
|
- this.filterObj?.notContained && query.notContainedIn('objectId', this.filterObj.notContained);
|
|
|
+ this.filterObj?.notContained &&
|
|
|
+ query.notContainedIn('objectId', this.filterObj.notContained);
|
|
|
+ this.filterObj?.contained && query.containedIn('objectId', this.filterObj.contained);
|
|
|
query.descending('createdAt');
|
|
|
query.notEqualTo('isDeleted', true);
|
|
|
if (!this.uid && !this.filterObj.team) {
|
|
@@ -324,21 +348,23 @@ export class TextbookComponent implements OnInit {
|
|
|
}
|
|
|
if (exported?.excel) {
|
|
|
query.limit(1000);
|
|
|
- if(exported?.id){
|
|
|
- query.select('objectId')
|
|
|
+ if (exported?.id) {
|
|
|
+ query.select('objectId');
|
|
|
}
|
|
|
let r = await query.find();
|
|
|
this.loading = false;
|
|
|
return r;
|
|
|
}
|
|
|
- query.include('department','childrens');
|
|
|
+ query.include('department', 'childrens');
|
|
|
this.count = await query.count();
|
|
|
query.limit(this.limit);
|
|
|
query.skip(this.limit * (this.pageIndex - 1));
|
|
|
// query.include('user')
|
|
|
this.textbookList = await query.find();
|
|
|
console.log(this.textbookList);
|
|
|
- this.checkedAll = this.textbookList.every(item=> this.setOfCheckedId.has(item.id))
|
|
|
+ this.checkedAll = this.textbookList.every((item) =>
|
|
|
+ this.setOfCheckedId.has(item.id)
|
|
|
+ );
|
|
|
this.loading = false;
|
|
|
}
|
|
|
async getDepartment(all?: boolean): Promise<any> {
|
|
@@ -388,11 +414,11 @@ export class TextbookComponent implements OnInit {
|
|
|
this.getTextbook(this.searchValue);
|
|
|
}
|
|
|
//切换分页条数
|
|
|
- onPageSizeChange($event:any): void {
|
|
|
+ onPageSizeChange($event: any): void {
|
|
|
console.log(this.limit);
|
|
|
// this.onAllChecked(false)
|
|
|
- this.pageIndex = 1
|
|
|
- this.getTextbook()
|
|
|
+ this.pageIndex = 1;
|
|
|
+ this.getTextbook();
|
|
|
}
|
|
|
//全选
|
|
|
onAllChecked(checked: boolean) {
|
|
@@ -408,7 +434,7 @@ export class TextbookComponent implements OnInit {
|
|
|
this.setOfCheckedId = new Set<string>();
|
|
|
}
|
|
|
this.checkedAll = checked;
|
|
|
- this.updateCheck.emit() //选项变更触发传递事件父组建
|
|
|
+ this.updateCheck.emit(); //选项变更触发传递事件父组建
|
|
|
}
|
|
|
//单选
|
|
|
onItemChecked(id: string, e: boolean) {
|
|
@@ -420,7 +446,7 @@ export class TextbookComponent implements OnInit {
|
|
|
this.checkedAll = this.textbookList.every((item) =>
|
|
|
this.setOfCheckedId.has(item.id)
|
|
|
);
|
|
|
- this.updateCheck.emit() //选项变更触发传递事件父组建
|
|
|
+ this.updateCheck.emit(); //选项变更触发传递事件父组建
|
|
|
}
|
|
|
//退回
|
|
|
reject(data?: Parse.Object) {
|
|
@@ -575,10 +601,10 @@ export class TextbookComponent implements OnInit {
|
|
|
this.message.warning('教材信息填写不完整');
|
|
|
return;
|
|
|
}
|
|
|
- if(!data?.get('code')){
|
|
|
+ if (!data?.get('code')) {
|
|
|
let t =
|
|
|
- this.tbookSer.formatTime('YYYYmmdd', new Date()) +
|
|
|
- Math.random().toString().slice(-4);
|
|
|
+ this.tbookSer.formatTime('YYYYmmdd', new Date()) +
|
|
|
+ Math.random().toString().slice(-4);
|
|
|
data.set('code', t);
|
|
|
}
|
|
|
data.set('render', true);
|
|
@@ -610,10 +636,10 @@ export class TextbookComponent implements OnInit {
|
|
|
item?.get('status') == '300'
|
|
|
) {
|
|
|
count++;
|
|
|
- if(!item?.get('code')){
|
|
|
+ if (!item?.get('code')) {
|
|
|
let t =
|
|
|
- this.tbookSer.formatTime('YYYYmmdd', new Date()) +
|
|
|
- Math.random().toString().slice(-4);
|
|
|
+ this.tbookSer.formatTime('YYYYmmdd', new Date()) +
|
|
|
+ Math.random().toString().slice(-4);
|
|
|
item.set('code', t);
|
|
|
}
|
|
|
item.set('render', true);
|
|
@@ -677,7 +703,7 @@ export class TextbookComponent implements OnInit {
|
|
|
if (data?.id) {
|
|
|
data.set('status', '200');
|
|
|
await data.save();
|
|
|
- this.message.success('提交成功')
|
|
|
+ this.message.success('提交成功');
|
|
|
} else {
|
|
|
let count = 0,
|
|
|
failCount = 0;
|
|
@@ -801,6 +827,22 @@ export class TextbookComponent implements OnInit {
|
|
|
this.showLoading = false;
|
|
|
}
|
|
|
}
|
|
|
+ //在线预览
|
|
|
+ async onlinePreview(id: string) {
|
|
|
+ if(this.loading) return
|
|
|
+ this.loading = true
|
|
|
+ await this.tbookSer.preview({ bookid: id });
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ //打分
|
|
|
+ onMarking(id:string){
|
|
|
+ let pid = this.tbookSer.profile?.objectId
|
|
|
+ if(!pid){
|
|
|
+ this.message.error('当前登录身份已过期,请重新登录')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.markScore.emit(id)
|
|
|
+ }
|
|
|
toUrl(url: string, param?: Object) {
|
|
|
console.log(url);
|
|
|
if (param) {
|
|
@@ -850,14 +892,14 @@ export class TextbookComponent implements OnInit {
|
|
|
async export() {
|
|
|
if (this.showLoading) return;
|
|
|
this.showLoading = true;
|
|
|
- try{
|
|
|
+ try {
|
|
|
console.log(this.eduProcess);
|
|
|
let query = new Parse.Query('EduProcess');
|
|
|
query.equalTo('objectId', this.eduProcess?.id);
|
|
|
query.include('profileSubmitted', 'profileSubmitted.user');
|
|
|
query.select('name', 'profileSubmitted');
|
|
|
let r = await query.first();
|
|
|
- let data: any = await this.getTextbook('',{excel:true, id:false});
|
|
|
+ let data: any = await this.getTextbook('', { excel: true, id: false });
|
|
|
let table = `<table border="1px" cellspacing="0" cellpadding="0">
|
|
|
<thead>
|
|
|
<tr>
|
|
@@ -874,7 +916,9 @@ export class TextbookComponent implements OnInit {
|
|
|
<tr>
|
|
|
<th></th><th></th>
|
|
|
<th style="font-size: 12px;font-family: '黑体';text-align: left;">单位名称(公章):</th>
|
|
|
- <th colspan="3" style="font-size: 12px;font-family: '黑体';text-align: left;">${r?.get('name')}</th>
|
|
|
+ <th colspan="3" style="font-size: 12px;font-family: '黑体';text-align: left;">${r?.get(
|
|
|
+ 'name'
|
|
|
+ )}</th>
|
|
|
<th></th><th></th><th></th>
|
|
|
</tr>
|
|
|
<tr>
|
|
@@ -940,7 +984,7 @@ export class TextbookComponent implements OnInit {
|
|
|
_body += `${
|
|
|
data[row]?.get('type') == '单本'
|
|
|
? '单本'
|
|
|
- :'全册 - ' + data[row]?.get('typeNumber') || '-'
|
|
|
+ : '全册 - ' + data[row]?.get('typeNumber') || '-'
|
|
|
}`;
|
|
|
_body += '</td>';
|
|
|
|
|
@@ -949,17 +993,24 @@ export class TextbookComponent implements OnInit {
|
|
|
_body += '</td>';
|
|
|
|
|
|
_body += '<td>';
|
|
|
- _body += `${this.fromatFiled(data[row]?.get('childrens'), 'editionUnit')}`;
|
|
|
+ _body += `${this.fromatFiled(
|
|
|
+ data[row]?.get('childrens'),
|
|
|
+ 'editionUnit'
|
|
|
+ )}`;
|
|
|
_body += '</td>';
|
|
|
|
|
|
_body += '<td>';
|
|
|
- _body += ` ${
|
|
|
- this.fromatFiled(data[row]?.get('childrens'), 'editionFirst')
|
|
|
- }`;
|
|
|
+ _body += ` ${this.fromatFiled(
|
|
|
+ data[row]?.get('childrens'),
|
|
|
+ 'editionFirst'
|
|
|
+ )}`;
|
|
|
_body += '</td>';
|
|
|
|
|
|
_body += '<td>';
|
|
|
- _body += `${this.fromatFiled(data[row]?.get('childrens'), 'carrierShape')}`;
|
|
|
+ _body += `${this.fromatFiled(
|
|
|
+ data[row]?.get('childrens'),
|
|
|
+ 'carrierShape'
|
|
|
+ )}`;
|
|
|
_body += '</td>';
|
|
|
|
|
|
_body += '</tr>';
|
|
@@ -970,9 +1021,9 @@ export class TextbookComponent implements OnInit {
|
|
|
let title = '推荐汇总表';
|
|
|
this.excel(table, `${title}.xls`);
|
|
|
this.showLoading = false;
|
|
|
- }catch(err){
|
|
|
- this.showLoading = false
|
|
|
- this.message.error('导出超时')
|
|
|
+ } catch (err) {
|
|
|
+ this.showLoading = false;
|
|
|
+ this.message.error('导出超时');
|
|
|
}
|
|
|
}
|
|
|
excel(data: any, filename: string) {
|