98 changed files with 4757 additions and 1206 deletions
@ -0,0 +1,80 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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-warehouse-select formControlName="outWarehouseId" /> |
|||
</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-warehouse-select formControlName="inWarehouseId" /> |
|||
</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="useUserId" /> |
|||
</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"> |
|||
<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,112 @@ |
|||
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-business-allot-form', |
|||
standalone: true, |
|||
imports: [ |
|||
SharedModule, |
|||
SelectUserByOrgComponent, |
|||
SupplierSelectComponent, |
|||
AssetSelectComponent, |
|||
OrgSelectComponent, |
|||
PositionSelectComponent, |
|||
WarehouseSelectComponent, |
|||
], |
|||
templateUrl: './asset-business-allot-form.component.html', |
|||
styleUrl: './asset-business-allot-form.component.less', |
|||
}) |
|||
export class AssetBusinessAllotFormComponent { |
|||
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, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
// useUserId: this.fb.control(null, [FormValidators.required('请选择')]),
|
|||
// useOrganizationId: this.fb.control(null, [FormValidators.required('请选择')]),
|
|||
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
|||
|
|||
notes: this.fb.control(null, []), |
|||
inWarehouseId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
outWarehouseId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
|
|||
attach: this.fb.control('', []), |
|||
|
|||
assetIdList: this.fb.control([], []), |
|||
}) |
|||
|
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
positionId: data._position?.positionId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: Number(v.positionId?.[0]), |
|||
useOrganizationId: Number(v.useOrganizationId?.[0]), |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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,88 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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 [company]="true" formControlName="useOrganizationId" /> |
|||
</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="useUserId" /> |
|||
</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="businessGeneratedDate" /> |
|||
</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="returnTime" /> |
|||
</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"> |
|||
<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,109 @@ |
|||
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' |
|||
|
|||
@Component({ |
|||
selector: 'app-asset-business-return-form', |
|||
standalone: true, |
|||
imports: [ |
|||
SharedModule, |
|||
SelectUserByOrgComponent, |
|||
SupplierSelectComponent, |
|||
AssetSelectComponent, |
|||
OrgSelectComponent, |
|||
PositionSelectComponent, |
|||
], |
|||
templateUrl: './asset-business-borrow-form.component.html', |
|||
styleUrl: './asset-business-borrow-form.component.less', |
|||
}) |
|||
export class AssetBusinessBorrowFormComponent { |
|||
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, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
useUserId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
// useOrganizationId: this.fb.control(null, [FormValidators.required('请选择')]),
|
|||
businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
returnTime: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
|
|||
notes: this.fb.control(null, []), |
|||
|
|||
attach: this.fb.control('', []), |
|||
|
|||
assetIdList: this.fb.control([], []), |
|||
}) |
|||
|
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
positionId: data._position?.positionId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: Number(v.positionId?.[0]), |
|||
useOrganizationId: Number(v.useOrganizationId?.[0]), |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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,95 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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 [company]="true" formControlName="useOrganizationId" /> |
|||
</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="useUserId" /> |
|||
</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="businessGeneratedDate" /> |
|||
</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-position-select formControlName="positionId" /> |
|||
</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 nz-input placeholder="请输入详细位置" formControlName="positionDetail" /> |
|||
</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"> |
|||
<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,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 { AssetCategorySelectComponent } from '../asset-category-select/asset-category-select.component' |
|||
import { OrgSelectComponent } from '../org-select/org-select.component' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, MAINTENANCE_STATUS, MAINTENANCE_TYPE } from 'app/constants' |
|||
import { SelectUserByOrgComponent } from '../select-user-by-org/select-user-by-org.component' |
|||
import { ManufacturerSelectComponent } from '../manufacturer-select/manufacturer-select.component' |
|||
import { PositionSelectComponent } from '../position-select/position-select.component' |
|||
import { MaintenanceSelectComponent } from '../maintenance-select/maintenance-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' |
|||
|
|||
@Component({ |
|||
selector: 'app-asset-business-collection', |
|||
standalone: true, |
|||
imports: [ |
|||
SharedModule, |
|||
SelectUserByOrgComponent, |
|||
SupplierSelectComponent, |
|||
AssetSelectComponent, |
|||
OrgSelectComponent, |
|||
PositionSelectComponent, |
|||
], |
|||
templateUrl: './asset-business-collection.component.html', |
|||
styleUrl: './asset-business-collection.component.less', |
|||
}) |
|||
export class AssetBusinessCollectionComponent { |
|||
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, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
useUserId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
useOrganizationId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
|
|||
notes: this.fb.control(null, []), |
|||
positionId: this.fb.control(null, []), |
|||
attach: this.fb.control('', []), |
|||
positionDetail: this.fb.control('', []), |
|||
|
|||
assetIdList: this.fb.control([], []), |
|||
}) |
|||
|
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
positionId: data._position?.positionId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: Number(v.positionId?.[0]), |
|||
useOrganizationId: Number(v.useOrganizationId?.[0]), |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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,95 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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 [company]="true" formControlName="useOrganizationId" /> |
|||
</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="useUserId" /> |
|||
</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="businessGeneratedDate" /> |
|||
</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-position-select formControlName="positionId" /> |
|||
</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 nz-input placeholder="请输入详细位置" formControlName="positionDetail" /> |
|||
</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"> |
|||
<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,109 @@ |
|||
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' |
|||
|
|||
@Component({ |
|||
selector: 'app-asset-business-return-form', |
|||
standalone: true, |
|||
imports: [ |
|||
SharedModule, |
|||
SelectUserByOrgComponent, |
|||
SupplierSelectComponent, |
|||
AssetSelectComponent, |
|||
OrgSelectComponent, |
|||
PositionSelectComponent, |
|||
], |
|||
templateUrl: './asset-business-return-form.component.html', |
|||
styleUrl: './asset-business-return-form.component.less', |
|||
}) |
|||
export class AssetBusinessReturnFormComponent { |
|||
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, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
useUserId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
useOrganizationId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
|
|||
notes: this.fb.control(null, []), |
|||
positionId: this.fb.control(null, []), |
|||
attach: this.fb.control('', []), |
|||
positionDetail: this.fb.control('', []), |
|||
|
|||
assetIdList: this.fb.control([], []), |
|||
}) |
|||
|
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
positionId: data._position?.positionId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: Number(v.positionId?.[0]), |
|||
useOrganizationId: Number(v.useOrganizationId?.[0]), |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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,104 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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="businessGeneratedDate" /> |
|||
</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-org-select [company]="true" formControlName="useOrganizationId" /> |
|||
</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="manager" /> |
|||
</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="useUserId" /> |
|||
</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-position-select formControlName="positionId" /> |
|||
</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 nz-input placeholder="请输入详细位置" formControlName="positionDetail" /> |
|||
</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"> |
|||
<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,110 @@ |
|||
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' |
|||
|
|||
@Component({ |
|||
selector: 'app-asset-business-return-form', |
|||
standalone: true, |
|||
imports: [ |
|||
SharedModule, |
|||
SelectUserByOrgComponent, |
|||
SupplierSelectComponent, |
|||
AssetSelectComponent, |
|||
OrgSelectComponent, |
|||
PositionSelectComponent, |
|||
], |
|||
templateUrl: './asset-business-revert-form.component.html', |
|||
styleUrl: './asset-business-revert-form.component.less', |
|||
}) |
|||
export class AssetBusinessRevertFormComponent { |
|||
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, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
manager: this.fb.control(null, []), |
|||
useUserId: this.fb.control(null, []), |
|||
useOrganizationId: this.fb.control(null, []), |
|||
|
|||
notes: this.fb.control(null, []), |
|||
positionId: this.fb.control(null, []), |
|||
attach: this.fb.control('', []), |
|||
positionDetail: this.fb.control('', []), |
|||
|
|||
assetIdList: this.fb.control([], []), |
|||
}) |
|||
|
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
positionId: data._position?.positionId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: Number(v.positionId?.[0]), |
|||
useOrganizationId: Number(v.useOrganizationId?.[0]), |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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,79 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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="manager" /> |
|||
</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" formControlName="createTime" /> |
|||
</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="supplierVendorId" /> |
|||
</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]="18"> |
|||
<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,4 @@ |
|||
.modal { |
|||
height: 70vh; |
|||
overflow-y: auto; |
|||
} |
|||
@ -0,0 +1,109 @@ |
|||
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 { AssetCategorySelectComponent } from '../asset-category-select/asset-category-select.component' |
|||
import { OrgSelectComponent } from '../org-select/org-select.component' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, MAINTENANCE_STATUS, MAINTENANCE_TYPE } from 'app/constants' |
|||
import { SelectUserByOrgComponent } from '../select-user-by-org/select-user-by-org.component' |
|||
import { ManufacturerSelectComponent } from '../manufacturer-select/manufacturer-select.component' |
|||
import { PositionSelectComponent } from '../position-select/position-select.component' |
|||
import { MaintenanceSelectComponent } from '../maintenance-select/maintenance-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' |
|||
|
|||
@Component({ |
|||
selector: 'app-asset-business-storage', |
|||
standalone: true, |
|||
imports: [SharedModule, SelectUserByOrgComponent, SupplierSelectComponent, AssetSelectComponent], |
|||
templateUrl: './asset-business-storage-form.component.html', |
|||
styleUrl: './asset-business-storage-form.component.less', |
|||
}) |
|||
export class AssetBusinessStorageFormComponent { |
|||
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, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
manager: this.fb.control(null, []), |
|||
createTime: this.fb.control(null, []), |
|||
supplierVendorId: this.fb.control(null, []), |
|||
notes: this.fb.control(null, []), |
|||
assetIdList: this.fb.control([], []), |
|||
attach: this.fb.control('', []), |
|||
}) |
|||
|
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
manager: data._manager?.userId ? [data._manager?.userId] : [], |
|||
responsiblePerson: data._responsiblePerson?.userId ? [data._responsiblePerson?.userId] : [], |
|||
categoryId: data._category?.categoryId + '', |
|||
positionId: data._position?.positionId + '', |
|||
ownCompanyId: data._ownCompany?.organizationId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
maintenanceVendor: data._maintenanceVendor?.maintenanceVendorId, |
|||
manufacturersVendorId: data._manufacturersVendor?.manufacturersVendorId, |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: v.positionId?.[0], |
|||
useOrganizationId: v.useOrganizationId?.[0], |
|||
responsiblePerson: v.responsiblePerson?.[0], |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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,104 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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="inUseOrganizationId" /> |
|||
</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="outUseOrganizationId" /> |
|||
</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="managerId" /> |
|||
</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="useUserId" /> |
|||
</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-position-select formControlName="positionId" /> |
|||
</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 nz-input placeholder="请输入详细位置" formControlName="positionDetail" /> |
|||
</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"> |
|||
<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,115 @@ |
|||
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-business-transfer-form', |
|||
standalone: true, |
|||
imports: [ |
|||
SharedModule, |
|||
SelectUserByOrgComponent, |
|||
SupplierSelectComponent, |
|||
AssetSelectComponent, |
|||
OrgSelectComponent, |
|||
PositionSelectComponent, |
|||
WarehouseSelectComponent, |
|||
], |
|||
templateUrl: './asset-business-transfer-form.component.html', |
|||
styleUrl: './asset-business-transfer-form.component.less', |
|||
}) |
|||
export class AssetBusinessTransferFormComponent { |
|||
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, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
useUserId: this.fb.control(null, []), |
|||
// useOrganizationId: this.fb.control(null, [FormValidators.required('请选择')]),
|
|||
// businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]),
|
|||
|
|||
notes: this.fb.control(null, []), |
|||
managerId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
inUseOrganizationId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
outUseOrganizationId: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
|
|||
attach: this.fb.control('', []), |
|||
positionId: this.fb.control('', []), |
|||
positionDetail: this.fb.control('', []), |
|||
|
|||
assetIdList: this.fb.control([], []), |
|||
}) |
|||
|
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
positionId: data._position?.positionId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: Number(v.positionId?.[0]), |
|||
useOrganizationId: Number(v.useOrganizationId?.[0]), |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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) |
|||
}) |
|||
} |
|||
} |
|||
@ -1,263 +1,395 @@ |
|||
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
|||
<div class="asset-form"> |
|||
<nz-card [nzBordered]="false"> |
|||
<nz-card-tab> |
|||
<nz-tabset [(nzSelectedIndex)]="groupIndex"> |
|||
<nz-tab nzTitle="基本信息"></nz-tab> |
|||
<nz-tab nzTitle="维保信息"></nz-tab> |
|||
<nz-tab nzTitle="财务信息"></nz-tab> |
|||
</nz-tabset> |
|||
</nz-card-tab> |
|||
<div class="asset-form"> |
|||
<nz-card [nzBordered]="false"> |
|||
<nz-card-tab> |
|||
<nz-tabset [(nzSelectedIndex)]="groupIndex"> |
|||
<nz-tab nzTitle="基本信息"></nz-tab> |
|||
<nz-tab nzTitle="维保信息"></nz-tab> |
|||
<nz-tab nzTitle="财务信息"></nz-tab> |
|||
@if (data.preview) { |
|||
<!-- <nz-tab nzTitle="备品配件"></nz-tab> |
|||
<nz-tab nzTitle="维修记录"></nz-tab> |
|||
<nz-tab nzTitle="保养记录"></nz-tab> |
|||
<nz-tab nzTitle="巡检记录"></nz-tab> --> |
|||
<nz-tab nzTitle="历史记录"></nz-tab> |
|||
} |
|||
</nz-tabset> |
|||
</nz-card-tab> |
|||
@if (groupIndex < 3) { |
|||
<form nz-form [formGroup]="formGroup" nzLayout="vertical"> |
|||
@switch (groupIndex) { |
|||
@case (0) { |
|||
<ng-container [ngTemplateOutlet]="basicTpl"> </ng-container> |
|||
} |
|||
@case (1) { |
|||
<ng-container [ngTemplateOutlet]="maintainTpl"> </ng-container> |
|||
} |
|||
@case (2) { |
|||
<ng-container [ngTemplateOutlet]="financeTpl"> </ng-container> |
|||
} |
|||
} |
|||
<ng-template #basicTpl> |
|||
<div nz-row [nzGutter]="24"> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>资产分类</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-asset-category-select formControlName="categoryId"></app-asset-category-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>资产名称</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入名称" formControlName="name" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
|
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>资产状态</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="status"> |
|||
@for (item of ASSET_STATUS; track $index) { |
|||
<nz-option [nzLabel]="item.label" [nzValue]="item.value"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>所属公司</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-org-select formControlName="ownCompanyId" [company]="true" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>使用组织</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-org-select formControlName="useOrganizationId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>管理人员</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<!-- manager --> |
|||
<app-select-user-by-org formControlName="manager" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>使用人员</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-select-user-by-org formControlName="useUserId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>资产来源</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="sourceId"> |
|||
@for (item of ASSET_SOURCE_MAP | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>资产厂商</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<!-- manufacturersVendorId --> |
|||
<app-manufacturer-select formControlName="manufacturersVendorId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>序列号</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入序列号" formControlName="serialNumber" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>规格型号</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入规格型号" formControlName="model" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>用途</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入用途" formControlName="purpose" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>存放位置</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<!-- positionId --> |
|||
<app-position-select formControlName="positionId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>详细位置</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入详细位置" formControlName="positionDetail" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>计量单位</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入计量单位" formControlName="unit" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
</div> |
|||
</ng-template> |
|||
<ng-template #maintainTpl> |
|||
<div nz-row [nzGutter]="24"> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保厂商</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-maintenance-select formControlName="maintenanceVendor" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>联系人</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入联系人" formControlName="contactor" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>联系方式</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入联系方式" formControlName="contact" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>负责人</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-select-user-by-org formControlName="responsiblePerson" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保开始</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-date-picker class="w-full" formControlName="maintenanceStartDate" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保到期</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-date-picker class="w-full" formControlName="maintenanceEndDate" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保状态</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="maintenanceStatus"> |
|||
@for (item of MAINTENANCE_STATUS | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保方式</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="maintenanceType"> |
|||
@for (item of MAINTENANCE_TYPE | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>建议维保方式</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="suggestMaintenanceType"> |
|||
@for (item of MAINTENANCE_TYPE | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保备注</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<textarea |
|||
nz-input |
|||
placeholder="请输入" |
|||
formControlName="maintenanceNotes" |
|||
></textarea> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
</div> |
|||
</ng-template> |
|||
<ng-template #financeTpl> |
|||
<div nz-row [nzGutter]="24"> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>财务分类</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-maintenance-select formControlName="financialCategoryId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>费用项目</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-maintenance-select formControlName="expenseItem" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>财务选项</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-maintenance-select formControlName="financialOption" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>入账日期</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-date-picker class="w-full" formControlName="registerDate" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>客户信息</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input formControlName="customerInfo" placeHolder="请输入客户信息" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>未税成本</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-input-number |
|||
class="!w-full" |
|||
formControlName="totalAmountPrice" |
|||
nzPlaceHolder="请输入未税成本" |
|||
/> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>资产税额</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-input-number |
|||
class="!w-full" |
|||
formControlName="taxAmountRate" |
|||
nzPlaceHolder="请输入资产税额" |
|||
/> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>资产净值</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-input-number |
|||
class="!w-full" |
|||
formControlName="navPrice" |
|||
nzPlaceHolder="请输入资产净值" |
|||
/> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>残值率</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-input-number |
|||
class="!w-full" |
|||
formControlName="residualsRate" |
|||
nzPlaceHolder="请输入残值率" |
|||
/> |
|||
</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="financialNotes" |
|||
></textarea> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
</div> |
|||
</ng-template> |
|||
|
|||
<ng-template #errorTpl let-control> |
|||
<form-error-tips [control]="control"></form-error-tips> |
|||
</ng-template> |
|||
</form> |
|||
} @else { |
|||
@switch (groupIndex) { |
|||
@case (0) { |
|||
<ng-container [ngTemplateOutlet]="basicTpl"> </ng-container> |
|||
@case (3) { |
|||
<app-asset-operation-records /> |
|||
} |
|||
@case (4) { |
|||
4 |
|||
} |
|||
@case (1) { |
|||
<ng-container [ngTemplateOutlet]="maintainTpl"> </ng-container> |
|||
@case (5) { |
|||
5 |
|||
} |
|||
@case (2) { |
|||
<ng-container [ngTemplateOutlet]="financeTpl"> </ng-container> |
|||
@case (6) { |
|||
6 |
|||
} |
|||
@case (7) { |
|||
<app-asset-operation-records /> |
|||
} |
|||
} |
|||
</nz-card> |
|||
</div> |
|||
|
|||
<ng-template #basicTpl> |
|||
<div nz-row [nzGutter]="24"> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>资产分类</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-asset-category-select formControlName="categoryId"></app-asset-category-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>资产名称</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入名称" formControlName="name" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
|
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>资产状态</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="status"> |
|||
@for (item of ASSET_STATUS; track $index) { |
|||
<nz-option [nzLabel]="item.label" [nzValue]="item.value"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>所属公司</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-org-select formControlName="ownCompanyId" [company]="true" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>使用组织</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-org-select formControlName="useOrganizationId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>管理人员</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<!-- manager --> |
|||
<app-select-user-by-org formControlName="manager" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>使用人员</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-select-user-by-org formControlName="useUserId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>资产来源</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="sourceId"> |
|||
@for (item of ASSET_SOURCE_MAP | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>资产厂商</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<!-- manufacturersVendorId --> |
|||
<app-manufacturer-select formControlName="manufacturersVendorId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>序列号</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入序列号" formControlName="serialNumber" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>规格型号</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入规格型号" formControlName="model" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>用途</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入用途" formControlName="purpose" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>存放位置</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<!-- positionId --> |
|||
<app-position-select formControlName="positionId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>详细位置</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入详细位置" formControlName="positionDetail" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>计量单位</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入计量单位" formControlName="unit" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
</div> |
|||
</ng-template> |
|||
<ng-template #maintainTpl> |
|||
<div nz-row [nzGutter]="24"> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保厂商</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-maintenance-select formControlName="maintenanceVendor" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>联系人</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入联系人" formControlName="contactor" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>联系方式</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入联系方式" formControlName="contact" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>负责人</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<app-select-user-by-org formControlName="responsiblePerson" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保开始</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-date-picker class="w-full" formControlName="maintenanceStartDate" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保到期</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-date-picker class="w-full" formControlName="maintenanceEndDate" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保状态</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="maintenanceStatus"> |
|||
@for (item of MAINTENANCE_STATUS | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保方式</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="maintenanceType"> |
|||
@for (item of MAINTENANCE_TYPE | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>建议维保方式</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-select nzPlaceHolder="请选择" formControlName="suggestMaintenanceType"> |
|||
@for (item of MAINTENANCE_TYPE | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>维保备注</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<textarea nz-input placeholder="请输入" formControlName="maintenanceNotes"></textarea> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
</div> |
|||
</ng-template> |
|||
<ng-template #financeTpl>3</ng-template> |
|||
</form> |
|||
|
|||
<ng-template #errorTpl let-control> |
|||
<form-error-tips [control]="control"></form-error-tips> |
|||
</ng-template> |
|||
} |
|||
</nz-card> |
|||
</div> |
|||
|
|||
@ -1,4 +1,5 @@ |
|||
.asset-form { |
|||
height: 80vh; |
|||
margin: -24px; |
|||
overflow: auto; |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
<div class="overflow-hidden flex-1"> |
|||
<app-server-paginated-table [options]="table" [renderColumn]="renderColumnTpl" [formGroup]="queryForm"> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('status') { |
|||
<!-- <nz-badge |
|||
[nzText]="data === 0 ? '在职' : '离职'" |
|||
[nzStatus]="data === 0 ? 'processing' : 'error'" |
|||
/> --> |
|||
} |
|||
|
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
|
|||
<ng-container *appTableForm> |
|||
<div class="mr-3"> |
|||
<div nz-row nzGutter="24"> |
|||
<div nz-col nzSpan="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>业务编号</nz-form-label> |
|||
<nz-form-control> |
|||
<input nz-input placeholder="请输入" formControlName="businessId" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col nzSpan="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>操作内容</nz-form-label> |
|||
<nz-form-control> |
|||
<input nz-input placeholder="请输入" formControlName="operationNotes" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col nzSpan="8"> |
|||
<nz-form-item> |
|||
<nz-form-label>操作类型</nz-form-label> |
|||
<nz-form-control> |
|||
<input nz-input placeholder="请输入" formControlName="operationType" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
@ -0,0 +1,61 @@ |
|||
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
|
|||
import { ApiService } from 'app/services' |
|||
import { FormBuilder, FormGroup } from '@angular/forms' |
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzDrawerRef, NzDrawerService } from 'ng-zorro-antd/drawer' |
|||
import { lastValueFrom } from 'rxjs' |
|||
import { FormValidators } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-asset-operation-records', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './asset-operation-records.component.html', |
|||
styleUrl: './asset-operation-records.component.less', |
|||
}) |
|||
export class AssetOperationRecordsComponent { |
|||
constructor( |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
private drawer: NzDrawerService, |
|||
private api: ApiService, |
|||
private fb: FormBuilder, |
|||
) {} |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
queryForm!: FormGroup |
|||
|
|||
initQueryForm() { |
|||
this.queryForm = this.fb.group({ |
|||
businessId: [], |
|||
operationNotes: [], |
|||
operationType: [], |
|||
}) |
|||
} |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
cacheKey: 'asset-operation-records.component', |
|||
}) |
|||
.setColumn([ |
|||
{ key: 'id', title: '主键', width: '100px' }, |
|||
{ key: 'businessId', title: '业务编号', width: '170px' }, |
|||
{ key: 'operationNotes', title: '操作内容' }, |
|||
{ key: 'operationType', title: '操作类型' }, |
|||
|
|||
// { key: 'createTime', title: '创建时间' },
|
|||
]) |
|||
this.initQueryForm() |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getAssetLog({ ...p, ...q }) |
|||
} |
|||
} |
|||
@ -0,0 +1,148 @@ |
|||
<nz-card nzType="inner" [nzBodyStyle]="{ padding: 0 }" [nzTitle]="disabled ? undefined : nzTitleTpl"> |
|||
<ng-template #nzTitleTpl> |
|||
<nz-space> |
|||
<button nz-button *nzSpaceItem type="button" nzType="primary" (click)="onTrigger(modalTpl)"> |
|||
选择资产 |
|||
</button> |
|||
<button |
|||
nz-button |
|||
*nzSpaceItem |
|||
type="button" |
|||
nzDanger |
|||
(click)="onRemove()" |
|||
[disabled]="setOfCheckedId.size === 0" |
|||
> |
|||
删除 |
|||
</button> |
|||
</nz-space> |
|||
</ng-template> |
|||
|
|||
<ng-template #modalTpl> |
|||
<app-server-paginated-table [options]="table" [formGroup]="queryForm" [renderColumn]="renderColumnTpl"> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('status') { |
|||
<nz-tag> |
|||
{{ ASSET_STATUS_MAP[data] }} |
|||
</nz-tag> |
|||
} |
|||
@case ('_useUser') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_warehouse') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_position') { |
|||
{{ data?.name ?? '-' }} |
|||
} |
|||
@case ('_head') { |
|||
{{ data?.userName ?? '-' }} |
|||
} |
|||
@case ('_ownCompany') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_useOrganization') { |
|||
{{ data?.organizationName ?? '-' }} |
|||
} |
|||
@case ('_category') { |
|||
{{ data?.categoryName ?? '-' }} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<!-- <ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link">资产确认</button> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> --> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="资产名称"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="资产编号"> |
|||
<input nz-input placeholder="请输入" formControlName="assetCode" /> |
|||
</app-query-item> |
|||
<app-query-item label="规格型号"> |
|||
<input nz-input placeholder="请输入" formControlName="model" /> |
|||
</app-query-item> |
|||
<app-query-item label="序列号"> |
|||
<input nz-input placeholder="请输入" formControlName="serialNumber" /> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="资产状态"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-24" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
formControlName="status" |
|||
> |
|||
@for (item of ASSET_STATUS_MAP | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="资产来源"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-24" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
formControlName="sourceId" |
|||
> |
|||
@for (item of ASSET_SOURCE_MAP | keyvalue; track $index) { |
|||
<nz-option [nzLabel]="item.value" [nzValue]="item.key"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="位置"> |
|||
<app-position-select formControlName="positionId" /> |
|||
</app-query-item> |
|||
<app-query-item label="生产厂商"> |
|||
<app-manufacturer-select class="block w-36" formControlName="manufacturersVendorId" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</ng-template> |
|||
|
|||
<nz-table [nzSize]="'small'" [nzBordered]="true" [nzData]="selectedDataList" #basicTable> |
|||
<thead> |
|||
<tr> |
|||
<th |
|||
[nzChecked]="checkedAll" |
|||
[nzIndeterminate]="indeterminate" |
|||
nzLabel="Select all" |
|||
(nzCheckedChange)="onAllChecked($event)" |
|||
></th> |
|||
<th>资产编号</th> |
|||
<th>资产分类</th> |
|||
<th>资产状态</th> |
|||
<th>资产名称</th> |
|||
<th>规格型号</th> |
|||
<th>资产序列号</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr *ngFor="let data of basicTable.data"> |
|||
<td |
|||
[nzChecked]="setOfCheckedId.has(data.assetId)" |
|||
[nzDisabled]="data.disabled" |
|||
[nzLabel]="data.name" |
|||
(nzCheckedChange)="onItemChecked(data.assetId, $event)" |
|||
></td> |
|||
<td>{{ data.assetCode }}</td> |
|||
<td>{{ data?._category.categoryName ?? '-' }}</td> |
|||
<td> |
|||
<nz-tag> |
|||
{{ ASSET_STATUS_MAP[data.status] }} |
|||
</nz-tag> |
|||
</td> |
|||
<td>{{ data.name }}</td> |
|||
<td>{{ data.model }}</td> |
|||
<td>{{ data.serialNumber }}</td> |
|||
</tr> |
|||
</tbody> |
|||
</nz-table> |
|||
</nz-card> |
|||
@ -0,0 +1,193 @@ |
|||
import { |
|||
ChangeDetectorRef, |
|||
Component, |
|||
EventEmitter, |
|||
Input, |
|||
OnInit, |
|||
Output, |
|||
TemplateRef, |
|||
ViewChild, |
|||
forwardRef, |
|||
} from '@angular/core' |
|||
import { ControlValueAccessor, FormControl, FormGroup, NG_VALUE_ACCESSOR } from '@angular/forms' |
|||
|
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
|
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
|
|||
import { ApiService } from 'app/services' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
|
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { Utils } from 'app/utils' |
|||
import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd/tree' |
|||
import { NzTreeSelectComponent } from 'ng-zorro-antd/tree-select' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS_MAP, MAX_PAGE_SIZE } from 'app/constants' |
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { PositionSelectComponent } from '../position-select/position-select.component' |
|||
import { ManufacturerSelectComponent } from '../manufacturer-select/manufacturer-select.component' |
|||
import { tap } from 'rxjs' |
|||
|
|||
@Component({ |
|||
selector: 'app-asset-select', |
|||
standalone: true, |
|||
imports: [SharedModule, PositionSelectComponent, ManufacturerSelectComponent], |
|||
templateUrl: './asset-select.component.html', |
|||
styleUrl: './asset-select.component.less', |
|||
providers: [ |
|||
{ |
|||
provide: NG_VALUE_ACCESSOR, |
|||
multi: true, |
|||
useExisting: forwardRef(() => AssetSelectComponent), |
|||
}, |
|||
], |
|||
}) |
|||
export class AssetSelectComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
@Input() radio: boolean = false |
|||
|
|||
@Output() onSelected = new EventEmitter<NzSafeAny>() |
|||
|
|||
allGetedDataMap = new Map<number, NzSafeAny>() |
|||
|
|||
originData: NzSafeAny[] = [] |
|||
|
|||
value?: string |
|||
|
|||
disabled = false |
|||
|
|||
selectedDataList: NzSafeAny[] = [] |
|||
|
|||
checkedAll = false |
|||
|
|||
loading = false |
|||
|
|||
indeterminate = false |
|||
|
|||
setOfCheckedId = new Set<number>() |
|||
|
|||
ASSET_SOURCE_MAP = ASSET_SOURCE_MAP |
|||
|
|||
ASSET_STATUS_MAP = ASSET_STATUS_MAP() |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(), |
|||
model: new FormControl(), |
|||
status: new FormControl(), |
|||
assetCode: new FormControl(), |
|||
serialNumber: new FormControl(), |
|||
sourceId: new FormControl(), |
|||
positionId: new FormControl(), |
|||
manufacturersVendorId: new FormControl(), |
|||
}) |
|||
|
|||
ngOnInit(): void { |
|||
this.api.getBasicSupplierVendorPage({ pageSize: MAX_PAGE_SIZE, pageNum: 1 }).subscribe((res) => { |
|||
this.originData = res.body.rows |
|||
}) |
|||
this.table |
|||
.setConfig({ |
|||
selectable: true, |
|||
rowKey: 'assetId', |
|||
}) |
|||
.setColumn([ |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '资产名称', visible: true }, |
|||
{ key: '_category', title: '资产分类', visible: true }, |
|||
{ key: 'status', title: '资产状态', visible: true }, |
|||
{ key: '_ownCompany', title: '所属公司', visible: true }, |
|||
{ key: '_useOrganization', title: '使用组织', visible: true }, |
|||
{ key: '_position', title: '存放位置', visible: true }, |
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getAssetPage({ ...p, ...q }).pipe( |
|||
tap((res) => { |
|||
res.body.rows.forEach((item: NzSafeAny) => { |
|||
this.allGetedDataMap.set(item.assetId, item) |
|||
}) |
|||
}), |
|||
) |
|||
} |
|||
|
|||
onTrigger(nzContent: TemplateRef<{}>) { |
|||
this.modal.create({ |
|||
nzTitle: '选择资产', |
|||
nzContent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzOnOk: () => { |
|||
this.allGetedDataMap.forEach((i: NzSafeAny) => { |
|||
if (this.table.ref.selected.has(String(i.assetId))) { |
|||
if (!this.selectedDataList.some((s) => s.assetId === i.assetId)) { |
|||
this.selectedDataList.push(i) |
|||
} |
|||
} |
|||
}) |
|||
this.selectedDataList = this.selectedDataList.slice() |
|||
this.refreshCheckedStatus() |
|||
this.onChange(this.selectedDataList.map((i) => i.assetId)) |
|||
}, |
|||
}) |
|||
} |
|||
|
|||
onRemove() { |
|||
this.selectedDataList = this.selectedDataList.filter((i) => !this.setOfCheckedId.has(i.assetId)) |
|||
this.refreshCheckedStatus() |
|||
} |
|||
|
|||
updateCheckedSet(id: number, checked: boolean): void { |
|||
if (checked) { |
|||
this.setOfCheckedId.add(id) |
|||
} else { |
|||
this.setOfCheckedId.delete(id) |
|||
} |
|||
} |
|||
|
|||
refreshCheckedStatus(): void { |
|||
const listOfEnabledData = this.selectedDataList.filter(({ disabled }) => !disabled) |
|||
this.checkedAll = listOfEnabledData.every(({ assetId }) => this.setOfCheckedId.has(assetId)) |
|||
this.indeterminate = |
|||
listOfEnabledData.some(({ assetId }) => this.setOfCheckedId.has(assetId)) && !this.checkedAll |
|||
} |
|||
|
|||
onItemChecked(id: number, checked: boolean): void { |
|||
this.updateCheckedSet(id, checked) |
|||
this.refreshCheckedStatus() |
|||
} |
|||
|
|||
onAllChecked(checked: boolean): void { |
|||
this.selectedDataList |
|||
.filter(({ disabled }) => !disabled) |
|||
.forEach(({ assetId }) => this.updateCheckedSet(assetId, checked)) |
|||
this.refreshCheckedStatus() |
|||
} |
|||
|
|||
onTouched = () => {} |
|||
|
|||
onChange(v: NzSafeAny[]) {} |
|||
|
|||
writeValue(v: NzSafeAny): void { |
|||
this.selectedDataList = [] |
|||
} |
|||
|
|||
registerOnChange(fn: any): void { |
|||
this.onChange = fn |
|||
} |
|||
|
|||
registerOnTouched(fn: any): void { |
|||
this.onTouched = fn |
|||
} |
|||
|
|||
setDisabledState?(isDisabled: boolean): void { |
|||
this.disabled = isDisabled |
|||
} |
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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]="uploadImgLoading"> |
|||
<i nz-icon nzType="upload"></i> |
|||
上传图片 |
|||
<input type="file" (change)="onFileImgChange($event)" accept=".jpg,.jpeg,.png" /> |
|||
</button> |
|||
</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]="18"> |
|||
<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,137 @@ |
|||
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 { AssetCategorySelectComponent } from '../asset-category-select/asset-category-select.component' |
|||
import { OrgSelectComponent } from '../org-select/org-select.component' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, MAINTENANCE_STATUS, MAINTENANCE_TYPE, MAX_PAGE_SIZE } from 'app/constants' |
|||
import { SelectUserByOrgComponent } from '../select-user-by-org/select-user-by-org.component' |
|||
import { ManufacturerSelectComponent } from '../manufacturer-select/manufacturer-select.component' |
|||
import { PositionSelectComponent } from '../position-select/position-select.component' |
|||
import { MaintenanceSelectComponent } from '../maintenance-select/maintenance-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' |
|||
|
|||
@Component({ |
|||
selector: 'app-repair-fault-form', |
|||
standalone: true, |
|||
imports: [SharedModule, SelectUserByOrgComponent, SupplierSelectComponent, AssetSelectComponent], |
|||
templateUrl: './repair-fault-form.component.html', |
|||
styleUrl: './repair-fault-form.component.less', |
|||
}) |
|||
export class RepairFaultFormComponent { |
|||
constructor( |
|||
private fb: FormBuilder, |
|||
private api: ApiService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
|||
|
|||
formGroup!: FormGroup |
|||
|
|||
groupIndex = 0 |
|||
|
|||
uploadLoading = false |
|||
|
|||
iconPreview = '' |
|||
|
|||
uploadImgLoading = false |
|||
|
|||
types: NzSafeAny[] = [] |
|||
|
|||
ngOnInit(): void { |
|||
this.formGroup = this.fb.group({ |
|||
id: this.fb.control(null, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
img: this.fb.control(null, []), |
|||
|
|||
notes: this.fb.control(null, []), |
|||
attach: this.fb.control('', []), |
|||
assetIdList: this.fb.control([], []), |
|||
}) |
|||
this.api.getRepairTypePage({ pageSize: MAX_PAGE_SIZE }).subscribe((res) => { |
|||
this.types = res.body.rows |
|||
}) |
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
manager: data._manager?.userId ? [data._manager?.userId] : [], |
|||
responsiblePerson: data._responsiblePerson?.userId ? [data._responsiblePerson?.userId] : [], |
|||
categoryId: data._category?.categoryId + '', |
|||
positionId: data._position?.positionId + '', |
|||
ownCompanyId: data._ownCompany?.organizationId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
maintenanceVendor: data._maintenanceVendor?.maintenanceVendorId, |
|||
manufacturersVendorId: data._manufacturersVendor?.manufacturersVendorId, |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: v.positionId?.[0], |
|||
useOrganizationId: v.useOrganizationId?.[0], |
|||
responsiblePerson: v.responsiblePerson?.[0], |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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) |
|||
}) |
|||
} |
|||
|
|||
onFileImgChange(e: Event) { |
|||
const target = e.target as HTMLInputElement |
|||
const file = target.files![0] |
|||
target.value = '' |
|||
if (file.size / 1024 / 1024 >= 2) { |
|||
this.msg.error('图片大小不能超过2M') |
|||
return |
|||
} |
|||
const fileReader = new FileReader() |
|||
fileReader.onload = () => { |
|||
const base64 = fileReader.result as string |
|||
this.iconPreview = base64 |
|||
} |
|||
fileReader.readAsDataURL(file) |
|||
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,84 @@ |
|||
<div class="modal"> |
|||
<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="name" /> |
|||
</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 nz-input placeholder="请输入业务编号" formControlName="businessId" /> |
|||
</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-select nzPlaceHolder="请选择维修类型" formControlName="repairTypeId"> |
|||
@for (item of types; track $index) { |
|||
<nz-option [nzLabel]="item.name" [nzValue]="item.repairTypeId"></nz-option> |
|||
} |
|||
</nz-select> |
|||
</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" formControlName="plannedDate" /> |
|||
</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]="18"> |
|||
<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,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 { AssetCategorySelectComponent } from '../asset-category-select/asset-category-select.component' |
|||
import { OrgSelectComponent } from '../org-select/org-select.component' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, MAINTENANCE_STATUS, MAINTENANCE_TYPE, MAX_PAGE_SIZE } from 'app/constants' |
|||
import { SelectUserByOrgComponent } from '../select-user-by-org/select-user-by-org.component' |
|||
import { ManufacturerSelectComponent } from '../manufacturer-select/manufacturer-select.component' |
|||
import { PositionSelectComponent } from '../position-select/position-select.component' |
|||
import { MaintenanceSelectComponent } from '../maintenance-select/maintenance-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' |
|||
|
|||
@Component({ |
|||
selector: 'app-repair-form', |
|||
standalone: true, |
|||
imports: [SharedModule, SelectUserByOrgComponent, SupplierSelectComponent, AssetSelectComponent], |
|||
templateUrl: './repair-form.component.html', |
|||
styleUrl: './repair-form.component.less', |
|||
}) |
|||
export class RepairFormComponent { |
|||
constructor( |
|||
private fb: FormBuilder, |
|||
private api: ApiService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
readonly data: NzSafeAny = inject(NZ_MODAL_DATA) |
|||
|
|||
formGroup!: FormGroup |
|||
|
|||
groupIndex = 0 |
|||
|
|||
uploadLoading = false |
|||
|
|||
types: NzSafeAny[] = [] |
|||
|
|||
ngOnInit(): void { |
|||
this.formGroup = this.fb.group({ |
|||
id: this.fb.control(null, []), |
|||
name: this.fb.control('', [FormValidators.required('请输入')]), |
|||
repairTypeId: this.fb.control(null, []), |
|||
businessId: this.fb.control(null, []), |
|||
plannedDate: this.fb.control(null, []), |
|||
notes: this.fb.control(null, []), |
|||
attach: this.fb.control('', []), |
|||
assetIdList: this.fb.control([], []), |
|||
}) |
|||
this.api.getRepairTypePage({ pageSize: MAX_PAGE_SIZE }).subscribe((res) => { |
|||
this.types = res.body.rows |
|||
}) |
|||
this.patchValues() |
|||
} |
|||
|
|||
patchValues() { |
|||
const { value: data, preview } = this.data |
|||
if (data) { |
|||
this.formGroup.patchValue({ |
|||
...data, |
|||
|
|||
useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], |
|||
manager: data._manager?.userId ? [data._manager?.userId] : [], |
|||
responsiblePerson: data._responsiblePerson?.userId ? [data._responsiblePerson?.userId] : [], |
|||
categoryId: data._category?.categoryId + '', |
|||
positionId: data._position?.positionId + '', |
|||
ownCompanyId: data._ownCompany?.organizationId + '', |
|||
useOrganizationId: data._useOrganization?.organizationId + '', |
|||
maintenanceVendor: data._maintenanceVendor?.maintenanceVendorId, |
|||
manufacturersVendorId: data._manufacturersVendor?.manufacturersVendorId, |
|||
}) |
|||
} |
|||
if (preview) { |
|||
this.formGroup.disable() |
|||
} |
|||
} |
|||
|
|||
public getValues() { |
|||
let values = null |
|||
if (FormValidators.validateFormGroup(this.formGroup)) { |
|||
const v = this.formGroup.value |
|||
|
|||
values = { |
|||
...v, |
|||
useUserId: v.useUserId?.[0], |
|||
manager: v.manager?.[0], |
|||
categoryId: v.categoryId?.[0], |
|||
ownCompanyId: v.ownCompanyId?.[0], |
|||
positionId: v.positionId?.[0], |
|||
useOrganizationId: v.useOrganizationId?.[0], |
|||
responsiblePerson: v.responsiblePerson?.[0], |
|||
assetIdList: JSON.stringify(v.assetIdList), |
|||
} |
|||
} |
|||
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,10 @@ |
|||
<nz-select |
|||
[nzPlaceHolder]="placeholder" |
|||
[disabled]="disabled" |
|||
[(ngModel)]="value" |
|||
(ngModelChange)="onModelChange($event)" |
|||
> |
|||
@for (item of originData; track $index) { |
|||
<nz-option [nzLabel]="item.name" [nzValue]="item.supplierVendorId"></nz-option> |
|||
} |
|||
</nz-select> |
|||
@ -0,0 +1,91 @@ |
|||
import { |
|||
ChangeDetectorRef, |
|||
Component, |
|||
EventEmitter, |
|||
Input, |
|||
OnInit, |
|||
Output, |
|||
TemplateRef, |
|||
ViewChild, |
|||
forwardRef, |
|||
} from '@angular/core' |
|||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
|||
|
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
|
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
|
|||
import { ApiService } from 'app/services' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
|
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { Utils } from 'app/utils' |
|||
import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd/tree' |
|||
import { NzTreeSelectComponent } from 'ng-zorro-antd/tree-select' |
|||
import { MAX_PAGE_SIZE } from 'app/constants' |
|||
|
|||
@Component({ |
|||
selector: 'app-supplier-select', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './supplier-select.component.html', |
|||
styleUrl: './supplier-select.component.less', |
|||
providers: [ |
|||
{ |
|||
provide: NG_VALUE_ACCESSOR, |
|||
multi: true, |
|||
useExisting: forwardRef(() => SupplierSelectComponent), |
|||
}, |
|||
], |
|||
}) |
|||
export class SupplierSelectComponent { |
|||
constructor(private api: ApiService) {} |
|||
|
|||
@Input() placeholder: string = '请选择' |
|||
|
|||
@Input() modalTitle: string = '选择' |
|||
|
|||
@Input() radio: boolean = false |
|||
|
|||
@Output() onSelected = new EventEmitter<NzSafeAny>() |
|||
|
|||
@ViewChild('el') el!: NzTreeSelectComponent |
|||
|
|||
originData: NzSafeAny[] = [] |
|||
|
|||
value?: string |
|||
|
|||
disabled = false |
|||
|
|||
ngOnInit(): void { |
|||
this.api.getBasicSupplierVendorPage({ pageSize: MAX_PAGE_SIZE, pageNum: 1 }).subscribe((res) => { |
|||
this.originData = res.body.rows |
|||
}) |
|||
} |
|||
|
|||
onModelChange(v: NzSafeAny) { |
|||
const item = this.originData.find((f) => f.maintenanceVendorId === v) |
|||
this.onSelected.emit(item) |
|||
this.onChange(v) |
|||
} |
|||
|
|||
onTouched = () => {} |
|||
|
|||
onChange(v: NzSafeAny[]) {} |
|||
|
|||
writeValue(v: NzSafeAny): void { |
|||
this.value = v |
|||
} |
|||
|
|||
registerOnChange(fn: any): void { |
|||
this.onChange = fn |
|||
} |
|||
|
|||
registerOnTouched(fn: any): void { |
|||
this.onTouched = fn |
|||
} |
|||
|
|||
setDisabledState?(isDisabled: boolean): void { |
|||
this.disabled = isDisabled |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
<nz-select |
|||
[nzPlaceHolder]="placeholder" |
|||
[disabled]="disabled" |
|||
[(ngModel)]="value" |
|||
(ngModelChange)="onModelChange($event)" |
|||
> |
|||
@for (item of originData; track $index) { |
|||
<nz-option [nzLabel]="item.name" [nzValue]="item.warehouseId"></nz-option> |
|||
} |
|||
</nz-select> |
|||
@ -0,0 +1,91 @@ |
|||
import { |
|||
ChangeDetectorRef, |
|||
Component, |
|||
EventEmitter, |
|||
Input, |
|||
OnInit, |
|||
Output, |
|||
TemplateRef, |
|||
ViewChild, |
|||
forwardRef, |
|||
} from '@angular/core' |
|||
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
|||
|
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
|
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
|
|||
import { ApiService } from 'app/services' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
|
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { Utils } from 'app/utils' |
|||
import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd/tree' |
|||
import { NzTreeSelectComponent } from 'ng-zorro-antd/tree-select' |
|||
import { MAX_PAGE_SIZE } from 'app/constants' |
|||
|
|||
@Component({ |
|||
selector: 'app-warehouse-select', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './warehouse-select.component.html', |
|||
styleUrl: './warehouse-select.component.less', |
|||
providers: [ |
|||
{ |
|||
provide: NG_VALUE_ACCESSOR, |
|||
multi: true, |
|||
useExisting: forwardRef(() => WarehouseSelectComponent), |
|||
}, |
|||
], |
|||
}) |
|||
export class WarehouseSelectComponent { |
|||
constructor(private api: ApiService) {} |
|||
|
|||
@Input() placeholder: string = '请选择' |
|||
|
|||
@Input() modalTitle: string = '选择' |
|||
|
|||
@Input() radio: boolean = false |
|||
|
|||
@Output() onSelected = new EventEmitter<NzSafeAny>() |
|||
|
|||
@ViewChild('el') el!: NzTreeSelectComponent |
|||
|
|||
originData: NzSafeAny[] = [] |
|||
|
|||
value?: string |
|||
|
|||
disabled = false |
|||
|
|||
ngOnInit(): void { |
|||
this.api.getBasicWarehousePage({ pageSize: MAX_PAGE_SIZE, pageNum: 1 }).subscribe((res) => { |
|||
this.originData = res.body.rows |
|||
}) |
|||
} |
|||
|
|||
onModelChange(v: NzSafeAny) { |
|||
const item = this.originData.find((f) => f.maintenanceVendorId === v) |
|||
this.onSelected.emit(item) |
|||
this.onChange(v) |
|||
} |
|||
|
|||
onTouched = () => {} |
|||
|
|||
onChange(v: NzSafeAny[]) {} |
|||
|
|||
writeValue(v: NzSafeAny): void { |
|||
this.value = v |
|||
} |
|||
|
|||
registerOnChange(fn: any): void { |
|||
this.onChange = fn |
|||
} |
|||
|
|||
registerOnTouched(fn: any): void { |
|||
this.onTouched = fn |
|||
} |
|||
|
|||
setDisabledState?(isDisabled: boolean): void { |
|||
this.disabled = isDisabled |
|||
} |
|||
} |
|||
@ -1,91 +1,125 @@ |
|||
import { Component } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { ApiService } from 'app/services' |
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { of } from 'rxjs' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { AssetBusinessRevertFormComponent } from 'app/components' |
|||
import { BUSINESS_STATUS_MAP } from 'app/constants' |
|||
|
|||
@Component({ |
|||
selector: 'app-fixed-asset-manage-revert', |
|||
selector: 'app-fixed-asset-manage-return', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
imports: [SharedModule, AssetBusinessRevertFormComponent], |
|||
templateUrl: './fixed-asset-manage-revert.component.html', |
|||
styleUrl: './fixed-asset-manage-revert.component.less', |
|||
}) |
|||
export class FixedAssetManageRevertComponent { |
|||
constructor(private api: ApiService) {} |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
type: new FormControl(''), |
|||
status: new FormControl(''), |
|||
date: new FormControl(''), |
|||
name: new FormControl(), |
|||
businessId: new FormControl(), |
|||
status: new FormControl(), |
|||
date: new FormControl(), |
|||
}) |
|||
|
|||
BUSINESS_STATUS_MAP = BUSINESS_STATUS_MAP |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
selectable: true, |
|||
}) |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: '业务编号', title: '业务编号', visible: true }, |
|||
{ key: '业务名称', title: '业务名称', visible: true }, |
|||
{ key: '办理状态', title: '办理状态', visible: true }, |
|||
{ key: '调出所属公司', title: '调出所属公司', visible: true }, |
|||
{ key: '调入所属公司', title: '调入所属公司', visible: true }, |
|||
{ key: '调入管理员', title: '调入管理员', visible: true }, |
|||
{ key: '调拨说明', title: '调拨说明', visible: true }, |
|||
{ key: '制单人', title: '制单人', visible: true }, |
|||
{ key: '业务日期', title: '业务日期', visible: false }, |
|||
|
|||
{ key: '附件', title: '附件', visible: true }, |
|||
{ key: '创建时间', title: '创建时间', visible: false }, |
|||
{ key: '修改人ID', title: '修改人ID', visible: true }, |
|||
{ key: '使用人', title: '使用人', visible: true }, |
|||
|
|||
{ key: '选择数据', title: '选择数据', visible: true }, |
|||
|
|||
{ key: '创建时间', title: '创建时间', visible: true }, |
|||
{ key: 'id', title: '主键', visible: false }, |
|||
{ key: 'businessId', title: '业务编号', visible: true, width: '350px' }, |
|||
{ key: 'name', title: '业务名称', visible: true }, |
|||
{ key: 'status', title: '办理状态', visible: true }, |
|||
{ key: '_useOrganization', title: '归还后公司/部门', visible: true }, |
|||
{ key: '_manager', title: '管理人员', visible: true }, |
|||
{ key: '_position', title: '存放位置', visible: true }, |
|||
{ key: '_position', title: '详细位置', visible: true }, |
|||
{ key: 'businessGeneratedDate', title: '归还日期', visible: true }, |
|||
{ key: 'notes', title: '备注', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ title: '查看', premissions: [] }, |
|||
{ title: '修改' }, |
|||
{ title: '确认' }, |
|||
{ title: '单据' }, |
|||
{ title: '删除' }, |
|||
{ |
|||
title: '查看', |
|||
onClick: (v) => { |
|||
this.onCreate(v, true) |
|||
}, |
|||
}, |
|||
{ title: '修改', onClick: this.onCreate.bind(this) }, |
|||
{ title: '确认', onClick: this.confirm.bind(this) }, |
|||
// { title: '单据' },
|
|||
{ title: '删除', onClick: this.deleteItem.bind(this) }, |
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
if (Array.isArray(q['createTime'])) { |
|||
const createTimeStart = q['createTime']?.[0] |
|||
const createTimeEnd = q['createTime']?.[1] |
|||
return this.api.getBusinessRevertPage({ ...p, ...q }) |
|||
} |
|||
|
|||
q['createTimeStart'] = createTimeStart ? format(new Date(createTimeStart), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
q['createTimeEnd'] = createTimeEnd ? format(new Date(createTimeEnd), 'yyyy-MM-dd HH:mm:ss') : '' |
|||
} |
|||
return of({ |
|||
data: { |
|||
total: 5, |
|||
records: [ |
|||
{ |
|||
id: 1, |
|||
name: '沙滩', |
|||
price: 590, |
|||
type: 0, |
|||
lifespan: 6, |
|||
number: 20, |
|||
max: 20, |
|||
status: 1, |
|||
createTime: '2024-05-01', |
|||
}, |
|||
], |
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: data ? '编辑资产归还' : '添加资产归还', |
|||
nzContent: AssetBusinessRevertFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzOnOk: async (e) => { |
|||
const vals = e.getValues() |
|||
if (vals) { |
|||
const res = await lastValueFrom(this.api.saveBusinessRevert(vals)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
return true |
|||
} |
|||
|
|||
return false |
|||
}, |
|||
}) |
|||
} |
|||
|
|||
confirm(item?: NzSafeAny) { |
|||
const ids = [item.id] |
|||
this.modal.confirm({ |
|||
nzTitle: '警告', |
|||
nzContent: `是否要进行该操作?`, |
|||
nzOnOk: async () => { |
|||
const res = await lastValueFrom(this.api.confirmBusinessRevert(ids)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
}, |
|||
}) |
|||
} |
|||
|
|||
deleteItem(item?: NzSafeAny) { |
|||
const ids = [item.id] |
|||
this.modal.confirm({ |
|||
nzTitle: '警告', |
|||
nzContent: `是否要删除${ids.length}个资产归还?`, |
|||
nzOnOk: async () => { |
|||
const res = await lastValueFrom(this.api.deleteBusinessRevert(ids)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
}, |
|||
}) |
|||
return this.api.getEntityPage(p, q) |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,42 @@ |
|||
<app-page> |
|||
<ng-template #actionTpl> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="primary" (click)="onCreate()"> |
|||
<span>新建</span> |
|||
</button> |
|||
</nz-space> |
|||
</ng-template> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table |
|||
[options]="table" |
|||
[tableAction]="actionTpl" |
|||
[formGroup]="queryForm" |
|||
[renderColumn]="renderColumnTpl" |
|||
> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@case ('img') { |
|||
@if (data) { |
|||
<img [src]="data" nz-image class="h-10 w-10" /> |
|||
} @else { |
|||
- |
|||
} |
|||
} |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="名称"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
@ -0,0 +1,94 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { RepairFaultFormComponent } from 'app/components' |
|||
|
|||
@Component({ |
|||
selector: 'app-repair-fault', |
|||
standalone: true, |
|||
imports: [SharedModule, RepairFaultFormComponent], |
|||
templateUrl: './repair-fault.component.html', |
|||
styleUrl: './repair-fault.component.less', |
|||
}) |
|||
export class RepairFaultComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: 'id', title: '主键', visible: false }, |
|||
|
|||
{ key: 'name', title: '名称', visible: true }, |
|||
{ key: 'img', title: '图片', visible: true }, |
|||
|
|||
{ key: 'notes', title: '备注', visible: true }, |
|||
{ key: 'createTime', title: '创建时间', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ title: '修改', onClick: this.onCreate.bind(this) }, |
|||
{ title: '删除', onClick: this.deleteItem.bind(this) }, |
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getRepairFaultPage({ ...p, ...q }) |
|||
} |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: data ? '编辑故障信息' : '添加故障信息', |
|||
nzContent: RepairFaultFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzOnOk: async (e) => { |
|||
const vals = e.getValues() |
|||
if (vals) { |
|||
const res = await lastValueFrom(this.api.saveRepairFault(vals)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
return true |
|||
} |
|||
return false |
|||
}, |
|||
}) |
|||
} |
|||
|
|||
deleteItem(item?: NzSafeAny) { |
|||
const ids = [item.faultId] |
|||
this.modal.confirm({ |
|||
nzTitle: '警告', |
|||
nzContent: `是否要删除${ids.length}个故障信息?`, |
|||
nzOnOk: async () => { |
|||
const res = await lastValueFrom(this.api.deleteRepairFault(ids)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
}, |
|||
}) |
|||
} |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
<app-page> |
|||
<ng-template #actionTpl> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="primary" (click)="onCreate()"> |
|||
<span>新建</span> |
|||
</button> |
|||
</nz-space> |
|||
</ng-template> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table |
|||
[options]="table" |
|||
[tableAction]="actionTpl" |
|||
[formGroup]="queryForm" |
|||
[renderColumn]="renderColumnTpl" |
|||
> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="业务名称"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="业务编号"> |
|||
<input nz-input placeholder="请输入" formControlName="businessId" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
@ -0,0 +1,98 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { RepairFormComponent } from 'app/components' |
|||
|
|||
@Component({ |
|||
selector: 'app-repair-list', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './repair-list.component.html', |
|||
styleUrl: './repair-list.component.less', |
|||
}) |
|||
export class RepairListComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
businessId: new FormControl(''), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: 'id', title: '主键', visible: false }, |
|||
|
|||
{ key: 'name', title: '业务名称', visible: true }, |
|||
{ key: 'businessId', title: '业务编号', visible: true }, |
|||
{ key: 'plannedDate', title: '计划完成时间', visible: true }, |
|||
|
|||
{ key: 'notes', title: '备注', visible: true }, |
|||
{ key: 'createTime', title: '创建时间', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ title: '修改', onClick: this.onCreate.bind(this) }, |
|||
|
|||
{ title: '删除', onClick: this.deleteItem.bind(this) }, |
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getRepairPage({ ...p, ...q }) |
|||
} |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: data ? '编辑维修信息' : '添加维修信息', |
|||
nzContent: RepairFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzOnOk: async (e) => { |
|||
const vals = e.getValues() |
|||
if (vals) { |
|||
const res = await lastValueFrom(this.api.saveRepair(vals)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
return true |
|||
} |
|||
|
|||
return false |
|||
}, |
|||
}) |
|||
} |
|||
|
|||
deleteItem(item?: NzSafeAny) { |
|||
const ids = [item.repairTypeId] |
|||
this.modal.confirm({ |
|||
nzTitle: '警告', |
|||
nzContent: `是否要删除${ids.length}个维修信息?`, |
|||
nzOnOk: async () => { |
|||
const res = await lastValueFrom(this.api.deleteRepair(ids)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
}, |
|||
}) |
|||
} |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
<app-page> |
|||
<ng-template #actionTpl> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="primary" (click)="onCreate()"> |
|||
<span>新建</span> |
|||
</button> |
|||
</nz-space> |
|||
</ng-template> |
|||
<div class="flex-1 overflow-hidden"> |
|||
<app-server-paginated-table |
|||
[options]="table" |
|||
[tableAction]="actionTpl" |
|||
[formGroup]="queryForm" |
|||
[renderColumn]="renderColumnTpl" |
|||
> |
|||
<ng-template #renderColumnTpl let-data let-key="key" let-row="row"> |
|||
@switch (key) { |
|||
@default { |
|||
{{ data }} |
|||
} |
|||
} |
|||
</ng-template> |
|||
<ng-container *appTableAction> |
|||
<nz-space> |
|||
<button *nzSpaceItem nz-button nzType="link" nzDanger="">删除</button> |
|||
</nz-space> |
|||
</ng-container> |
|||
<ng-container *appTableForm> |
|||
<app-query-item label="业务名称"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="配置信息"> |
|||
<input nz-input placeholder="请输入" formControlName="config" /> |
|||
</app-query-item> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
|||
</app-page> |
|||
|
|||
<ng-template #createFormTpl> |
|||
<form nz-form [formGroup]="createForm"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired [nzSpan]="6">名称</nz-form-label> |
|||
<nz-form-control [nzSpan]="12" [nzErrorTip]="errorTpl"> |
|||
<input nz-input placeholder="请输入名称" formControlName="name" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
<nz-form-item> |
|||
<nz-form-label [nzSpan]="6">配置信息</nz-form-label> |
|||
<nz-form-control [nzSpan]="12"> |
|||
<input nz-input placeholder="请输入配置信息" formControlName="config" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</form> |
|||
</ng-template> |
|||
|
|||
<ng-template #errorTpl let-control> |
|||
<form-error-tips [control]="control"></form-error-tips> |
|||
</ng-template> |
|||
@ -0,0 +1,102 @@ |
|||
import { Component, TemplateRef, ViewChild } from '@angular/core' |
|||
import { FormControl, FormGroup } from '@angular/forms' |
|||
|
|||
import { AnyObject, TableOption } from 'app/shared/components/server-paginated-table' |
|||
import { ApiService } from 'app/services' |
|||
import { SharedModule } from 'app/shared/shared.module' |
|||
import { format } from 'date-fns' |
|||
import { lastValueFrom, of } from 'rxjs' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { BUSINESS_STATUS_MAP } from 'app/constants' |
|||
import { FormValidators } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-repair-type', |
|||
standalone: true, |
|||
imports: [SharedModule], |
|||
templateUrl: './repair-type.component.html', |
|||
styleUrl: './repair-type.component.less', |
|||
}) |
|||
export class RepairTypeComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
@ViewChild('createFormTpl') createFormTpl!: TemplateRef<{}> |
|||
|
|||
queryForm = new FormGroup({ |
|||
name: new FormControl(''), |
|||
config: new FormControl(''), |
|||
}) |
|||
|
|||
createForm = new FormGroup({ |
|||
repairTypeId: new FormControl(''), |
|||
name: new FormControl('', [FormValidators.required('请输入')]), |
|||
config: new FormControl(''), |
|||
}) |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
// .setConfig({
|
|||
// selectable: true,
|
|||
// rowKey: 'id',
|
|||
// })
|
|||
.setColumn([ |
|||
{ key: 'repairTypeId', title: '主键', visible: false }, |
|||
|
|||
{ key: 'name', title: '名称', visible: true }, |
|||
{ key: 'config', title: '配置信息', visible: true }, |
|||
|
|||
{ key: 'notes', title: '备注', visible: true }, |
|||
{ key: 'createTime', title: '创建时间', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ title: '修改', onClick: this.onCreate.bind(this) }, |
|||
|
|||
{ title: '删除', onClick: this.deleteItem.bind(this) }, |
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getRepairTypePage({ ...p, ...q }) |
|||
} |
|||
|
|||
onCreate(data?: NzSafeAny) { |
|||
if (data) { |
|||
this.createForm.patchValue(data) |
|||
} |
|||
this.modal.create({ |
|||
nzTitle: data ? '编辑资产入库' : '添加资产入库', |
|||
nzContent: this.createFormTpl, |
|||
nzOnOk: async () => { |
|||
if (FormValidators.validateFormGroup(this.createForm)) { |
|||
const vals = this.createForm.value |
|||
const res = await lastValueFrom(this.api.saveRepairType(vals)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
return true |
|||
} |
|||
return false |
|||
}, |
|||
}) |
|||
} |
|||
|
|||
deleteItem(item?: NzSafeAny) { |
|||
const ids = [item.repairTypeId] |
|||
this.modal.confirm({ |
|||
nzTitle: '警告', |
|||
nzContent: `是否要删除${ids.length}个维修类型?`, |
|||
nzOnOk: async () => { |
|||
const res = await lastValueFrom(this.api.deleteRepairType(ids)) |
|||
this.msg.success(res.desc) |
|||
this.table.ref.reload() |
|||
}, |
|||
}) |
|||
} |
|||
} |
|||
@ -1,19 +1,31 @@ |
|||
.query-control { |
|||
::ng-deep { |
|||
input { |
|||
min-width: 100px; |
|||
width: 100%; |
|||
} |
|||
// .query-item { |
|||
// padding-left: 10px; |
|||
// background-color: #fff; |
|||
// border-radius: 4px; |
|||
|
|||
nz-tree-select, |
|||
nz-select { |
|||
width: auto !important; |
|||
// ::ng-deep { |
|||
// input { |
|||
// border-color: transparent !important; |
|||
// } |
|||
// } |
|||
// } |
|||
|
|||
} |
|||
// .query-control { |
|||
// ::ng-deep { |
|||
// input { |
|||
// min-width: 100px; |
|||
// width: 100%; |
|||
// } |
|||
|
|||
.ant-select:not(.ant-select-customize-input) .ant-select-selector { |
|||
border: none; |
|||
} |
|||
// nz-tree-select, |
|||
// nz-select { |
|||
// width: 100%; |
|||
// } |
|||
|
|||
} |
|||
} |
|||
// .ant-select:not(.ant-select-customize-input) .ant-select-selector { |
|||
// border: none; |
|||
// } |
|||
|
|||
|
|||
// } |
|||
// } |
|||
Loading…
Reference in new issue