固定资产项目前端文件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

2 years ago
import { Component, OnDestroy, OnInit } from '@angular/core'
import { SharedModule } from '../../shared/shared.module'
import { ApiService } from 'app/services'
import { FormBuilder, FormControl, FormGroup } from '@angular/forms'
import { FormValidators } from 'app/utils'
import { NzMessageService } from 'ng-zorro-antd/message'
import { Subscription } from 'rxjs'
@Component({
standalone: true,
imports: [SharedModule],
2 years ago
selector: 'app-profile-basic',
templateUrl: './profile-basic.component.html',
styleUrls: ['./profile-basic.component.less'],
})
export class ProfileBasicComponent implements OnInit, OnDestroy {
constructor(
public api: ApiService,
private fb: FormBuilder,
private msg: NzMessageService,
) {}
formGroup!: FormGroup
ngOnInit(): void {
2 years ago
this.formGroup = this.fb.group({
name: new FormControl('', [FormValidators.required('请输入姓名')]),
remark: new FormControl(''),
})
2 years ago
}
ngOnDestroy(): void {}
public getValues() {
let values = null
if (FormValidators.validateFormGroup(this.formGroup)) {
values = this.formGroup.value
}
return values
}
onSubmit() {
const vals = this.getValues()
if (vals) {
this.api.saveUser({ ...this.api.authInfo, ...vals }).subscribe(() => {
this.msg.success('保存成功')
// this.api.getAuthInfo(true).subscribe(() => {})
2 years ago
})
}
}
}