|
@@ -24,7 +24,7 @@ import { NzSpinModule } from 'ng-zorro-antd/spin';
|
|
|
import { MatDialogRef } from '@angular/material/dialog';
|
|
|
import { DatePipe } from '@angular/common';
|
|
|
import { NzModalService } from 'ng-zorro-antd/modal';
|
|
|
-import { ReviewDetailsComponent } from '../components/review-details/review-details.component'
|
|
|
+import { ReviewDetailsComponent } from '../components/review-details/review-details.component';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-activity',
|
|
@@ -45,7 +45,7 @@ import { ReviewDetailsComponent } from '../components/review-details/review-deta
|
|
|
CompUploadComponent,
|
|
|
MatDialogModule,
|
|
|
NzSpinModule,
|
|
|
- ReviewDetailsComponent
|
|
|
+ ReviewDetailsComponent,
|
|
|
],
|
|
|
providers: [DatePipe],
|
|
|
standalone: true,
|
|
@@ -55,10 +55,10 @@ export class ActivityComponent implements OnInit {
|
|
|
eduProcess: Parse.Object | undefined;
|
|
|
|
|
|
listOfFilter: Array<any> = []; //评审组
|
|
|
- filterObj:any = {
|
|
|
- showGroup:true,
|
|
|
+ filterObj: any = {
|
|
|
+ showGroup: true,
|
|
|
contained: [],
|
|
|
- bookMap:{},//教材对应评审组结构{booid:评审组名称}
|
|
|
+ bookMap: {}, //教材对应评审组结构{booid:评审组名称}
|
|
|
};
|
|
|
|
|
|
constructor(
|
|
@@ -68,9 +68,9 @@ export class ActivityComponent implements OnInit {
|
|
|
private msg: NzMessageService,
|
|
|
public dialog: MatDialog,
|
|
|
private modal: NzModalService
|
|
|
- ) { }
|
|
|
+ ) {}
|
|
|
|
|
|
- saveLoading = true
|
|
|
+ saveLoading = true;
|
|
|
ngOnInit() {
|
|
|
this.activeRoute.paramMap.subscribe(async (params) => {
|
|
|
let id = params.get('id');
|
|
@@ -86,150 +86,167 @@ export class ActivityComponent implements OnInit {
|
|
|
);
|
|
|
}
|
|
|
this.eduProcess = res;
|
|
|
- this.refersh()
|
|
|
+ this.refersh();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
async refersh() {
|
|
|
- await this.getActivity()
|
|
|
- await this.getExpertGroup()
|
|
|
- this.saveLoading = false
|
|
|
+ await this.getActivity();
|
|
|
+ await this.getExpertGroup();
|
|
|
+ this.saveLoading = false;
|
|
|
}
|
|
|
- company: string = localStorage.getItem('company')!
|
|
|
+ company: string = localStorage.getItem('company')!;
|
|
|
/**评审活动 */
|
|
|
- activity?: Parse.Object
|
|
|
+ activity?: Parse.Object;
|
|
|
/**获取评审活动 */
|
|
|
async getActivity() {
|
|
|
- console.log(this.eduProcess?.id, this.company)
|
|
|
- let query = new Parse.Query('Activity')
|
|
|
- query.notEqualTo('isDeleted', true)
|
|
|
- query.equalTo('eduProcess', this.eduProcess?.id)
|
|
|
+ console.log(this.eduProcess?.id, this.company);
|
|
|
+ let query = new Parse.Query('Activity');
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
+ query.equalTo('eduProcess', this.eduProcess?.id);
|
|
|
// query.equalTo('company', this.company)
|
|
|
- this.activity = await query.first()
|
|
|
- console.log(this.activity)
|
|
|
+ this.activity = await query.first();
|
|
|
+ console.log(this.activity);
|
|
|
if (this.activity?.id) {
|
|
|
- this.name = this.activity?.get('name') || ''
|
|
|
- this.startDate = this.activity?.get('startDate') || new Date()
|
|
|
- this.deadline = this.activity?.get('deadline') || null
|
|
|
- this.calculation = this.activity?.get('calculation') || 'mean'
|
|
|
- this.reviewDetails = this.activity?.get('reviewDetails') || {}
|
|
|
+ this.name = this.activity?.get('name') || '';
|
|
|
+ this.startDate = this.activity?.get('startDate') || new Date();
|
|
|
+ this.deadline = this.activity?.get('deadline') || null;
|
|
|
+ this.calculation = this.activity?.get('calculation') || 'mean';
|
|
|
+ this.reviewDetails = this.activity?.get('reviewDetails') || {};
|
|
|
} else {
|
|
|
- let Activity = Parse.Object.extend('Activity')
|
|
|
- this.activity = new Activity()
|
|
|
+ let Activity = Parse.Object.extend('Activity');
|
|
|
+ this.activity = new Activity();
|
|
|
}
|
|
|
}
|
|
|
/**活动名称 */
|
|
|
- name: string = ''
|
|
|
- startDate?: any
|
|
|
- deadline?: any
|
|
|
+ name: string = '';
|
|
|
+ startDate?: any;
|
|
|
+ deadline?: any;
|
|
|
reset() {
|
|
|
- this.name = ''
|
|
|
- this.startDate = null
|
|
|
- this.deadline = null
|
|
|
+ this.name = '';
|
|
|
+ this.startDate = null;
|
|
|
+ this.deadline = null;
|
|
|
}
|
|
|
/**保存活动 */
|
|
|
async save() {
|
|
|
if (this.name == '' && !this.name) {
|
|
|
- this.msg.create('warning', '评审活动名称不能为空')
|
|
|
- return
|
|
|
+ this.msg.create('warning', '评审活动名称不能为空');
|
|
|
+ return;
|
|
|
}
|
|
|
if (!this.activity?.id) {
|
|
|
- this.activity?.set('company', { __type: 'Pointer', className: 'Company', objectId: this.company })
|
|
|
- this.activity?.set('eduProcess', { __type: 'Pointer', className: 'EduProcess', objectId: this.eduProcess?.id })
|
|
|
+ this.activity?.set('company', {
|
|
|
+ __type: 'Pointer',
|
|
|
+ className: 'Company',
|
|
|
+ objectId: this.company,
|
|
|
+ });
|
|
|
+ this.activity?.set('eduProcess', {
|
|
|
+ __type: 'Pointer',
|
|
|
+ className: 'EduProcess',
|
|
|
+ objectId: this.eduProcess?.id,
|
|
|
+ });
|
|
|
}
|
|
|
- this.activity?.set('name', this.name)
|
|
|
- this.activity?.set('startDate', this.startDate)
|
|
|
- this.activity?.set('deadline', this.deadline)
|
|
|
- this.activity?.set('calculation', this.calculation || 'mean')
|
|
|
- this.activity?.set('reviewDetails', this.reviewDetails || {})
|
|
|
- this.activity = await this.activity?.save()
|
|
|
- this.msg.create('success', '保存成功')
|
|
|
-
|
|
|
+ this.activity?.set('name', this.name);
|
|
|
+ this.activity?.set('startDate', this.startDate);
|
|
|
+ this.activity?.set('deadline', this.deadline);
|
|
|
+ this.activity?.set('calculation', this.calculation || 'mean');
|
|
|
+ this.activity?.set('reviewDetails', this.reviewDetails || {});
|
|
|
+ this.activity = await this.activity?.save();
|
|
|
+ this.msg.create('success', '保存成功');
|
|
|
}
|
|
|
/**计算方式 mean:平均数 truncatedMean:截尾平均数 */
|
|
|
- calculation: 'truncatedMean' | 'mean' = 'truncatedMean'
|
|
|
+ calculation: 'truncatedMean' | 'mean' = 'truncatedMean';
|
|
|
async changeCalculation() {
|
|
|
- console.log(this.calculation)
|
|
|
- this.msg.warning('计算方式已调整,请返回评审活动重新计算平均分')
|
|
|
- this.save()
|
|
|
+ console.log(this.calculation);
|
|
|
+ this.msg.warning('计算方式已调整,请返回评审活动重新计算平均分');
|
|
|
+ this.save();
|
|
|
}
|
|
|
/**评审细则 */
|
|
|
- reviewDetails: any
|
|
|
+ reviewDetails: any;
|
|
|
async upload(e: any) {
|
|
|
- console.log(e)
|
|
|
- let file = e[0]
|
|
|
- this.reviewDetails = file
|
|
|
- console.log(this.reviewDetails)
|
|
|
+ console.log(e);
|
|
|
+ let file = e[0];
|
|
|
+ this.reviewDetails = file;
|
|
|
+ console.log(this.reviewDetails);
|
|
|
if (this.reviewDetails?.url) {
|
|
|
- this.save()
|
|
|
+ this.save();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**评审组 */
|
|
|
- expertGroupList: Array<Parse.Object> = []
|
|
|
+ expertGroupList: Array<Parse.Object> = [];
|
|
|
async getExpertGroup() {
|
|
|
- let query = new Parse.Query('ExpertGroup')
|
|
|
- query.equalTo('eduProcess', this.eduProcess?.id)
|
|
|
- query.notEqualTo('isDeleted', true)
|
|
|
- query.descending('updatedAt')//大到小
|
|
|
- query.include('textbookList','reviewList.user')
|
|
|
- this.expertGroupList = await query.find()
|
|
|
- console.log(this.expertGroupList)
|
|
|
- this.expertGroupList.forEach(item=>{
|
|
|
+ let query = new Parse.Query('ExpertGroup');
|
|
|
+ query.equalTo('eduProcess', this.eduProcess?.id);
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
+ query.descending('updatedAt'); //大到小
|
|
|
+ query.include('textbookList', 'reviewList.user');
|
|
|
+ this.expertGroupList = await query.find();
|
|
|
+ console.log(this.expertGroupList);
|
|
|
+ this.expertGroupList.forEach((item) => {
|
|
|
this.listOfFilter.push({
|
|
|
- text:item.get('name'),
|
|
|
- value:item.id
|
|
|
- })
|
|
|
- item.get('textbookList')?.forEach( (book:Parse.Object)=> {
|
|
|
+ text: item.get('name'),
|
|
|
+ value: item.id,
|
|
|
+ });
|
|
|
+ item.get('textbookList')?.forEach((book: Parse.Object) => {
|
|
|
this.filterObj.bookMap[book.id] = {
|
|
|
- name:item.get('name'),
|
|
|
- id:item.id
|
|
|
- }
|
|
|
- this.filterObj.contained.push(book.id)
|
|
|
+ name: item.get('name'),
|
|
|
+ id: item.id,
|
|
|
+ };
|
|
|
+ this.filterObj.contained.push(book.id);
|
|
|
});
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
async deleteGroup(index: number) {
|
|
|
+ if (
|
|
|
+ this.activity?.get('deadline') < new Date() ||
|
|
|
+ (this.activity?.id && this.eduProcess?.get('status') == '201')
|
|
|
+ ) {
|
|
|
+ this.msg.create('warning', '活动已开始或截止,无法删除评审组');
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.modal.confirm({
|
|
|
nzTitle: '删除评审组',
|
|
|
nzContent: '你确定删除该评审组吗,删除后将不可撤销',
|
|
|
nzOkText: '确认',
|
|
|
nzOkType: 'primary',
|
|
|
nzOkDanger: true,
|
|
|
- nzOnOk:async () => {
|
|
|
- this.expertGroupList[index].set('isDeleted', true)
|
|
|
- await this.expertGroupList[index].save()
|
|
|
- this.expertGroupList.splice(index, 1)
|
|
|
+ nzOnOk: async () => {
|
|
|
+ this.expertGroupList[index].set('isDeleted', true);
|
|
|
+ await this.expertGroupList[index].save();
|
|
|
+ this.expertGroupList.splice(index, 1);
|
|
|
},
|
|
|
nzCancelText: '取消',
|
|
|
- nzOnCancel: () => console.log('Cancel')
|
|
|
+ nzOnCancel: () => console.log('Cancel'),
|
|
|
});
|
|
|
}
|
|
|
/**创建评审组弹框 */
|
|
|
creatReviewGroup() {
|
|
|
const dialogRef = this.dialog.open(CreateReviewGroupContent, {
|
|
|
- width: '400px'
|
|
|
+ width: '400px',
|
|
|
});
|
|
|
- let that = this
|
|
|
+ let that = this;
|
|
|
dialogRef.afterClosed().subscribe(async (result) => {
|
|
|
- let name = result
|
|
|
- if (result = '' || !result) {
|
|
|
- that.msg.create('warning', '评审组名称未填写')
|
|
|
- return
|
|
|
+ let name = result;
|
|
|
+ if ((result = '' || !result)) {
|
|
|
+ that.msg.create('warning', '评审组名称未填写');
|
|
|
+ return;
|
|
|
}
|
|
|
- console.log(name)
|
|
|
- let ExpertGroup = Parse.Object.extend('ExpertGroup')
|
|
|
- let expertGroup = new ExpertGroup()
|
|
|
- expertGroup.set('eduProcess', { __type: 'Pointer', className: 'EduProcess', objectId: that.eduProcess?.id })
|
|
|
- expertGroup.set('name', name)
|
|
|
- await expertGroup.save()
|
|
|
- that.getExpertGroup()
|
|
|
- that.msg.create('success', '创建成功')
|
|
|
-
|
|
|
+ console.log(name);
|
|
|
+ let ExpertGroup = Parse.Object.extend('ExpertGroup');
|
|
|
+ let expertGroup = new ExpertGroup();
|
|
|
+ expertGroup.set('eduProcess', {
|
|
|
+ __type: 'Pointer',
|
|
|
+ className: 'EduProcess',
|
|
|
+ objectId: that.eduProcess?.id,
|
|
|
+ });
|
|
|
+ expertGroup.set('name', name);
|
|
|
+ await expertGroup.save();
|
|
|
+ that.getExpertGroup();
|
|
|
+ that.msg.create('success', '创建成功');
|
|
|
});
|
|
|
}
|
|
|
- goUrl(url:string){
|
|
|
- this.router.navigate([url])
|
|
|
+ goUrl(url: string) {
|
|
|
+ this.router.navigate([url]);
|
|
|
}
|
|
|
back() {
|
|
|
history.back();
|
|
@@ -239,8 +256,6 @@ export class ActivityComponent implements OnInit {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
@Component({
|
|
|
selector: 'create_review',
|
|
|
templateUrl: 'create_review.html',
|
|
@@ -255,9 +270,9 @@ export class ActivityComponent implements OnInit {
|
|
|
],
|
|
|
})
|
|
|
export class CreateReviewGroupContent {
|
|
|
- constructor(private dialogRef: MatDialogRef<CreateReviewGroupContent>) { }
|
|
|
- name: string = ''
|
|
|
+ constructor(private dialogRef: MatDialogRef<CreateReviewGroupContent>) {}
|
|
|
+ name: string = '';
|
|
|
onConfirm() {
|
|
|
- this.dialogRef.close(this.name)
|
|
|
+ this.dialogRef.close(this.name);
|
|
|
}
|
|
|
}
|