|
@@ -29,7 +29,8 @@ import { NzRadioModule } from 'ng-zorro-antd/radio';
|
|
|
NzSelectModule,
|
|
|
SubmittedComponent,
|
|
|
MatButtonModule,
|
|
|
- ProfileComponent,NzRadioModule
|
|
|
+ ProfileComponent,
|
|
|
+ NzRadioModule,
|
|
|
],
|
|
|
standalone: true,
|
|
|
})
|
|
@@ -41,8 +42,8 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
@Input('isEdit') isEdit: boolean = false; //当前是否作为编辑子组件
|
|
|
profileId: string = '';
|
|
|
isVisible: boolean = false;
|
|
|
- searchValue:string = '' //搜索部门内容
|
|
|
-
|
|
|
+ searchValue: string = ''; //搜索部门内容
|
|
|
+
|
|
|
validateForm: FormGroup<{
|
|
|
name: FormControl<Array<string> | any>; //流程名称
|
|
|
desc: FormControl<Array<string> | any>; //流程描述
|
|
@@ -57,8 +58,8 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
code: ['', [Validators.required]],
|
|
|
num: ['', [Validators.required]],
|
|
|
branch: ['', [Validators.required]],
|
|
|
- startDate: [new Date(), [Validators.required]],
|
|
|
- deadline: [new Date(), [Validators.required]],
|
|
|
+ startDate: [new Date('2024/07/20'), [Validators.required]],
|
|
|
+ deadline: [new Date('2024-09-20'), [Validators.required]],
|
|
|
});
|
|
|
department: string = ''; //所属单位
|
|
|
unitTypes: Array<any> = []; //单位类型
|
|
@@ -93,22 +94,25 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
desc: [this.eduProcess?.get('desc') || '', [Validators.required]],
|
|
|
code: [this.eduProcess?.get('code') || '', [Validators.required]],
|
|
|
num: [this.eduProcess?.get('num') || '', [Validators.required]],
|
|
|
- branch: [this.eduProcess?.get('branch')?.id || '', [Validators.required]],
|
|
|
+ branch: [
|
|
|
+ this.eduProcess?.get('branch')?.id || '',
|
|
|
+ [Validators.required],
|
|
|
+ ],
|
|
|
startDate: [
|
|
|
this.eduProcess?.get('startDate')
|
|
|
? this.eduProcess?.get('startDate')
|
|
|
- : new Date(),
|
|
|
+ : new Date('2024/07/20'),
|
|
|
[Validators.required],
|
|
|
],
|
|
|
deadline: [
|
|
|
this.eduProcess?.get('deadline')
|
|
|
? this.eduProcess?.get('deadline')
|
|
|
- : new Date(),
|
|
|
+ : new Date('2024-09-20'),
|
|
|
[Validators.required],
|
|
|
],
|
|
|
});
|
|
|
}
|
|
|
- this.profileId = this.eduProcess?.get('profileSubmitteds')?.id || '';
|
|
|
+ this.profileId = this.eduProcess?.get('profileSubmitted')?.id || '';
|
|
|
this.department = this.eduProcess?.get('department')?.id || '';
|
|
|
});
|
|
|
}
|
|
@@ -131,7 +135,7 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
query.limit(100);
|
|
|
val && query.contains('name', val);
|
|
|
let r = await query.find();
|
|
|
- this.parentList = r
|
|
|
+ this.parentList = r;
|
|
|
}
|
|
|
async submitForm(type: string): Promise<void> {
|
|
|
if (type == 'close') {
|
|
@@ -189,12 +193,14 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
this.eduProcess?.set('num', params.num);
|
|
|
this.eduProcess?.set('startDate', params.startDate);
|
|
|
this.eduProcess?.set('deadline', params.deadline);
|
|
|
- let pid = await this.getProfile();
|
|
|
- this.eduProcess?.set('profileSubmitteds', {
|
|
|
- __type: 'Pointer',
|
|
|
- className: 'Profile',
|
|
|
- objectId: pid,
|
|
|
- });
|
|
|
+ if (!this.eduProcess?.get('profileSubmitted')) {
|
|
|
+ let pid = await this.getProfile();
|
|
|
+ this.eduProcess?.set('profileSubmitted', {
|
|
|
+ __type: 'Pointer',
|
|
|
+ className: 'Profile',
|
|
|
+ objectId: pid,
|
|
|
+ });
|
|
|
+ }
|
|
|
this.eduProcess = await this.eduProcess?.save();
|
|
|
this.msg.success(this.isEdit ? '已保存' : '已创建');
|
|
|
this.showProfileFrom = false;
|
|
@@ -210,7 +216,9 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
this.eduProcess?.get('department').id
|
|
|
);
|
|
|
} else {
|
|
|
- let dp = this.unitTypes.find(item=> item.id == this.validateForm.value.branch)
|
|
|
+ let dp = this.unitTypes.find(
|
|
|
+ (item) => item.id == this.validateForm.value.branch
|
|
|
+ );
|
|
|
this.parentMap = [
|
|
|
{
|
|
|
title: dp?.name,
|
|
@@ -238,6 +246,7 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
}
|
|
|
//选择联系人
|
|
|
onShowCheck() {
|
|
|
+ if(this.profileId)return
|
|
|
this.showProfileFrom = true;
|
|
|
}
|
|
|
//获取联系人
|
|
@@ -251,7 +260,7 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
where: {
|
|
|
$or: [
|
|
|
{
|
|
|
- department: { $eq: this.validateForm.value.branch },
|
|
|
+ department: { $eq: this.department },
|
|
|
},
|
|
|
],
|
|
|
},
|
|
@@ -274,7 +283,19 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
}
|
|
|
async changeSubmitted(e: Array<string>) {
|
|
|
console.log(e);
|
|
|
- if (e[0]) this.profileId = e[0];
|
|
|
+ this.profileId = e[0];
|
|
|
+ this.eduProcess?.set(
|
|
|
+ 'profileSubmitted',
|
|
|
+ this.profileId
|
|
|
+ ? {
|
|
|
+ __type: 'Pointer',
|
|
|
+ className: 'Profile',
|
|
|
+ objectId: this.profileId,
|
|
|
+ }
|
|
|
+ : null
|
|
|
+ );
|
|
|
+ await this.eduProcess?.save();
|
|
|
+ this.showProfileFrom = false
|
|
|
}
|
|
|
onCheck(e: any) {
|
|
|
console.log(e);
|
|
@@ -282,17 +303,17 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
//选择部门
|
|
|
async onCheckedDepart(e: any, checked?: boolean) {
|
|
|
console.log(e);
|
|
|
- this.department = e.id
|
|
|
+ this.department = e.id;
|
|
|
}
|
|
|
handleCancel(): void {
|
|
|
console.log('Button cancel clicked!');
|
|
|
this.isVisible = false;
|
|
|
}
|
|
|
- async handleOk():Promise<void> {
|
|
|
+ async handleOk(): Promise<void> {
|
|
|
this.eduProcess?.set('branch', {
|
|
|
__type: 'Pointer',
|
|
|
className: 'Department',
|
|
|
- objectId: this.validateForm.value.branch
|
|
|
+ objectId: this.validateForm.value.branch,
|
|
|
});
|
|
|
this.department &&
|
|
|
this.eduProcess?.set('department', {
|
|
@@ -300,8 +321,8 @@ export class ProcessCreateComponent implements OnInit {
|
|
|
className: 'Department',
|
|
|
objectId: this.department,
|
|
|
});
|
|
|
- await this.eduProcess?.save()
|
|
|
- this.ngOnInit()
|
|
|
+ await this.eduProcess?.save();
|
|
|
+ this.ngOnInit();
|
|
|
this.isVisible = false;
|
|
|
}
|
|
|
}
|