34 changed files with 936 additions and 165 deletions
@ -0,0 +1,91 @@ |
|||
<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"> |
|||
<input nz-input placeholder="请输入报废方式" formControlName="type" /> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="6"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>加急状态</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<nz-radio-group formControlName="expeditedStatus"> |
|||
<label nz-radio [nzValue]="0">普通</label> |
|||
<label nz-radio [nzValue]="1">紧急</label> |
|||
</nz-radio-group> |
|||
</nz-form-control> |
|||
</nz-form-item> |
|||
</div> |
|||
<div nz-col [nzSpan]="6"> |
|||
<nz-form-item> |
|||
<nz-form-label nzRequired>业务生成日期</nz-form-label> |
|||
<nz-form-control [nzErrorTip]="errorTpl"> |
|||
<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"> |
|||
<input nz-input formControlName="applicant" /> |
|||
</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,124 @@ |
|||
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-retirement', |
|||
standalone: true, |
|||
imports: [ |
|||
SharedModule, |
|||
SelectUserByOrgComponent, |
|||
SupplierSelectComponent, |
|||
AssetSelectComponent, |
|||
OrgSelectComponent, |
|||
PositionSelectComponent, |
|||
], |
|||
templateUrl: './asset-business-retirement.component.html', |
|||
styleUrl: './asset-business-retirement.component.less', |
|||
}) |
|||
export class AssetBusinessRetirementComponent { |
|||
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('请选择')]),
|
|||
type: this.fb.control(null, []), |
|||
businessGeneratedDate: this.fb.control(null, [FormValidators.required('请选择')]), |
|||
|
|||
expeditedStatus: this.fb.control(0, []), |
|||
notes: this.fb.control(null, []), |
|||
// positionId: this.fb.control(null, []),
|
|||
attach: this.fb.control('', []), |
|||
// positionDetail: this.fb.control('', []),
|
|||
applicant: this.fb.control({ value: '', disabled: true }, []), |
|||
|
|||
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] : [], |
|||
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, |
|||
warehouseId: data._warehouse?.warehouseId, |
|||
manufacturersVendorId: data._manufacturersVendor?.manufacturersVendorId, |
|||
applicant: data._applicant?.userName, |
|||
}) |
|||
} |
|||
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: v.assetIdList, |
|||
// assetIdList: typeof v.assetIdList === 'string' ? v.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,188 @@ |
|||
<div class="flex-1 overflow-hidden bg-white"> |
|||
<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> |
|||
|
|||
<!-- <app-query-item label="设备标签"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="设备IP"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="管理IP"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
<app-query-item label="设备IP"> |
|||
<input nz-input placeholder="请输入" formControlName="name" /> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="运行环境"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="营业"></nz-option> |
|||
<nz-option nzValue="22" nzLabel="办公"></nz-option> |
|||
<nz-option nzValue="2211" nzLabel="生产"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="测试"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="来源"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="捐赠"></nz-option> |
|||
<nz-option nzValue="22" nzLabel="赠送"></nz-option> |
|||
<nz-option nzValue="2211" nzLabel="采购"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="自建"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="自购"></nz-option> |
|||
<nz-option nzValue="2221" nzLabel="其他"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="厂商"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="维保商"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
|
|||
<app-query-item label="采购日期"> |
|||
<app-date-query></app-date-query> |
|||
</app-query-item> |
|||
<app-query-item label="所属公司"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="使用组织"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="管理人员"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> |
|||
<app-query-item label="使用人员"> |
|||
<nz-select |
|||
nzPlacement="bottomRight" |
|||
class="!w-auto" |
|||
[nzDropdownMatchSelectWidth]="false" |
|||
> |
|||
<nz-option nzValue="123" nzLabel="11"></nz-option> |
|||
</nz-select> |
|||
</app-query-item> --> |
|||
</ng-container> |
|||
</app-server-paginated-table> |
|||
</div> |
@ -0,0 +1,95 @@ |
|||
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 { AssetFormComponent, ManufacturerSelectComponent, PositionSelectComponent } from 'app/components' |
|||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal' |
|||
import { NzMessageService } from 'ng-zorro-antd/message' |
|||
import { NzSafeAny } from 'ng-zorro-antd/core/types' |
|||
import { ASSET_SOURCE_MAP, ASSET_STATUS, ASSET_STATUS_MAP } from 'app/constants' |
|||
import { Utils } from 'app/utils' |
|||
|
|||
@Component({ |
|||
selector: 'app-fixed-asset-storage', |
|||
standalone: true, |
|||
imports: [SharedModule, AssetFormComponent, PositionSelectComponent, ManufacturerSelectComponent], |
|||
templateUrl: './fixed-asset-storage.component.html', |
|||
styleUrl: './fixed-asset-storage.component.less', |
|||
}) |
|||
export class FixedAssetStorageComponent { |
|||
constructor( |
|||
private api: ApiService, |
|||
private modal: NzModalService, |
|||
private msg: NzMessageService, |
|||
) {} |
|||
|
|||
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(), |
|||
}) |
|||
|
|||
@ViewChild('copyTpl') copyTpl!: TemplateRef<NzSafeAny> |
|||
|
|||
ASSET_STATUS_MAP = ASSET_STATUS_MAP() |
|||
|
|||
ASSET_SOURCE_MAP = ASSET_SOURCE_MAP |
|||
|
|||
table = new TableOption(this.fetchData.bind(this)) |
|||
|
|||
copyNum = 1 |
|||
|
|||
ngOnInit(): void { |
|||
this.table |
|||
.setConfig({ |
|||
rowKey: 'assetId', |
|||
}) |
|||
.setColumn([ |
|||
{ key: 'assetCode', title: '资产编号', visible: true }, |
|||
{ key: 'name', title: '资产名称', visible: true }, |
|||
{ key: 'categoryName', title: '资产分类', visible: true }, |
|||
{ key: 'status', title: '资产状态', visible: true }, |
|||
{ key: 'count', title: '库存数量', visible: true }, |
|||
{ key: 'safetyLimit', title: '安全数量', visible: true }, |
|||
{ key: 'upperLimit', title: '库存上限', visible: true }, |
|||
{ key: 'lowerLimit', title: '库存下线', visible: true }, |
|||
|
|||
{ key: 'warehouseName', title: '存放仓库', visible: true }, |
|||
]) |
|||
.setRowOperate([ |
|||
{ |
|||
title: '查看', |
|||
onClick: (v) => { |
|||
this.onCreate(v, true) |
|||
}, |
|||
}, |
|||
]) |
|||
} |
|||
|
|||
fetchData(p: {}, q: AnyObject) { |
|||
return this.api.getAssetStroagePage({ ...p, ...q }) |
|||
} |
|||
|
|||
onCreate(data?: NzSafeAny, preview?: boolean) { |
|||
this.modal.create({ |
|||
nzTitle: '查看资产', |
|||
nzContent: AssetFormComponent, |
|||
nzWidth: '80vw', |
|||
nzWrapClassName: 'modal-lg', |
|||
nzData: { |
|||
value: data, |
|||
preview, |
|||
}, |
|||
nzFooter: null, |
|||
}) |
|||
} |
|||
} |
Loading…
Reference in new issue