|
@@ -7,6 +7,23 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|
|
import Parse from 'parse';
|
|
|
import { TextbookComponent } from '../../../app/textbook/textbook.component';
|
|
|
import { textbookServer } from '../../../services/textbook';
|
|
|
+
|
|
|
+import { NzInputModule } from 'ng-zorro-antd/input';
|
|
|
+import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
|
|
|
+import { NzButtonModule } from 'ng-zorro-antd/button';
|
|
|
+import { NzGridModule } from 'ng-zorro-antd/grid';
|
|
|
+import { NzMessageModule } from 'ng-zorro-antd/message';
|
|
|
+import { NzMessageService } from 'ng-zorro-antd/message';
|
|
|
+import { NzRadioModule } from 'ng-zorro-antd/radio';
|
|
|
+import { NzEmptyModule } from 'ng-zorro-antd/empty';
|
|
|
+import { CompUploadComponent } from '../../../app/comp-upload/comp-upload.component';
|
|
|
+import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
|
|
+import { NzIconModule } from 'ng-zorro-antd/icon';
|
|
|
+import { FormsModule } from '@angular/forms';
|
|
|
+import { NzSpinModule } from 'ng-zorro-antd/spin';
|
|
|
+import { MatDialogRef } from '@angular/material/dialog';
|
|
|
+import { DatePipe } from '@angular/common';
|
|
|
+
|
|
|
@Component({
|
|
|
selector: 'app-activity',
|
|
|
templateUrl: './activity.component.html',
|
|
@@ -17,18 +34,33 @@ import { textbookServer } from '../../../services/textbook';
|
|
|
CommonCompModule,
|
|
|
NzTabsModule,
|
|
|
TextbookComponent,
|
|
|
+ NzInputModule,
|
|
|
+ NzDatePickerModule,
|
|
|
+ NzButtonModule,
|
|
|
+ NzGridModule,
|
|
|
+ NzMessageModule,
|
|
|
+ NzRadioModule,
|
|
|
+ NzEmptyModule,
|
|
|
+ CompUploadComponent,
|
|
|
+ MatDialogModule,
|
|
|
+ NzSpinModule,
|
|
|
],
|
|
|
+ providers: [DatePipe],
|
|
|
+
|
|
|
standalone: true,
|
|
|
})
|
|
|
-export class ActivityComponent implements OnInit {
|
|
|
+export class ActivityComponent implements OnInit {
|
|
|
active: number = 0;
|
|
|
eduProcess: Parse.Object | undefined;
|
|
|
constructor(
|
|
|
private activeRoute: ActivatedRoute,
|
|
|
public tbookSer: textbookServer,
|
|
|
- private router: Router
|
|
|
+ private router: Router,
|
|
|
+ private msg: NzMessageService,
|
|
|
+ public dialog: MatDialog
|
|
|
) { }
|
|
|
|
|
|
+ saveLoading = true
|
|
|
ngOnInit() {
|
|
|
this.activeRoute.paramMap.subscribe(async (params) => {
|
|
|
let id = params.get('id');
|
|
@@ -44,6 +76,8 @@ export class ActivityComponent implements OnInit {
|
|
|
);
|
|
|
}
|
|
|
this.eduProcess = res;
|
|
|
+ this.refersh()
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -53,4 +87,142 @@ export class ActivityComponent implements OnInit {
|
|
|
// queryParams: { page: this.activeRoute.snapshot.queryParamMap.get('page') },
|
|
|
// });
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ async refersh() {
|
|
|
+ this.getActivity()
|
|
|
+ this.getExpertGroup()
|
|
|
+ }
|
|
|
+ company: string = localStorage.getItem('company')!
|
|
|
+ /**评审活动 */
|
|
|
+ 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)
|
|
|
+ query.equalTo('company', this.company)
|
|
|
+ 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.saveLoading = false
|
|
|
+ } else {
|
|
|
+ let Activity = Parse.Object.extend('Activity')
|
|
|
+ this.activity = new Activity()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**活动名称 */
|
|
|
+ name: string = ''
|
|
|
+ startDate?: any
|
|
|
+ deadline?: any
|
|
|
+ reset() {
|
|
|
+ this.name = ''
|
|
|
+ this.startDate = null
|
|
|
+ this.deadline = null
|
|
|
+ }
|
|
|
+ /**保存活动 */
|
|
|
+ async save() {
|
|
|
+ if (this.name == '' && !this.name) {
|
|
|
+ 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('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' = 'mean'
|
|
|
+ async changeCalculation() {
|
|
|
+ console.log(this.calculation)
|
|
|
+ this.save()
|
|
|
+ }
|
|
|
+ /**评审细则 */
|
|
|
+ reviewDetails: any
|
|
|
+ async upload(e: any) {
|
|
|
+ console.log(e)
|
|
|
+ let file = e[0]
|
|
|
+ this.reviewDetails = file
|
|
|
+ console.log(this.reviewDetails)
|
|
|
+ if (this.reviewDetails?.url) {
|
|
|
+ this.save()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**评审组 */
|
|
|
+ expertGroupList: Array<Parse.Object> = []
|
|
|
+ async getExpertGroup() {
|
|
|
+ let query = new Parse.Query('ExpertGroup')
|
|
|
+ query.equalTo('eduProcess', this.eduProcess?.id)
|
|
|
+ query.notEqualTo('isDeleted', true)
|
|
|
+ query.descending('createdAt')//大到小
|
|
|
+ this.expertGroupList = await query.find()
|
|
|
+ console.log(this.expertGroupList)
|
|
|
+ }
|
|
|
+ async deleteGroup(index: number) {
|
|
|
+ this.expertGroupList[index].set('isDeleted', true)
|
|
|
+ await this.expertGroupList[index].save()
|
|
|
+ this.expertGroupList.splice(index, 1)
|
|
|
+
|
|
|
+ }
|
|
|
+ /**创建评审组弹框 */
|
|
|
+ creatReviewGroup() {
|
|
|
+ const dialogRef = this.dialog.open(CreateReviewGroupContent, {
|
|
|
+ width: '400px'
|
|
|
+ });
|
|
|
+ let that = this
|
|
|
+ dialogRef.afterClosed().subscribe(async (result) => {
|
|
|
+ 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', '创建成功')
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+@Component({
|
|
|
+ selector: 'create_review',
|
|
|
+ templateUrl: 'create_review.html',
|
|
|
+ standalone: true,
|
|
|
+ imports: [
|
|
|
+ MatDialogModule,
|
|
|
+ NzIconModule,
|
|
|
+ CommonModule,
|
|
|
+ FormsModule,
|
|
|
+ NzInputModule,
|
|
|
+ NzButtonModule,
|
|
|
+ ],
|
|
|
+})
|
|
|
+export class CreateReviewGroupContent {
|
|
|
+ constructor(private dialogRef: MatDialogRef<CreateReviewGroupContent>) { }
|
|
|
+ name: string = ''
|
|
|
+ onConfirm() {
|
|
|
+ this.dialogRef.close(this.name)
|
|
|
+ }
|
|
|
}
|