37 changed files with 1529 additions and 110 deletions
@ -0,0 +1,103 @@ |
|||||
|
import { Component, Input, OnInit, inject } from '@angular/core' |
||||
|
import { FormBuilder, FormGroup } from '@angular/forms' |
||||
|
import { ApiService } from 'app/services' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
import { FormValidators, Utils } from 'app/utils' |
||||
|
import { NzMessageService } from 'ng-zorro-antd/message' |
||||
|
import { OrgSelectComponent } from '../../org-select/org-select.component' |
||||
|
import { SelectUserByOrgComponent } from '../../select-user-by-org/select-user-by-org.component' |
||||
|
import { PositionSelectComponent } from '../../position-select/position-select.component' |
||||
|
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
||||
|
import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' |
||||
|
import { SupplierSelectComponent } from '../../supplier-select/supplier-select.component' |
||||
|
import { AssetSelectComponent } from '../../asset-select/asset-select.component' |
||||
|
import { WarehouseSelectComponent } from '../../warehouse-select/warehouse-select.component' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-asset-employee-apply', |
||||
|
standalone: true, |
||||
|
imports: [ |
||||
|
SharedModule, |
||||
|
SelectUserByOrgComponent, |
||||
|
SupplierSelectComponent, |
||||
|
AssetSelectComponent, |
||||
|
OrgSelectComponent, |
||||
|
PositionSelectComponent, |
||||
|
WarehouseSelectComponent, |
||||
|
], |
||||
|
templateUrl: './asset-employee-apply.component.html', |
||||
|
styleUrl: './asset-employee-apply.component.less', |
||||
|
}) |
||||
|
export class AssetEmployeeApplyComponent { |
||||
|
constructor( |
||||
|
private fb: FormBuilder, |
||||
|
private api: ApiService, |
||||
|
private msg: NzMessageService, |
||||
|
) {} |
||||
|
|
||||
|
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
||||
|
|
||||
|
formGroup!: FormGroup |
||||
|
|
||||
|
groupIndex = 0 |
||||
|
|
||||
|
uploadLoading = false |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
console.log('this.data', this.data) |
||||
|
this.formGroup = this.fb.group({ |
||||
|
id: this.fb.control(null, []), |
||||
|
title: this.fb.control(this.data.value?.name, [FormValidators.required('请输入')]), |
||||
|
// useUserId: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
applyDepartmentId: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
applicant: this.fb.control({ value: this.api.authInfo?.userName, disabled: true }, [ |
||||
|
FormValidators.required('请选择'), |
||||
|
]), |
||||
|
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
|
||||
|
notes: this.fb.control(null, [FormValidators.required('请输入')]), |
||||
|
urgency: this.fb.control(1, []), |
||||
|
}) |
||||
|
|
||||
|
this.patchValues() |
||||
|
} |
||||
|
|
||||
|
patchValues() { |
||||
|
const { value: data, preview } = this.data |
||||
|
if (data) { |
||||
|
this.formGroup.patchValue({ |
||||
|
...data.procVars, |
||||
|
applyDepartmentId: data.procVars?.applyDepartmentId + '', |
||||
|
}) |
||||
|
} |
||||
|
if (preview) { |
||||
|
this.formGroup.disable() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public getValues() { |
||||
|
let values = null |
||||
|
if (FormValidators.validateFormGroup(this.formGroup)) { |
||||
|
const v = this.formGroup.value |
||||
|
|
||||
|
values = { |
||||
|
...v, |
||||
|
|
||||
|
applyDepartmentId: Number(v.applyDepartmentId?.[0]), |
||||
|
} |
||||
|
} |
||||
|
return values |
||||
|
} |
||||
|
|
||||
|
onFileChange(e: Event) { |
||||
|
const target = e.target as HTMLInputElement |
||||
|
const file = target.files![0] |
||||
|
target.value = '' |
||||
|
|
||||
|
const formdata = new FormData() |
||||
|
formdata.append('file', file) |
||||
|
this.api.upload(formdata).subscribe((res) => { |
||||
|
this.formGroup.get('attach')?.setValue(res.body.fileName) |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
<div class="modal-lg-container"> |
||||
|
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
||||
|
<div class="overflow-hidden"> |
||||
|
<div nz-row [nzGutter]="24"> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>流程标题</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入流程标题" formControlName="title" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请部门</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-org-select formControlName="applyDepartmentId" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请人</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入申请人" formControlName="applicant" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>紧急程度</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-radio-group formControlName="urgency"> |
||||
|
<label nz-radio [nzValue]="1">普通</label> |
||||
|
<label nz-radio [nzValue]="2">紧急</label> |
||||
|
</nz-radio-group> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label [nzRequired]="true">原因</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入原因" formControlName="notes"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>资产列表</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-asset-select formControlName="assetIdList" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<ng-template #errorTpl let-control> |
||||
|
<form-error-tips [control]="control"></form-error-tips> |
||||
|
</ng-template> |
||||
|
</div> |
@ -0,0 +1,88 @@ |
|||||
|
<div class="modal-lg-container"> |
||||
|
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
||||
|
<div class="overflow-hidden"> |
||||
|
<div nz-row [nzGutter]="24"> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>流程标题</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入流程标题" formControlName="title" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>紧急程度</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-radio-group formControlName="urgency"> |
||||
|
<label nz-radio [nzValue]="1">普通</label> |
||||
|
<label nz-radio [nzValue]="2">紧急</label> |
||||
|
</nz-radio-group> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请部门</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-org-select formControlName="applyDepartmentId" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请人</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入申请人" formControlName="applicant" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>交接部门</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-org-select formControlName="handoverDepartmentId" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>交接人</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-select-user-by-org formControlName="handoverUserId" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label [nzRequired]="true">内容</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入内容" formControlName="content"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>备注</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入备注" formControlName="notes"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>资产列表</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-asset-select formControlName="assetIdList" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<ng-template #errorTpl let-control> |
||||
|
<form-error-tips [control]="control"></form-error-tips> |
||||
|
</ng-template> |
||||
|
</div> |
@ -0,0 +1,108 @@ |
|||||
|
import { Component, Input, OnInit, inject } from '@angular/core' |
||||
|
import { FormBuilder, FormGroup } from '@angular/forms' |
||||
|
import { ApiService } from 'app/services' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
import { FormValidators, Utils } from 'app/utils' |
||||
|
import { NzMessageService } from 'ng-zorro-antd/message' |
||||
|
import { OrgSelectComponent } from '../../org-select/org-select.component' |
||||
|
import { SelectUserByOrgComponent } from '../../select-user-by-org/select-user-by-org.component' |
||||
|
import { PositionSelectComponent } from '../../position-select/position-select.component' |
||||
|
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
||||
|
import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' |
||||
|
import { SupplierSelectComponent } from '../../supplier-select/supplier-select.component' |
||||
|
import { AssetSelectComponent } from '../../asset-select/asset-select.component' |
||||
|
import { WarehouseSelectComponent } from '../../warehouse-select/warehouse-select.component' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-eam-asset-employee-handover', |
||||
|
standalone: true, |
||||
|
imports: [ |
||||
|
SharedModule, |
||||
|
SelectUserByOrgComponent, |
||||
|
SupplierSelectComponent, |
||||
|
AssetSelectComponent, |
||||
|
OrgSelectComponent, |
||||
|
PositionSelectComponent, |
||||
|
WarehouseSelectComponent, |
||||
|
], |
||||
|
templateUrl: './eam-asset-employee-handover.component.html', |
||||
|
styleUrl: './eam-asset-employee-handover.component.less', |
||||
|
}) |
||||
|
export class EamAssetEmployeeHandoverComponent { |
||||
|
constructor( |
||||
|
private fb: FormBuilder, |
||||
|
private api: ApiService, |
||||
|
private msg: NzMessageService, |
||||
|
) {} |
||||
|
|
||||
|
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
||||
|
|
||||
|
formGroup!: FormGroup |
||||
|
|
||||
|
groupIndex = 0 |
||||
|
|
||||
|
uploadLoading = false |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
this.formGroup = this.fb.group({ |
||||
|
id: this.fb.control(null, []), |
||||
|
title: this.fb.control(this.data.value?.name, [FormValidators.required('请输入')]), |
||||
|
// useUserId: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
applyDepartmentId: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
handoverDepartmentId: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
handoverUserId: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
applicant: this.fb.control({ value: this.api.authInfo?.userName, disabled: true }, [ |
||||
|
FormValidators.required('请选择'), |
||||
|
]), |
||||
|
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
|
||||
|
content: this.fb.control(null, [FormValidators.required('请输入')]), |
||||
|
notes: this.fb.control(null, []), |
||||
|
urgency: this.fb.control(1, []), |
||||
|
assetIdList: this.fb.control([], []), |
||||
|
}) |
||||
|
|
||||
|
this.patchValues() |
||||
|
} |
||||
|
|
||||
|
patchValues() { |
||||
|
const { value: data, preview } = this.data |
||||
|
if (data) { |
||||
|
this.formGroup.patchValue({ |
||||
|
...data.procVars, |
||||
|
handoverUserId: data.procVars?.handoverUserId ? [data.procVars?.handoverUserId] : [], |
||||
|
applyDepartmentId: data.procVars?.applyDepartmentId + '', |
||||
|
handoverDepartmentId: data.procVars?.handoverDepartmentId + '', |
||||
|
}) |
||||
|
} |
||||
|
if (preview) { |
||||
|
this.formGroup.disable() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public getValues() { |
||||
|
let values = null |
||||
|
if (FormValidators.validateFormGroup(this.formGroup)) { |
||||
|
const v = this.formGroup.value |
||||
|
|
||||
|
values = { |
||||
|
...v, |
||||
|
handoverUserId: Number(v.handoverUserId?.[0]), |
||||
|
applyDepartmentId: Number(v.applyDepartmentId?.[0]), |
||||
|
} |
||||
|
} |
||||
|
return values |
||||
|
} |
||||
|
|
||||
|
onFileChange(e: Event) { |
||||
|
const target = e.target as HTMLInputElement |
||||
|
const file = target.files![0] |
||||
|
target.value = '' |
||||
|
|
||||
|
const formdata = new FormData() |
||||
|
formdata.append('file', file) |
||||
|
this.api.upload(formdata).subscribe((res) => { |
||||
|
this.formGroup.get('attach')?.setValue(res.body.fileName) |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,80 @@ |
|||||
|
<div class="modal-lg-container"> |
||||
|
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
||||
|
<div class="overflow-hidden"> |
||||
|
<div nz-row [nzGutter]="24"> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>流程标题</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入流程标题" formControlName="title" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请部门</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-org-select formControlName="applyDepartmentId" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请人</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入申请人" formControlName="applicant" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>紧急程度</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-radio-group formControlName="urgency"> |
||||
|
<label nz-radio [nzValue]="1">普通</label> |
||||
|
<label nz-radio [nzValue]="2">紧急</label> |
||||
|
</nz-radio-group> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label [nzRequired]="true">原因</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入原因" formControlName="notes"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>图片</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input type="hidden" nz-input formControlName="img" /> |
||||
|
<div class="mb-2" *ngIf="iconPreview"> |
||||
|
<img [src]="iconPreview" class="h-20 w-20" /> |
||||
|
</div> |
||||
|
<button class="upload-btn" nz-button [nzLoading]="uploadLoading"> |
||||
|
<i nz-icon nzType="upload"></i> |
||||
|
上传图片 |
||||
|
<input type="file" (change)="onFileChange($event)" accept=".jpg,.jpeg,.png" /> |
||||
|
</button> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>资产列表</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-asset-select formControlName="assetIdList" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<ng-template #errorTpl let-control> |
||||
|
<form-error-tips [control]="control"></form-error-tips> |
||||
|
</ng-template> |
||||
|
</div> |
@ -0,0 +1,107 @@ |
|||||
|
import { Component, Input, OnInit, inject } from '@angular/core' |
||||
|
import { FormBuilder, FormGroup } from '@angular/forms' |
||||
|
import { ApiService } from 'app/services' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
import { FormValidators, Utils } from 'app/utils' |
||||
|
import { NzMessageService } from 'ng-zorro-antd/message' |
||||
|
import { OrgSelectComponent } from '../../org-select/org-select.component' |
||||
|
import { SelectUserByOrgComponent } from '../../select-user-by-org/select-user-by-org.component' |
||||
|
import { PositionSelectComponent } from '../../position-select/position-select.component' |
||||
|
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
||||
|
import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' |
||||
|
import { SupplierSelectComponent } from '../../supplier-select/supplier-select.component' |
||||
|
import { AssetSelectComponent } from '../../asset-select/asset-select.component' |
||||
|
import { WarehouseSelectComponent } from '../../warehouse-select/warehouse-select.component' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-eam-asset-employee-repair', |
||||
|
standalone: true, |
||||
|
imports: [ |
||||
|
SharedModule, |
||||
|
SelectUserByOrgComponent, |
||||
|
SupplierSelectComponent, |
||||
|
AssetSelectComponent, |
||||
|
OrgSelectComponent, |
||||
|
PositionSelectComponent, |
||||
|
WarehouseSelectComponent, |
||||
|
], |
||||
|
templateUrl: './eam-asset-employee-repair.component.html', |
||||
|
styleUrl: './eam-asset-employee-repair.component.less', |
||||
|
}) |
||||
|
export class EamAssetEmployeeRepairComponent { |
||||
|
constructor( |
||||
|
private fb: FormBuilder, |
||||
|
private api: ApiService, |
||||
|
private msg: NzMessageService, |
||||
|
) {} |
||||
|
|
||||
|
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
||||
|
|
||||
|
formGroup!: FormGroup |
||||
|
|
||||
|
groupIndex = 0 |
||||
|
|
||||
|
uploadLoading = false |
||||
|
|
||||
|
iconPreview = '' |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
this.formGroup = this.fb.group({ |
||||
|
id: this.fb.control(null, []), |
||||
|
title: this.fb.control(this.data.value?.name, [FormValidators.required('请输入')]), |
||||
|
// useUserId: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
applyDepartmentId: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
applicant: this.fb.control({ value: this.api.authInfo?.userName, disabled: true }, [ |
||||
|
FormValidators.required('请选择'), |
||||
|
]), |
||||
|
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
|
||||
|
notes: this.fb.control(null, [FormValidators.required('请输入')]), |
||||
|
urgency: this.fb.control(1, []), |
||||
|
assetIdList: this.fb.control([], []), |
||||
|
img: this.fb.control(null, []), |
||||
|
}) |
||||
|
|
||||
|
this.patchValues() |
||||
|
} |
||||
|
|
||||
|
patchValues() { |
||||
|
const { value: data, preview } = this.data |
||||
|
if (data) { |
||||
|
this.iconPreview = data.procVars?.img |
||||
|
this.formGroup.patchValue({ |
||||
|
...data.procVars, |
||||
|
applyDepartmentId: data.procVars?.applyDepartmentId + '', |
||||
|
}) |
||||
|
} |
||||
|
if (preview) { |
||||
|
this.formGroup.disable() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public getValues() { |
||||
|
let values = null |
||||
|
if (FormValidators.validateFormGroup(this.formGroup)) { |
||||
|
const v = this.formGroup.value |
||||
|
|
||||
|
values = { |
||||
|
...v, |
||||
|
|
||||
|
applyDepartmentId: Number(v.applyDepartmentId?.[0]), |
||||
|
} |
||||
|
} |
||||
|
return values |
||||
|
} |
||||
|
|
||||
|
onFileChange(e: Event) { |
||||
|
const target = e.target as HTMLInputElement |
||||
|
const file = target.files![0] |
||||
|
target.value = '' |
||||
|
|
||||
|
const formdata = new FormData() |
||||
|
formdata.append('file', file) |
||||
|
this.api.upload(formdata).subscribe((res) => { |
||||
|
this.formGroup.get('img')?.setValue(res.body.fileName) |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,95 @@ |
|||||
|
<div class="modal-lg-container"> |
||||
|
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
||||
|
<div class="overflow-hidden"> |
||||
|
<div nz-row [nzGutter]="24"> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>流程标题</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入流程标题" formControlName="title" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>报废方式</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-select nzPlaceHolder="请选择报废方式" formControlName="scrapType"> |
||||
|
<nz-option nzLabel="损坏" [nzValue]="1"></nz-option> |
||||
|
<nz-option nzLabel="过期" [nzValue]="2"></nz-option> |
||||
|
<nz-option nzLabel="丢失" [nzValue]="3"></nz-option> |
||||
|
</nz-select> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>报废时间</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-date-picker class="w-full" nzPlaceHolder="请选择报废时间" formControlName="scrapTime" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请人</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入申请人" formControlName="applicant" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>紧急程度</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-radio-group formControlName="urgency"> |
||||
|
<label nz-radio [nzValue]="1">普通</label> |
||||
|
<label nz-radio [nzValue]="2">紧急</label> |
||||
|
</nz-radio-group> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label [nzRequired]="true">原因</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入原因" formControlName="notes"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>附件</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<button class="upload-btn" nz-button [nzLoading]="uploadLoading"> |
||||
|
<i nz-icon nzType="upload"></i> |
||||
|
选择文件 |
||||
|
<input type="file" (change)="onFileChange($event)" /> |
||||
|
</button> |
||||
|
@if (formGroup.get('attach')?.value) { |
||||
|
<div class="mt-1"> |
||||
|
<nz-tag class="break-words w-full !whitespace-pre-wrap"> |
||||
|
{{ formGroup.get('attach')?.value }} |
||||
|
</nz-tag> |
||||
|
</div> |
||||
|
} |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>资产列表</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-asset-select formControlName="assetIdList" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<ng-template #errorTpl let-control> |
||||
|
<form-error-tips [control]="control"></form-error-tips> |
||||
|
</ng-template> |
||||
|
</div> |
@ -0,0 +1,108 @@ |
|||||
|
import { Component, Input, OnInit, inject } from '@angular/core' |
||||
|
import { FormBuilder, FormGroup } from '@angular/forms' |
||||
|
import { ApiService } from 'app/services' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
import { FormValidators, Utils } from 'app/utils' |
||||
|
import { NzMessageService } from 'ng-zorro-antd/message' |
||||
|
import { OrgSelectComponent } from '../../org-select/org-select.component' |
||||
|
import { SelectUserByOrgComponent } from '../../select-user-by-org/select-user-by-org.component' |
||||
|
import { PositionSelectComponent } from '../../position-select/position-select.component' |
||||
|
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
||||
|
import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' |
||||
|
import { SupplierSelectComponent } from '../../supplier-select/supplier-select.component' |
||||
|
import { AssetSelectComponent } from '../../asset-select/asset-select.component' |
||||
|
import { WarehouseSelectComponent } from '../../warehouse-select/warehouse-select.component' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-eam-asset-employee-scrap', |
||||
|
standalone: true, |
||||
|
imports: [ |
||||
|
SharedModule, |
||||
|
SelectUserByOrgComponent, |
||||
|
SupplierSelectComponent, |
||||
|
AssetSelectComponent, |
||||
|
OrgSelectComponent, |
||||
|
PositionSelectComponent, |
||||
|
WarehouseSelectComponent, |
||||
|
], |
||||
|
templateUrl: './eam-asset-employee-scrap.component.html', |
||||
|
styleUrl: './eam-asset-employee-scrap.component.less', |
||||
|
}) |
||||
|
export class EamAssetEmployeeScrapComponent { |
||||
|
constructor( |
||||
|
private fb: FormBuilder, |
||||
|
private api: ApiService, |
||||
|
private msg: NzMessageService, |
||||
|
) {} |
||||
|
|
||||
|
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
||||
|
|
||||
|
formGroup!: FormGroup |
||||
|
|
||||
|
groupIndex = 0 |
||||
|
|
||||
|
uploadLoading = false |
||||
|
|
||||
|
iconPreview = '' |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
this.formGroup = this.fb.group({ |
||||
|
id: this.fb.control(null, []), |
||||
|
title: this.fb.control(this.data.value?.name, [FormValidators.required('请输入')]), |
||||
|
// useUserId: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
scrapType: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
scrapTime: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
applicant: this.fb.control({ value: this.api.authInfo?.userName, disabled: true }, [ |
||||
|
FormValidators.required('请选择'), |
||||
|
]), |
||||
|
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
|
||||
|
notes: this.fb.control(null, [FormValidators.required('请输入')]), |
||||
|
urgency: this.fb.control(1, []), |
||||
|
assetIdList: this.fb.control([], []), |
||||
|
attach: this.fb.control(null, []), |
||||
|
}) |
||||
|
|
||||
|
this.patchValues() |
||||
|
} |
||||
|
|
||||
|
patchValues() { |
||||
|
const { value: data, preview } = this.data |
||||
|
if (data) { |
||||
|
this.iconPreview = data.procVars?.img |
||||
|
this.formGroup.patchValue({ |
||||
|
...data.procVars, |
||||
|
applyDepartmentId: data.procVars?.applyDepartmentId + '', |
||||
|
}) |
||||
|
} |
||||
|
if (preview) { |
||||
|
this.formGroup.disable() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public getValues() { |
||||
|
let values = null |
||||
|
if (FormValidators.validateFormGroup(this.formGroup)) { |
||||
|
const v = this.formGroup.value |
||||
|
|
||||
|
values = { |
||||
|
...v, |
||||
|
|
||||
|
// applyDepartmentId: Number(v.applyDepartmentId?.[0]),
|
||||
|
} |
||||
|
} |
||||
|
return values |
||||
|
} |
||||
|
|
||||
|
onFileChange(e: Event) { |
||||
|
const target = e.target as HTMLInputElement |
||||
|
const file = target.files![0] |
||||
|
target.value = '' |
||||
|
|
||||
|
const formdata = new FormData() |
||||
|
formdata.append('file', file) |
||||
|
this.api.upload(formdata).subscribe((res) => { |
||||
|
this.formGroup.get('attach')?.setValue(res.body.fileName) |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,105 @@ |
|||||
|
<div class="modal-lg-container"> |
||||
|
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
||||
|
<div class="overflow-hidden"> |
||||
|
<div nz-row [nzGutter]="24"> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>流程标题</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入流程标题" formControlName="title" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>紧急程度</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-radio-group formControlName="urgency"> |
||||
|
<label nz-radio [nzValue]="1">普通</label> |
||||
|
<label nz-radio [nzValue]="2">紧急</label> |
||||
|
</nz-radio-group> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>报修部门</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-org-select formControlName="repairDepartmentId" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>报修人</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-select-user-by-org formControlName="repairer" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>维修类型</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-radio-group formControlName="repairType"> |
||||
|
<label nz-radio [nzValue]="1">自修</label> |
||||
|
<label nz-radio [nzValue]="2">外部维修</label> |
||||
|
</nz-radio-group> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>计划完成时间</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-date-picker |
||||
|
class="w-full" |
||||
|
nzPlaceHolder="请选择计划完成时间" |
||||
|
formControlName="planCompleteTime" |
||||
|
/> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label [nzRequired]="true">报修内容</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入报修内容" formControlName="content"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>图片</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input type="hidden" nz-input formControlName="img" /> |
||||
|
<div class="mb-2" *ngIf="iconPreview"> |
||||
|
<img [src]="iconPreview" class="h-20 w-20" /> |
||||
|
</div> |
||||
|
<button class="upload-btn" nz-button [nzLoading]="uploadLoading"> |
||||
|
<i nz-icon nzType="upload"></i> |
||||
|
上传图片 |
||||
|
<input type="file" (change)="onFileChange($event)" accept=".jpg,.jpeg,.png" /> |
||||
|
</button> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>资产列表</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-asset-select formControlName="assetIdList" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<ng-template #errorTpl let-control> |
||||
|
<form-error-tips [control]="control"></form-error-tips> |
||||
|
</ng-template> |
||||
|
</div> |
@ -0,0 +1,113 @@ |
|||||
|
import { Component, Input, OnInit, inject } from '@angular/core' |
||||
|
import { FormBuilder, FormGroup } from '@angular/forms' |
||||
|
import { ApiService } from 'app/services' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
import { FormValidators, Utils } from 'app/utils' |
||||
|
import { NzMessageService } from 'ng-zorro-antd/message' |
||||
|
import { OrgSelectComponent } from '../../org-select/org-select.component' |
||||
|
import { SelectUserByOrgComponent } from '../../select-user-by-org/select-user-by-org.component' |
||||
|
import { PositionSelectComponent } from '../../position-select/position-select.component' |
||||
|
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
||||
|
import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' |
||||
|
import { SupplierSelectComponent } from '../../supplier-select/supplier-select.component' |
||||
|
import { AssetSelectComponent } from '../../asset-select/asset-select.component' |
||||
|
import { WarehouseSelectComponent } from '../../warehouse-select/warehouse-select.component' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-eam-asset-equipment-repair', |
||||
|
standalone: true, |
||||
|
imports: [ |
||||
|
SharedModule, |
||||
|
SelectUserByOrgComponent, |
||||
|
SupplierSelectComponent, |
||||
|
AssetSelectComponent, |
||||
|
OrgSelectComponent, |
||||
|
PositionSelectComponent, |
||||
|
WarehouseSelectComponent, |
||||
|
], |
||||
|
templateUrl: './eam-asset-equipment-repair.component.html', |
||||
|
styleUrl: './eam-asset-equipment-repair.component.less', |
||||
|
}) |
||||
|
export class EamAssetEquipmentRepairComponent { |
||||
|
constructor( |
||||
|
private fb: FormBuilder, |
||||
|
private api: ApiService, |
||||
|
private msg: NzMessageService, |
||||
|
) {} |
||||
|
|
||||
|
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
||||
|
|
||||
|
formGroup!: FormGroup |
||||
|
|
||||
|
groupIndex = 0 |
||||
|
|
||||
|
uploadLoading = false |
||||
|
|
||||
|
iconPreview = '' |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
this.formGroup = this.fb.group({ |
||||
|
id: this.fb.control(null, []), |
||||
|
title: this.fb.control(this.data.value?.name, [FormValidators.required('请输入')]), |
||||
|
|
||||
|
repairDepartmentId: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
applicant: this.fb.control({ value: this.api.authInfo?.userName, disabled: true }, [ |
||||
|
FormValidators.required('请选择'), |
||||
|
]), |
||||
|
urgency: this.fb.control(1, []), |
||||
|
assetIdList: this.fb.control([], []), |
||||
|
img: this.fb.control(null, []), |
||||
|
planCompleteTime: this.fb.control(null), |
||||
|
content: this.fb.control(null, [FormValidators.required('请输入')]), |
||||
|
repairer: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
repairType: this.fb.control(1, [FormValidators.required('请选择')]), |
||||
|
|
||||
|
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
|
||||
|
notes: this.fb.control(null, []), |
||||
|
}) |
||||
|
|
||||
|
this.patchValues() |
||||
|
} |
||||
|
|
||||
|
patchValues() { |
||||
|
const { value: data, preview } = this.data |
||||
|
if (data) { |
||||
|
this.iconPreview = data.procVars?.img |
||||
|
this.formGroup.patchValue({ |
||||
|
...data.procVars, |
||||
|
repairDepartmentId: data.procVars?.repairDepartmentId + '', |
||||
|
}) |
||||
|
} |
||||
|
if (preview) { |
||||
|
this.formGroup.disable() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public getValues() { |
||||
|
let values = null |
||||
|
if (FormValidators.validateFormGroup(this.formGroup)) { |
||||
|
const v = this.formGroup.value |
||||
|
|
||||
|
values = { |
||||
|
...v, |
||||
|
|
||||
|
repairer: Number(v.repairer?.[0]), |
||||
|
applyDepartmentId: Number(v.applyDepartmentId?.[0]), |
||||
|
} |
||||
|
} |
||||
|
return values |
||||
|
} |
||||
|
|
||||
|
onFileChange(e: Event) { |
||||
|
const target = e.target as HTMLInputElement |
||||
|
const file = target.files![0] |
||||
|
target.value = '' |
||||
|
|
||||
|
const formdata = new FormData() |
||||
|
formdata.append('file', file) |
||||
|
this.api.upload(formdata).subscribe((res) => { |
||||
|
this.formGroup.get('img')?.setValue(res.body.fileName) |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,139 @@ |
|||||
|
<div class="modal-lg-container"> |
||||
|
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
||||
|
<div class="overflow-hidden"> |
||||
|
<div nz-row [nzGutter]="24"> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>流程标题</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入流程标题" formControlName="title" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请部门</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-org-select formControlName="applyDepartmentId" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>申请人</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入申请人" formControlName="applicant" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>紧急程度</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-radio-group formControlName="urgency"> |
||||
|
<label nz-radio [nzValue]="1">普通</label> |
||||
|
<label nz-radio [nzValue]="2">紧急</label> |
||||
|
</nz-radio-group> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>业务名称</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入流程标题" formControlName="businessName" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>采购人</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-select-user-by-org formControlName="purchase" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>采购日期</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-date-picker |
||||
|
class="w-full" |
||||
|
nzPlaceHolder="请选择采购日期" |
||||
|
formControlName="purchaseTime" |
||||
|
/> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>供应商</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-supplier-select formControlName="supplier" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>到货日期</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-date-picker |
||||
|
class="w-full" |
||||
|
nzPlaceHolder="请选择到货日期" |
||||
|
formControlName="arrivalTime" |
||||
|
/> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label [nzRequired]="true">说明</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入说明" formControlName="desc"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>备注</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入原因" formControlName="notes"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>附件</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<button class="upload-btn" nz-button [nzLoading]="uploadLoading"> |
||||
|
<i nz-icon nzType="upload"></i> |
||||
|
选择文件 |
||||
|
<input type="file" (change)="onFileChange($event)" /> |
||||
|
</button> |
||||
|
@if (formGroup.get('attach')?.value) { |
||||
|
<div class="mt-1"> |
||||
|
<nz-tag class="break-words w-full !whitespace-pre-wrap"> |
||||
|
{{ formGroup.get('attach')?.value }} |
||||
|
</nz-tag> |
||||
|
</div> |
||||
|
} |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>资产列表</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-asset-select formControlName="assetIdList" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<ng-template #errorTpl let-control> |
||||
|
<form-error-tips [control]="control"></form-error-tips> |
||||
|
</ng-template> |
||||
|
</div> |
@ -0,0 +1,114 @@ |
|||||
|
import { Component, Input, OnInit, inject } from '@angular/core' |
||||
|
import { FormBuilder, FormGroup } from '@angular/forms' |
||||
|
import { ApiService } from 'app/services' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
import { FormValidators, Utils } from 'app/utils' |
||||
|
import { NzMessageService } from 'ng-zorro-antd/message' |
||||
|
import { OrgSelectComponent } from '../../org-select/org-select.component' |
||||
|
import { SelectUserByOrgComponent } from '../../select-user-by-org/select-user-by-org.component' |
||||
|
import { PositionSelectComponent } from '../../position-select/position-select.component' |
||||
|
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
||||
|
import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' |
||||
|
import { SupplierSelectComponent } from '../../supplier-select/supplier-select.component' |
||||
|
import { AssetSelectComponent } from '../../asset-select/asset-select.component' |
||||
|
import { WarehouseSelectComponent } from '../../warehouse-select/warehouse-select.component' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-eam-asset-purchase-apply', |
||||
|
standalone: true, |
||||
|
imports: [ |
||||
|
SharedModule, |
||||
|
SelectUserByOrgComponent, |
||||
|
SupplierSelectComponent, |
||||
|
AssetSelectComponent, |
||||
|
OrgSelectComponent, |
||||
|
PositionSelectComponent, |
||||
|
WarehouseSelectComponent, |
||||
|
], |
||||
|
templateUrl: './eam-asset-purchase-apply.component.html', |
||||
|
styleUrl: './eam-asset-purchase-apply.component.less', |
||||
|
}) |
||||
|
export class EamAssetPurchaseApplyComponent { |
||||
|
constructor( |
||||
|
private fb: FormBuilder, |
||||
|
private api: ApiService, |
||||
|
private msg: NzMessageService, |
||||
|
) {} |
||||
|
|
||||
|
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
||||
|
|
||||
|
formGroup!: FormGroup |
||||
|
|
||||
|
groupIndex = 0 |
||||
|
|
||||
|
uploadLoading = false |
||||
|
|
||||
|
iconPreview = '' |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
this.formGroup = this.fb.group({ |
||||
|
id: this.fb.control(null, []), |
||||
|
title: this.fb.control(this.data.value?.name, [FormValidators.required('请输入')]), |
||||
|
businessName: this.fb.control('', [FormValidators.required('请输入')]), |
||||
|
applyDepartmentId: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
// useUserId: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
purchaseTime: this.fb.control(null, []), |
||||
|
purchase: this.fb.control(null, []), |
||||
|
arrivalTime: this.fb.control(null), |
||||
|
supplier: this.fb.control(null), |
||||
|
applicant: this.fb.control({ value: this.api.authInfo?.userName, disabled: true }, [ |
||||
|
FormValidators.required('请选择'), |
||||
|
]), |
||||
|
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
|
||||
|
desc: this.fb.control(null, [FormValidators.required('请输入')]), |
||||
|
notes: this.fb.control(null, []), |
||||
|
urgency: this.fb.control(1, []), |
||||
|
assetIdList: this.fb.control([], []), |
||||
|
attach: this.fb.control(null, []), |
||||
|
}) |
||||
|
|
||||
|
this.patchValues() |
||||
|
} |
||||
|
|
||||
|
patchValues() { |
||||
|
const { value: data, preview } = this.data |
||||
|
if (data) { |
||||
|
this.iconPreview = data.procVars?.img |
||||
|
this.formGroup.patchValue({ |
||||
|
...data.procVars, |
||||
|
applyDepartmentId: data.procVars?.applyDepartmentId + '', |
||||
|
}) |
||||
|
} |
||||
|
if (preview) { |
||||
|
this.formGroup.disable() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public getValues() { |
||||
|
let values = null |
||||
|
if (FormValidators.validateFormGroup(this.formGroup)) { |
||||
|
const v = this.formGroup.value |
||||
|
|
||||
|
values = { |
||||
|
...v, |
||||
|
|
||||
|
purchase: Number(v.purchase?.[0]), |
||||
|
applyDepartmentId: Number(v.applyDepartmentId?.[0]), |
||||
|
} |
||||
|
} |
||||
|
return values |
||||
|
} |
||||
|
|
||||
|
onFileChange(e: Event) { |
||||
|
const target = e.target as HTMLInputElement |
||||
|
const file = target.files![0] |
||||
|
target.value = '' |
||||
|
|
||||
|
const formdata = new FormData() |
||||
|
formdata.append('file', file) |
||||
|
this.api.upload(formdata).subscribe((res) => { |
||||
|
this.formGroup.get('attach')?.setValue(res.body.fileName) |
||||
|
}) |
||||
|
} |
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
<div class="modal-lg-container"> |
||||
|
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
||||
|
<div class="overflow-hidden"> |
||||
|
<div nz-row [nzGutter]="24"> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>流程标题</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<input nz-input placeholder="请输入流程标题" formControlName="title" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>业务日期</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-date-picker class="w-full" formControlName="businessDate"></nz-date-picker> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="6"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label nzRequired>紧急程度</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<nz-radio-group formControlName="urgency"> |
||||
|
<label nz-radio [nzValue]="1">普通</label> |
||||
|
<label nz-radio [nzValue]="2">紧急</label> |
||||
|
</nz-radio-group> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label [nzRequired]="true">领用说明</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<textarea nz-input placeholder="请输入领用说明" formControlName="notes"></textarea> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
<div nz-col [nzSpan]="24"> |
||||
|
<nz-form-item> |
||||
|
<nz-form-label>资产列表</nz-form-label> |
||||
|
<nz-form-control [nzErrorTip]="errorTpl"> |
||||
|
<app-asset-select formControlName="assetIdList" /> |
||||
|
</nz-form-control> |
||||
|
</nz-form-item> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
|
||||
|
<ng-template #errorTpl let-control> |
||||
|
<form-error-tips [control]="control"></form-error-tips> |
||||
|
</ng-template> |
||||
|
</div> |
@ -0,0 +1,103 @@ |
|||||
|
import { Component, Input, OnInit, inject } from '@angular/core' |
||||
|
import { FormBuilder, FormGroup } from '@angular/forms' |
||||
|
import { ApiService } from 'app/services' |
||||
|
import { SharedModule } from 'app/shared/shared.module' |
||||
|
import { FormValidators, Utils } from 'app/utils' |
||||
|
import { NzMessageService } from 'ng-zorro-antd/message' |
||||
|
import { OrgSelectComponent } from '../../org-select/org-select.component' |
||||
|
import { SelectUserByOrgComponent } from '../../select-user-by-org/select-user-by-org.component' |
||||
|
import { PositionSelectComponent } from '../../position-select/position-select.component' |
||||
|
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
||||
|
import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' |
||||
|
import { SupplierSelectComponent } from '../../supplier-select/supplier-select.component' |
||||
|
import { AssetSelectComponent } from '../../asset-select/asset-select.component' |
||||
|
import { WarehouseSelectComponent } from '../../warehouse-select/warehouse-select.component' |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'app-eam-asset-stock-goods-use', |
||||
|
standalone: true, |
||||
|
imports: [ |
||||
|
SharedModule, |
||||
|
SelectUserByOrgComponent, |
||||
|
SupplierSelectComponent, |
||||
|
AssetSelectComponent, |
||||
|
OrgSelectComponent, |
||||
|
PositionSelectComponent, |
||||
|
WarehouseSelectComponent, |
||||
|
], |
||||
|
templateUrl: './eam-asset-stock-goods-use.component.html', |
||||
|
styleUrl: './eam-asset-stock-goods-use.component.less', |
||||
|
}) |
||||
|
export class EamAssetStockGoodsUseComponent { |
||||
|
constructor( |
||||
|
private fb: FormBuilder, |
||||
|
private api: ApiService, |
||||
|
private msg: NzMessageService, |
||||
|
) {} |
||||
|
|
||||
|
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
||||
|
|
||||
|
formGroup!: FormGroup |
||||
|
|
||||
|
groupIndex = 0 |
||||
|
|
||||
|
uploadLoading = false |
||||
|
|
||||
|
ngOnInit(): void { |
||||
|
console.log('this.data', this.data) |
||||
|
this.formGroup = this.fb.group({ |
||||
|
id: this.fb.control(null, []), |
||||
|
title: this.fb.control(this.data.value?.name, [FormValidators.required('请输入')]), |
||||
|
// useUserId: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
businessDate: this.fb.control(null, [FormValidators.required('请选择')]), |
||||
|
// applicant: this.fb.control({ value: this.api.authInfo?.userName, disabled: true }, [
|
||||
|
// FormValidators.required('请选择'),
|
||||
|
// ]),
|
||||
|
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
||||
|
|
||||
|
notes: this.fb.control(null, [FormValidators.required('请输入')]), |
||||
|
urgency: this.fb.control(1, []), |
||||
|
}) |
||||
|
|
||||
|
this.patchValues() |
||||
|
} |
||||
|
|
||||
|
patchValues() { |
||||
|
const { value: data, preview } = this.data |
||||
|
if (data) { |
||||
|
this.formGroup.patchValue({ |
||||
|
...data.procVars, |
||||
|
applyDepartmentId: data.procVars?.applyDepartmentId + '', |
||||
|
}) |
||||
|
} |
||||
|
if (preview) { |
||||
|
this.formGroup.disable() |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public getValues() { |
||||
|
let values = null |
||||
|
if (FormValidators.validateFormGroup(this.formGroup)) { |
||||
|
const v = this.formGroup.value |
||||
|
|
||||
|
values = { |
||||
|
...v, |
||||
|
|
||||
|
applyDepartmentId: Number(v.applyDepartmentId?.[0]), |
||||
|
} |
||||
|
} |
||||
|
return values |
||||
|
} |
||||
|
|
||||
|
onFileChange(e: Event) { |
||||
|
const target = e.target as HTMLInputElement |
||||
|
const file = target.files![0] |
||||
|
target.value = '' |
||||
|
|
||||
|
const formdata = new FormData() |
||||
|
formdata.append('file', file) |
||||
|
this.api.upload(formdata).subscribe((res) => { |
||||
|
this.formGroup.get('attach')?.setValue(res.body.fileName) |
||||
|
}) |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue