From f49af3b799d7d38f22d574f175bc91f0b0329daf Mon Sep 17 00:00:00 2001 From: kkerwin Date: Sun, 5 May 2024 00:18:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E8=B5=84=E7=AE=A1=E7=90=86=20&=20?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E7=BB=B4=E4=BF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-admin-app/README.md | 9 + web-admin-app/src/app/app.routes.ts | 33 +- .../asset-business-allot-form.component.html | 80 +++ .../asset-business-allot-form.component.less | 0 .../asset-business-allot-form.component.ts | 112 +++ .../asset-business-borrow-form.component.html | 88 +++ .../asset-business-borrow-form.component.less | 0 .../asset-business-borrow-form.component.ts | 109 +++ .../asset-business-collection.component.html | 95 +++ .../asset-business-collection.component.less | 0 .../asset-business-collection.component.ts | 113 +++ .../asset-business-return-form.component.html | 95 +++ .../asset-business-return-form.component.less | 0 .../asset-business-return-form.component.ts | 109 +++ .../asset-business-revert-form.component.html | 104 +++ .../asset-business-revert-form.component.less | 0 .../asset-business-revert-form.component.ts | 110 +++ ...asset-business-storage-form.component.html | 79 +++ ...asset-business-storage-form.component.less | 4 + .../asset-business-storage-form.component.ts | 109 +++ ...sset-business-transfer-form.component.html | 104 +++ ...sset-business-transfer-form.component.less | 0 .../asset-business-transfer-form.component.ts | 115 ++++ .../asset-category-select.component.html | 1 + .../asset-category-select.component.ts | 6 +- .../asset-form/asset-form.component.html | 646 +++++++++++------- .../asset-form/asset-form.component.less | 1 + .../asset-form/asset-form.component.ts | 22 +- .../asset-operation-records.component.html | 49 ++ .../asset-operation-records.component.less | 0 .../asset-operation-records.component.ts | 61 ++ .../asset-select/asset-select.component.html | 148 ++++ .../asset-select/asset-select.component.less | 0 .../asset-select/asset-select.component.ts | 193 ++++++ web-admin-app/src/app/components/index.ts | 15 + .../maintenance-select.component.html | 7 +- .../maintenance-select.component.ts | 6 +- .../manufacturer-select.component.html | 1 + .../manufacturer-select.component.ts | 6 +- .../org-select/org-select.component.html | 1 + .../org-select/org-select.component.ts | 6 +- .../position-select.component.html | 1 + .../position-select.component.ts | 6 +- .../repair-fault-form.component.html | 74 ++ .../repair-fault-form.component.less | 0 .../repair-fault-form.component.ts | 137 ++++ .../repair-form/repair-form.component.html | 84 +++ .../repair-form/repair-form.component.less | 0 .../repair-form/repair-form.component.ts | 113 +++ .../select-user-by-org.component.html | 2 +- .../select-user-by-org.component.ts | 6 +- .../supplier-select.component.html | 10 + .../supplier-select.component.less | 0 .../supplier-select.component.ts | 91 +++ .../warehouse-select.component.html | 10 + .../warehouse-select.component.less | 0 .../warehouse-select.component.ts | 91 +++ web-admin-app/src/app/constants/index.ts | 8 + .../fixed-asset/fixed-asset.component.html | 55 +- .../fixed-asset/fixed-asset.component.ts | 8 +- .../fixed-asset-belong.component.html | 56 +- .../fixed-asset-category.component.html | 56 +- .../fixed-asset-employee.component.html | 56 +- .../fixed-asset-org.component.html | 56 +- .../fixed-asset-position.component.html | 56 +- .../fixed-asset-manage-allot.component.html | 97 +-- .../fixed-asset-manage-allot.component.ts | 145 ++-- .../fixed-asset-manage-borrow.component.html | 86 ++- .../fixed-asset-manage-borrow.component.ts | 146 ++-- ...d-asset-manage-distribution.component.html | 95 +-- ...xed-asset-manage-distribution.component.ts | 140 ++-- .../fixed-asset-manage-entry.component.html | 78 ++- .../fixed-asset-manage-entry.component.ts | 129 ++-- .../fixed-asset-manage-return.component.html | 95 +-- .../fixed-asset-manage-return.component.ts | 142 ++-- .../fixed-asset-manage-revert.component.html | 79 ++- .../fixed-asset-manage-revert.component.ts | 150 ++-- .../fixed-asset-manage-scrap.component.html | 21 +- ...fixed-asset-manage-transfer.component.html | 97 +-- .../fixed-asset-manage-transfer.component.ts | 146 ++-- .../fixed-asset-manage.component.html | 20 +- .../fixed-asset-manage.component.ts | 16 +- .../repair-fault/repair-fault.component.html | 42 ++ .../repair-fault/repair-fault.component.less | 0 .../repair-fault/repair-fault.component.ts | 94 +++ .../repair-list/repair-list.component.html | 38 ++ .../repair-list/repair-list.component.less | 0 .../repair-list/repair-list.component.ts | 98 +++ .../repair-type/repair-type.component.html | 59 ++ .../repair-type/repair-type.component.less | 0 .../repair-type/repair-type.component.ts | 102 +++ .../stockaking-job.component.html | 1 - web-admin-app/src/app/services/api.service.ts | 154 +++++ .../query-item/query-item.component.html | 2 +- .../query-item/query-item.component.less | 42 +- .../server-paginated-table.component.html | 4 +- .../server-paginated-table.component.less | 26 +- web-admin-app/src/styles.less | 6 +- 98 files changed, 4757 insertions(+), 1206 deletions(-) create mode 100644 web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.html create mode 100644 web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.less create mode 100644 web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.ts create mode 100644 web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.html create mode 100644 web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.less create mode 100644 web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.ts create mode 100644 web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.html create mode 100644 web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.less create mode 100644 web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.ts create mode 100644 web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.html create mode 100644 web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.less create mode 100644 web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.ts create mode 100644 web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.html create mode 100644 web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.less create mode 100644 web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.ts create mode 100644 web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.html create mode 100644 web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.less create mode 100644 web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.ts create mode 100644 web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.html create mode 100644 web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.less create mode 100644 web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.ts create mode 100644 web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.html create mode 100644 web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.less create mode 100644 web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.ts create mode 100644 web-admin-app/src/app/components/asset-select/asset-select.component.html create mode 100644 web-admin-app/src/app/components/asset-select/asset-select.component.less create mode 100644 web-admin-app/src/app/components/asset-select/asset-select.component.ts create mode 100644 web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.html create mode 100644 web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.less create mode 100644 web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.ts create mode 100644 web-admin-app/src/app/components/repair-form/repair-form.component.html create mode 100644 web-admin-app/src/app/components/repair-form/repair-form.component.less create mode 100644 web-admin-app/src/app/components/repair-form/repair-form.component.ts create mode 100644 web-admin-app/src/app/components/supplier-select/supplier-select.component.html create mode 100644 web-admin-app/src/app/components/supplier-select/supplier-select.component.less create mode 100644 web-admin-app/src/app/components/supplier-select/supplier-select.component.ts create mode 100644 web-admin-app/src/app/components/warehouse-select/warehouse-select.component.html create mode 100644 web-admin-app/src/app/components/warehouse-select/warehouse-select.component.less create mode 100644 web-admin-app/src/app/components/warehouse-select/warehouse-select.component.ts create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.html create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.less create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.ts create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.html create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.less create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.ts create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.html create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.less create mode 100644 web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.ts diff --git a/web-admin-app/README.md b/web-admin-app/README.md index 29c8e7b..40b5073 100644 --- a/web-admin-app/README.md +++ b/web-admin-app/README.md @@ -34,4 +34,13 @@ - 所有列表页分页total 最多10 条, pageSize & pageNum - 【盘点计划】内容和盘点任务一样 ? - 【资产】 财务分类 id 从哪里选择? +- 【资产】 费用项目 id 从哪里选择? +- 【资产】 财务选项 id 从哪里选择? +## 05-04 +- 【固资管理】 所有新增接口报错 500 , 建议:参数不对的情况 提示信息明确一点 +- 【资产入库】 需要添加一个接口,前端提交资产id列表,后端返回对应的资产数据列表 + +## 05-05 +- 【维修登记】 新增接口报错 500 +- 业务编号 需不需要输入? diff --git a/web-admin-app/src/app/app.routes.ts b/web-admin-app/src/app/app.routes.ts index 916adfe..8b011c1 100644 --- a/web-admin-app/src/app/app.routes.ts +++ b/web-admin-app/src/app/app.routes.ts @@ -42,6 +42,9 @@ import { BasicSupplierComponent } from './pages/fixed-asset/basic/basic-supplier import { BasicCategoryComponent } from './pages/fixed-asset/basic/basic-category/basic-category.component' import { StockakingJobComponent } from './pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component' import { StockakingPlanComponent } from './pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component' +import { RepairTypeComponent } from './pages/fixed-asset/repair/repair-type/repair-type.component' +import { RepairListComponent } from './pages/fixed-asset/repair/repair-list/repair-list.component' +import { RepairFaultComponent } from './pages/fixed-asset/repair/repair-fault/repair-fault.component' export const routes: Routes = [ { @@ -185,6 +188,32 @@ export const routes: Routes = [ }, ], }, + { + path: 'repair', + title: '维护维保', + children: [ + { + path: '', + redirectTo: 'list', + pathMatch: 'full', + }, + { + path: 'type', + component: RepairTypeComponent, + title: '维修类型', + }, + { + path: 'list', + component: RepairListComponent, + title: '维修登记', + }, + { + path: 'fault', + component: RepairFaultComponent, + title: '故障登记', + }, + ], + }, { path: 'manage', // title: '固资管理', @@ -207,12 +236,12 @@ export const routes: Routes = [ { path: 'distribution', component: FixedAssetManageDistributionComponent, - title: '资产派发', + title: '资产领用', }, { path: 'return', component: FixedAssetManageReturnComponent, - title: '资产退还', + title: '资产退库', }, { path: 'borrow', diff --git a/web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.html b/web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.html new file mode 100644 index 0000000..0b2b9f9 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.html @@ -0,0 +1,80 @@ + diff --git a/web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.less b/web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.ts b/web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.ts new file mode 100644 index 0000000..e7df972 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-allot-form/asset-business-allot-form.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.html b/web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.html new file mode 100644 index 0000000..44c0eb8 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.html @@ -0,0 +1,88 @@ + diff --git a/web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.less b/web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.ts b/web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.ts new file mode 100644 index 0000000..daf98f2 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-borrow-form/asset-business-borrow-form.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.html b/web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.html new file mode 100644 index 0000000..308c988 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.html @@ -0,0 +1,95 @@ + diff --git a/web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.less b/web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.ts b/web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.ts new file mode 100644 index 0000000..b512cd5 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-collection/asset-business-collection.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.html b/web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.html new file mode 100644 index 0000000..2deef90 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.html @@ -0,0 +1,95 @@ + diff --git a/web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.less b/web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.ts b/web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.ts new file mode 100644 index 0000000..32df8de --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-return-form/asset-business-return-form.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.html b/web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.html new file mode 100644 index 0000000..6606b5c --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.html @@ -0,0 +1,104 @@ + diff --git a/web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.less b/web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.ts b/web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.ts new file mode 100644 index 0000000..e3c3c95 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-revert-form/asset-business-revert-form.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.html b/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.html new file mode 100644 index 0000000..6ccaf6c --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.html @@ -0,0 +1,79 @@ + diff --git a/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.less b/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.less new file mode 100644 index 0000000..8ce33e4 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.less @@ -0,0 +1,4 @@ +.modal { + height: 70vh; + overflow-y: auto; +} \ No newline at end of file diff --git a/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.ts b/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.ts new file mode 100644 index 0000000..5c3e6a4 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-storage-form/asset-business-storage-form.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.html b/web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.html new file mode 100644 index 0000000..4012d6e --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.html @@ -0,0 +1,104 @@ + diff --git a/web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.less b/web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.ts b/web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.ts new file mode 100644 index 0000000..e9ff588 --- /dev/null +++ b/web-admin-app/src/app/components/asset-business-transfer-form/asset-business-transfer-form.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/asset-category-select/asset-category-select.component.html b/web-admin-app/src/app/components/asset-category-select/asset-category-select.component.html index 4a12fcd..dbe408f 100644 --- a/web-admin-app/src/app/components/asset-category-select/asset-category-select.component.html +++ b/web-admin-app/src/app/components/asset-category-select/asset-category-select.component.html @@ -2,6 +2,7 @@ [nzNodes]="assetCategoryTree" [nzPlaceHolder]="placeholder" [(ngModel)]="value" + [disabled]="disabled" (ngModelChange)="onChange($event)" > diff --git a/web-admin-app/src/app/components/asset-category-select/asset-category-select.component.ts b/web-admin-app/src/app/components/asset-category-select/asset-category-select.component.ts index 4be9680..f38e36c 100644 --- a/web-admin-app/src/app/components/asset-category-select/asset-category-select.component.ts +++ b/web-admin-app/src/app/components/asset-category-select/asset-category-select.component.ts @@ -49,6 +49,8 @@ export class AssetCategorySelectComponent implements ControlValueAccessor, OnIni value?: string + disabled = false + ngOnInit(): void { this.api.getBasicCategoryTree().subscribe((res) => { this.originTreeData = res.body @@ -73,5 +75,7 @@ export class AssetCategorySelectComponent implements ControlValueAccessor, OnIni this.onTouched = fn } - setDisabledState?(isDisabled: boolean): void {} + setDisabledState?(isDisabled: boolean): void { + this.disabled = isDisabled + } } diff --git a/web-admin-app/src/app/components/asset-form/asset-form.component.html b/web-admin-app/src/app/components/asset-form/asset-form.component.html index 9c51f32..4ddc832 100644 --- a/web-admin-app/src/app/components/asset-form/asset-form.component.html +++ b/web-admin-app/src/app/components/asset-form/asset-form.component.html @@ -1,263 +1,395 @@ -
-
- - - - - - - - +
+ + + + + + + @if (data.preview) { + + + } + + + @if (groupIndex < 3) { + + @switch (groupIndex) { + @case (0) { + + } + @case (1) { + + } + @case (2) { + + } + } + +
+
+ + 资产分类 + + + + +
+
+ + 资产名称 + + + + +
+
+ + 资产状态 + + + @for (item of ASSET_STATUS; track $index) { + + } + + + +
+
+ + 所属公司 + + + + +
+
+ + 使用组织 + + + + +
+
+ + 管理人员 + + + + + +
+
+ + 使用人员 + + + + +
+
+ + 资产来源 + + + @for (item of ASSET_SOURCE_MAP | keyvalue; track $index) { + + } + + + +
+
+ + 资产厂商 + + + + + +
+
+ + 序列号 + + + + +
+
+ + 规格型号 + + + + +
+
+ + 用途 + + + + +
+
+ + 存放位置 + + + + + +
+
+ + 详细位置 + + + + +
+
+ + 计量单位 + + + + +
+
+
+ +
+
+ + 维保厂商 + + + + +
+
+ + 联系人 + + + + +
+
+ + 联系方式 + + + + +
+
+ + 负责人 + + + + +
+
+ + 维保开始 + + + + +
+
+ + 维保到期 + + + + +
+
+ + 维保状态 + + + @for (item of MAINTENANCE_STATUS | keyvalue; track $index) { + + } + + + +
+
+ + 维保方式 + + + @for (item of MAINTENANCE_TYPE | keyvalue; track $index) { + + } + + + +
+
+ + 建议维保方式 + + + @for (item of MAINTENANCE_TYPE | keyvalue; track $index) { + + } + + + +
+
+ + 维保备注 + + + + +
+
+
+ +
+
+ + 财务分类 + + + + +
+
+ + 费用项目 + + + + +
+
+ + 财务选项 + + + + +
+
+ + 入账日期 + + + + +
+
+ + 客户信息 + + + + +
+
+ + 未税成本 + + + + +
+
+ + 资产税额 + + + + +
+
+ + 资产净值 + + + + +
+
+ + 残值率 + + + + +
+
+ + 财务备注 + + + + +
+
+
+ + + + + + } @else { @switch (groupIndex) { - @case (0) { - + @case (3) { + + } + @case (4) { + 4 } - @case (1) { - + @case (5) { + 5 } - @case (2) { - + @case (6) { + 6 + } + @case (7) { + } } -
-
- - -
-
- - 资产分类 - - - - -
-
- - 资产名称 - - - - -
- -
- - 资产状态 - - - @for (item of ASSET_STATUS; track $index) { - - } - - - -
-
- - 所属公司 - - - - -
-
- - 使用组织 - - - - -
-
- - 管理人员 - - - - - -
-
- - 使用人员 - - - - -
-
- - 资产来源 - - - @for (item of ASSET_SOURCE_MAP | keyvalue; track $index) { - - } - - - -
-
- - 资产厂商 - - - - - -
-
- - 序列号 - - - - -
-
- - 规格型号 - - - - -
-
- - 用途 - - - - -
-
- - 存放位置 - - - - - -
-
- - 详细位置 - - - - -
-
- - 计量单位 - - - - -
-
-
- -
-
- - 维保厂商 - - - - -
-
- - 联系人 - - - - -
-
- - 联系方式 - - - - -
-
- - 负责人 - - - - -
-
- - 维保开始 - - - - -
-
- - 维保到期 - - - - -
-
- - 维保状态 - - - @for (item of MAINTENANCE_STATUS | keyvalue; track $index) { - - } - - - -
-
- - 维保方式 - - - @for (item of MAINTENANCE_TYPE | keyvalue; track $index) { - - } - - - -
-
- - 建议维保方式 - - - @for (item of MAINTENANCE_TYPE | keyvalue; track $index) { - - } - - - -
-
- - 维保备注 - - - - -
-
-
- 3 - - - - - + } +
+
diff --git a/web-admin-app/src/app/components/asset-form/asset-form.component.less b/web-admin-app/src/app/components/asset-form/asset-form.component.less index b5ea3d1..a4ab8db 100644 --- a/web-admin-app/src/app/components/asset-form/asset-form.component.less +++ b/web-admin-app/src/app/components/asset-form/asset-form.component.less @@ -1,4 +1,5 @@ .asset-form { height: 80vh; + margin: -24px; overflow: auto; } \ No newline at end of file diff --git a/web-admin-app/src/app/components/asset-form/asset-form.component.ts b/web-admin-app/src/app/components/asset-form/asset-form.component.ts index 7c32de1..fc064bc 100644 --- a/web-admin-app/src/app/components/asset-form/asset-form.component.ts +++ b/web-admin-app/src/app/components/asset-form/asset-form.component.ts @@ -13,6 +13,7 @@ import { PositionSelectComponent } from '../position-select/position-select.comp 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 { AssetOperationRecordsComponent } from '../asset-operation-records/asset-operation-records.component' @Component({ selector: 'app-asset-form', @@ -25,6 +26,7 @@ import { NZ_MODAL_DATA } from 'ng-zorro-antd/modal' ManufacturerSelectComponent, PositionSelectComponent, MaintenanceSelectComponent, + AssetOperationRecordsComponent, ], templateUrl: './asset-form.component.html', styleUrl: './asset-form.component.less', @@ -79,16 +81,27 @@ export class AssetFormComponent implements OnInit { maintenanceType: this.fb.control(null, []), suggestMaintenanceType: this.fb.control(null, []), maintenanceNotes: this.fb.control(null, []), + + financialNotes: this.fb.control(null, []), + financialCategoryId: this.fb.control(null, []), + residualsRate: this.fb.control(null, []), + financialOption: this.fb.control(null, []), + expenseItem: this.fb.control(null, []), + navPrice: this.fb.control(null, []), + customerInfo: this.fb.control(null, []), + taxAmountRate: this.fb.control(null, []), + totalAmountPrice: this.fb.control(null, []), + registerDate: this.fb.control(null, []), }) + this.patchValues() } patchValues() { - if (this.data) { - const data = this.data + 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] : [], @@ -100,6 +113,9 @@ export class AssetFormComponent implements OnInit { manufacturersVendorId: data._manufacturersVendor?.manufacturersVendorId, }) } + if (preview) { + this.formGroup.disable() + } } public getValues() { diff --git a/web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.html b/web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.html new file mode 100644 index 0000000..fc8002d --- /dev/null +++ b/web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.html @@ -0,0 +1,49 @@ +
+ + + @switch (key) { + @case ('status') { + + } + + @default { + {{ data }} + } + } + + + +
+
+
+ + 业务编号 + + + + +
+
+ + 操作内容 + + + + +
+
+ + 操作类型 + + + + +
+
+
+
+
+
diff --git a/web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.less b/web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.ts b/web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.ts new file mode 100644 index 0000000..bceeeed --- /dev/null +++ b/web-admin-app/src/app/components/asset-operation-records/asset-operation-records.component.ts @@ -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 }) + } +} diff --git a/web-admin-app/src/app/components/asset-select/asset-select.component.html b/web-admin-app/src/app/components/asset-select/asset-select.component.html new file mode 100644 index 0000000..41dd210 --- /dev/null +++ b/web-admin-app/src/app/components/asset-select/asset-select.component.html @@ -0,0 +1,148 @@ + + + + + + + + + + + + @switch (key) { + @case ('status') { + + {{ ASSET_STATUS_MAP[data] }} + + } + @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 }} + } + } + + + + + + + + + + + + + + + + + + + @for (item of ASSET_STATUS_MAP | keyvalue; track $index) { + + } + + + + + @for (item of ASSET_SOURCE_MAP | keyvalue; track $index) { + + } + + + + + + + + + + + + + + + + + + 资产编号 + 资产分类 + 资产状态 + 资产名称 + 规格型号 + 资产序列号 + + + + + + {{ data.assetCode }} + {{ data?._category.categoryName ?? '-' }} + + + {{ ASSET_STATUS_MAP[data.status] }} + + + {{ data.name }} + {{ data.model }} + {{ data.serialNumber }} + + + + diff --git a/web-admin-app/src/app/components/asset-select/asset-select.component.less b/web-admin-app/src/app/components/asset-select/asset-select.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/asset-select/asset-select.component.ts b/web-admin-app/src/app/components/asset-select/asset-select.component.ts new file mode 100644 index 0000000..dff8417 --- /dev/null +++ b/web-admin-app/src/app/components/asset-select/asset-select.component.ts @@ -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() + + allGetedDataMap = new Map() + + originData: NzSafeAny[] = [] + + value?: string + + disabled = false + + selectedDataList: NzSafeAny[] = [] + + checkedAll = false + + loading = false + + indeterminate = false + + setOfCheckedId = new Set() + + 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 + } +} diff --git a/web-admin-app/src/app/components/index.ts b/web-admin-app/src/app/components/index.ts index 547c24b..d8aac2e 100644 --- a/web-admin-app/src/app/components/index.ts +++ b/web-admin-app/src/app/components/index.ts @@ -7,3 +7,18 @@ export * from './org-select/org-select.component' export * from './manufacturer-select/manufacturer-select.component' export * from './position-select/position-select.component' export * from './maintenance-select/maintenance-select.component' +export * from './asset-operation-records/asset-operation-records.component' +export * from './asset-business-storage-form/asset-business-storage-form.component' +export * from './supplier-select/supplier-select.component' +export * from './asset-select/asset-select.component' +export * from './warehouse-select/warehouse-select.component' + +export * from './asset-business-collection/asset-business-collection.component' +export * from './asset-business-return-form/asset-business-return-form.component' +export * from './asset-business-borrow-form/asset-business-borrow-form.component' +export * from './asset-business-revert-form/asset-business-revert-form.component' +export * from './asset-business-allot-form/asset-business-allot-form.component' +export * from './asset-business-transfer-form/asset-business-transfer-form.component' + +export * from './repair-form/repair-form.component' +export * from './repair-fault-form/repair-fault-form.component' diff --git a/web-admin-app/src/app/components/maintenance-select/maintenance-select.component.html b/web-admin-app/src/app/components/maintenance-select/maintenance-select.component.html index e86026a..079a12b 100644 --- a/web-admin-app/src/app/components/maintenance-select/maintenance-select.component.html +++ b/web-admin-app/src/app/components/maintenance-select/maintenance-select.component.html @@ -1,4 +1,9 @@ - + @for (item of originData; track $index) { } diff --git a/web-admin-app/src/app/components/maintenance-select/maintenance-select.component.ts b/web-admin-app/src/app/components/maintenance-select/maintenance-select.component.ts index 92c7e97..ad7a0ee 100644 --- a/web-admin-app/src/app/components/maintenance-select/maintenance-select.component.ts +++ b/web-admin-app/src/app/components/maintenance-select/maintenance-select.component.ts @@ -55,6 +55,8 @@ export class MaintenanceSelectComponent { value?: string + disabled = false + ngOnInit(): void { this.api.getBasicMaintenanceVendorPage({ pageSize: MAX_PAGE_SIZE, pageNum: 1 }).subscribe((res) => { this.originData = res.body.rows @@ -83,5 +85,7 @@ export class MaintenanceSelectComponent { this.onTouched = fn } - setDisabledState?(isDisabled: boolean): void {} + setDisabledState?(isDisabled: boolean): void { + this.disabled = isDisabled + } } diff --git a/web-admin-app/src/app/components/manufacturer-select/manufacturer-select.component.html b/web-admin-app/src/app/components/manufacturer-select/manufacturer-select.component.html index 711d985..4988b92 100644 --- a/web-admin-app/src/app/components/manufacturer-select/manufacturer-select.component.html +++ b/web-admin-app/src/app/components/manufacturer-select/manufacturer-select.component.html @@ -1,6 +1,7 @@ diff --git a/web-admin-app/src/app/components/manufacturer-select/manufacturer-select.component.ts b/web-admin-app/src/app/components/manufacturer-select/manufacturer-select.component.ts index 1035a0d..b905586 100644 --- a/web-admin-app/src/app/components/manufacturer-select/manufacturer-select.component.ts +++ b/web-admin-app/src/app/components/manufacturer-select/manufacturer-select.component.ts @@ -48,6 +48,8 @@ export class ManufacturerSelectComponent { value?: string + disabled = false + ngOnInit(): void { this.api.getBasicManufacturersVendorPage({ pageSize: MAX_PAGE_SIZE, pageNum: 1 }).subscribe((res) => { this.originData = res.body.rows @@ -74,5 +76,7 @@ export class ManufacturerSelectComponent { this.onTouched = fn } - setDisabledState?(isDisabled: boolean): void {} + setDisabledState?(isDisabled: boolean): void { + this.disabled = isDisabled + } } diff --git a/web-admin-app/src/app/components/org-select/org-select.component.html b/web-admin-app/src/app/components/org-select/org-select.component.html index a209e8a..5af6020 100644 --- a/web-admin-app/src/app/components/org-select/org-select.component.html +++ b/web-admin-app/src/app/components/org-select/org-select.component.html @@ -3,5 +3,6 @@ [nzPlaceHolder]="placeholder" [(ngModel)]="value" (ngModelChange)="onChange($event)" + [disabled]="disabled" > diff --git a/web-admin-app/src/app/components/org-select/org-select.component.ts b/web-admin-app/src/app/components/org-select/org-select.component.ts index c21851d..3ed4a8a 100644 --- a/web-admin-app/src/app/components/org-select/org-select.component.ts +++ b/web-admin-app/src/app/components/org-select/org-select.component.ts @@ -44,7 +44,7 @@ export class OrgSelectComponent implements ControlValueAccessor, OnInit { orgTree: NzSafeAny[] = [] value?: string - + disabled = false ngOnInit(): void { this.api.getOrgTree().subscribe((res) => { this.originTreeData = res.body @@ -85,5 +85,7 @@ export class OrgSelectComponent implements ControlValueAccessor, OnInit { this.onTouched = fn } - setDisabledState?(isDisabled: boolean): void {} + setDisabledState?(isDisabled: boolean): void { + this.disabled = isDisabled + } } diff --git a/web-admin-app/src/app/components/position-select/position-select.component.html b/web-admin-app/src/app/components/position-select/position-select.component.html index 0c40dff..c9bcf3c 100644 --- a/web-admin-app/src/app/components/position-select/position-select.component.html +++ b/web-admin-app/src/app/components/position-select/position-select.component.html @@ -2,6 +2,7 @@ [nzNodes]="positionTree" [nzPlaceHolder]="placeholder" [(ngModel)]="value" + [disabled]="disabled" (ngModelChange)="onChange($event)" [nzDropdownMatchSelectWidth]="false" > diff --git a/web-admin-app/src/app/components/position-select/position-select.component.ts b/web-admin-app/src/app/components/position-select/position-select.component.ts index 79a8a5a..78e28a9 100644 --- a/web-admin-app/src/app/components/position-select/position-select.component.ts +++ b/web-admin-app/src/app/components/position-select/position-select.component.ts @@ -50,6 +50,8 @@ export class PositionSelectComponent { value?: string + disabled = false + ngOnInit(): void { this.api.getBasicPositionTree().subscribe((res) => { this.originData = res.body @@ -73,5 +75,7 @@ export class PositionSelectComponent { this.onTouched = fn } - setDisabledState?(isDisabled: boolean): void {} + setDisabledState?(isDisabled: boolean): void { + this.disabled = isDisabled + } } diff --git a/web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.html b/web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.html new file mode 100644 index 0000000..5cb6774 --- /dev/null +++ b/web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.html @@ -0,0 +1,74 @@ + diff --git a/web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.less b/web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.ts b/web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.ts new file mode 100644 index 0000000..731a42e --- /dev/null +++ b/web-admin-app/src/app/components/repair-fault-form/repair-fault-form.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/repair-form/repair-form.component.html b/web-admin-app/src/app/components/repair-form/repair-form.component.html new file mode 100644 index 0000000..1e1c8bf --- /dev/null +++ b/web-admin-app/src/app/components/repair-form/repair-form.component.html @@ -0,0 +1,84 @@ + diff --git a/web-admin-app/src/app/components/repair-form/repair-form.component.less b/web-admin-app/src/app/components/repair-form/repair-form.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/components/repair-form/repair-form.component.ts b/web-admin-app/src/app/components/repair-form/repair-form.component.ts new file mode 100644 index 0000000..e297d73 --- /dev/null +++ b/web-admin-app/src/app/components/repair-form/repair-form.component.ts @@ -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) + }) + } +} diff --git a/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.html b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.html index b34ef98..b18ae9f 100644 --- a/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.html +++ b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.html @@ -1,4 +1,4 @@ - -
- - - - - - +
+ + + @switch (key) { + @case ('status') { + + {{ BUSINESS_STATUS_MAP.get(data) ?? '-' }} + + } + @case ('_manager') { + {{ data?.userName ?? '-' }} + } + @case ('_warehouse') { + {{ data?.name ?? '-' }} + } + @case ('_position') { + {{ data?.name ?? '-' }} + } + @case ('_supplierVendor') { + {{ data?.name ?? '-' }} + } + @case ('_ownCompany') { + {{ data?.organizationName ?? '-' }} + } + @case ('_useOrganization') { + {{ data?.organizationName ?? '-' }} + } + @case ('_category') { + {{ data?.categoryName ?? '-' }} + } + @default { + {{ data }} + } + } + + - - - - - - - - - - + @for (item of BUSINESS_STATUS_MAP | keyvalue; track $index) { + + } - - - + - + - + - + +
diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component.ts index c056b51..5839160 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-allot/fixed-asset-manage-allot.component.ts @@ -5,85 +5,122 @@ import { AnyObject, TableOption } from 'app/shared/components/server-paginated-t 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 { AssetBusinessAllotFormComponent } from 'app/components' +import { BUSINESS_STATUS_MAP } from 'app/constants' @Component({ selector: 'app-fixed-asset-manage-allot', standalone: true, - imports: [SharedModule], + imports: [SharedModule, AssetBusinessAllotFormComponent], templateUrl: './fixed-asset-manage-allot.component.html', styleUrl: './fixed-asset-manage-allot.component.less', }) export class FixedAssetManageAllotComponent { - 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: true }, - { key: '制单人', title: '制单人', visible: true }, - { key: '业务日期', title: '业务日期', visible: false }, - { 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: 'outWarehouseId', title: '调出仓库', visible: true }, + { key: 'inWarehouseId', 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.getBusinessAllocatePage({ ...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: AssetBusinessAllotFormComponent, + nzWidth: '80vw', + nzWrapClassName: 'modal-lg', + nzData: { + value: data, + preview, + }, + nzOnOk: async (e) => { + const vals = e.getValues() + if (vals) { + const res = await lastValueFrom(this.api.saveBusinessAllocate(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.confirmBusinessAllocate(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.deleteBusinessAllocate(ids)) + this.msg.success(res.desc) + this.table.ref.reload() }, }) - return this.api.getEntityPage(p, q) } } diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.html b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.html index b047e53..df5116d 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.html @@ -1,53 +1,81 @@ - + - -
- - - - - - +
+ + + @switch (key) { + @case ('status') { + + {{ BUSINESS_STATUS_MAP.get(data) ?? '-' }} + + } + @case ('_manager') { + {{ data?.userName ?? '-' }} + } + @case ('_warehouse') { + {{ data?.name ?? '-' }} + } + @case ('_position') { + {{ data?.name ?? '-' }} + } + @case ('_supplierVendor') { + {{ data?.name ?? '-' }} + } + @case ('_ownCompany') { + {{ data?.organizationName ?? '-' }} + } + @case ('_useOrganization') { + {{ data?.organizationName ?? '-' }} + } + @case ('_category') { + {{ data?.categoryName ?? '-' }} + } + @default { + {{ data }} + } + } + + - - - - - + @for (item of BUSINESS_STATUS_MAP | keyvalue; track $index) { + + } - - - + - + - + - + +
diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.ts index f8188e7..567ea39 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-borrow/fixed-asset-manage-borrow.component.ts @@ -5,85 +5,121 @@ import { AnyObject, TableOption } from 'app/shared/components/server-paginated-t 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 { AssetBusinessBorrowFormComponent } from 'app/components' +import { BUSINESS_STATUS_MAP } from 'app/constants' + @Component({ - selector: 'app-fixed-asset-manage-borrow', + selector: 'app-fixed-asset-manage-return', standalone: true, - imports: [SharedModule], + imports: [SharedModule, AssetBusinessBorrowFormComponent], templateUrl: './fixed-asset-manage-borrow.component.html', styleUrl: './fixed-asset-manage-borrow.component.less', }) export class FixedAssetManageBorrowComponent { - 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: 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: '_supplierVendor', title: '借用人', visible: true }, + { key: '_manager', title: '借出时间', visible: true }, + { key: '_manager', title: '预计归还时间', visible: true }, + { key: '_manager', title: '归还时间', visible: true }, - { key: '制单人', title: '制单人', visible: true }, - { key: '业务日期', title: '业务日期', visible: false }, - { key: '选择数据', title: '选择数据', visible: true }, - - { key: '创建时间', 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.getBusinessBorrowPage({ ...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: AssetBusinessBorrowFormComponent, + nzWidth: '80vw', + nzWrapClassName: 'modal-lg', + nzData: { + value: data, + preview, + }, + nzOnOk: async (e) => { + const vals = e.getValues() + if (vals) { + const res = await lastValueFrom(this.api.saveBusinessBorrow(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.confirmBusinessBorrow(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.deleteBusinessBorrow(ids)) + this.msg.success(res.desc) + this.table.ref.reload() }, }) - return this.api.getEntityPage(p, q) } } diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.html b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.html index 7a4e7e2..df5116d 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.html @@ -1,62 +1,81 @@ - + - -
- - - - - - +
+ + + @switch (key) { + @case ('status') { + + {{ BUSINESS_STATUS_MAP.get(data) ?? '-' }} + + } + @case ('_manager') { + {{ data?.userName ?? '-' }} + } + @case ('_warehouse') { + {{ data?.name ?? '-' }} + } + @case ('_position') { + {{ data?.name ?? '-' }} + } + @case ('_supplierVendor') { + {{ data?.name ?? '-' }} + } + @case ('_ownCompany') { + {{ data?.organizationName ?? '-' }} + } + @case ('_useOrganization') { + {{ data?.organizationName ?? '-' }} + } + @case ('_category') { + {{ data?.categoryName ?? '-' }} + } + @default { + {{ data }} + } + } + + - - - - - + @for (item of BUSINESS_STATUS_MAP | keyvalue; track $index) { + + } - - + - + - + - + +
diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.ts index 42969bd..a07cd20 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-distribution/fixed-asset-manage-distribution.component.ts @@ -5,7 +5,12 @@ import { AnyObject, TableOption } from 'app/shared/components/server-paginated-t 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 { AssetBusinessCollectionComponent, AssetBusinessStorageFormComponent } from 'app/components' +import { BUSINESS_STATUS_MAP } from 'app/constants' @Component({ selector: 'app-fixed-asset-manage-distribution', @@ -15,73 +20,106 @@ import { of } from 'rxjs' styleUrl: './fixed-asset-manage-distribution.component.less', }) export class FixedAssetManageDistributionComponent { - 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: '选择数据', 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: '_useUser', 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.getBusinessCollectionPage({ ...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: AssetBusinessCollectionComponent, + nzWidth: '80vw', + nzWrapClassName: 'modal-lg', + nzData: { + value: data, + preview, + }, + nzOnOk: async (e) => { + const vals = e.getValues() + if (vals) { + const res = await lastValueFrom(this.api.saveBusinessCollection(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.confirmBusinessCollection(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.deleteBusinessCollection(ids)) + this.msg.success(res.desc) + this.table.ref.reload() }, }) - return this.api.getEntityPage(p, q) } } diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.html b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.html index fca6453..5c7f00c 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.html @@ -1,13 +1,51 @@ - + - -
- +
+ + + @switch (key) { + @case ('status') { + + {{ BUSINESS_STATUS_MAP.get(data) ?? '-' }} + + } + @case ('_manager') { + {{ data?.userName ?? '-' }} + } + @case ('_warehouse') { + {{ data?.name ?? '-' }} + } + @case ('_position') { + {{ data?.name ?? '-' }} + } + @case ('_supplierVendor') { + {{ data?.name ?? '-' }} + } + @case ('_ownCompany') { + {{ data?.organizationName ?? '-' }} + } + @case ('_useOrganization') { + {{ data?.organizationName ?? '-' }} + } + @case ('_category') { + {{ data?.categoryName ?? '-' }} + } + @default { + {{ data }} + } + } + @@ -17,37 +55,31 @@ - - - - - + @for (item of BUSINESS_STATUS_MAP | keyvalue; track $index) { + + } - - + - + - + - +
diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.ts index 26900f9..facaed3 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-entry/fixed-asset-manage-entry.component.ts @@ -5,7 +5,12 @@ import { AnyObject, TableOption } from 'app/shared/components/server-paginated-t 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 { AssetBusinessStorageFormComponent } from 'app/components' +import { BUSINESS_STATUS_MAP } from 'app/constants' @Component({ selector: 'app-fixed-asset-manage-entry', @@ -15,68 +20,106 @@ import { of } from 'rxjs' styleUrl: './fixed-asset-manage-entry.component.less', }) export class FixedAssetManageEntryComponent { - constructor(private api: ApiService) {} + constructor( + private api: ApiService, + private modal: NzModalService, + private msg: NzMessageService, + ) {} queryForm = new FormGroup({ name: new FormControl(''), - type: 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: true }, + { key: 'id', title: '主键', visible: false }, + { key: 'businessId', title: '业务编号', visible: true, width: '350px' }, + { key: 'name', title: '业务名称', visible: true }, + { key: 'status', title: '办理状态', visible: true }, + { key: '_supplierVendor', title: '供应商', visible: true }, + { key: '_manager', title: '管理人员', visible: true }, + { key: '_position', title: '位置信息', visible: true }, + { key: '_warehouse', 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.getBusinessStoragePage({ ...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: AssetBusinessStorageFormComponent, + nzWidth: '80vw', + nzWrapClassName: 'modal-lg', + nzData: { + value: data, + preview, + }, + nzOnOk: async (e) => { + const vals = e.getValues() + if (vals) { + const res = await lastValueFrom(this.api.saveBusinessStorage(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.confirmBusinessStorage(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.deleteBusinessStorage(ids)) + this.msg.success(res.desc) + this.table.ref.reload() }, }) - return this.api.getEntityPage(p, q) } } diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.html b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.html index a27befb..df5116d 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.html @@ -1,62 +1,81 @@ - + - -
- - - - - - +
+ + + @switch (key) { + @case ('status') { + + {{ BUSINESS_STATUS_MAP.get(data) ?? '-' }} + + } + @case ('_manager') { + {{ data?.userName ?? '-' }} + } + @case ('_warehouse') { + {{ data?.name ?? '-' }} + } + @case ('_position') { + {{ data?.name ?? '-' }} + } + @case ('_supplierVendor') { + {{ data?.name ?? '-' }} + } + @case ('_ownCompany') { + {{ data?.organizationName ?? '-' }} + } + @case ('_useOrganization') { + {{ data?.organizationName ?? '-' }} + } + @case ('_category') { + {{ data?.categoryName ?? '-' }} + } + @default { + {{ data }} + } + } + + - - - - - + @for (item of BUSINESS_STATUS_MAP | keyvalue; track $index) { + + } - - + - + - + - + +
diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.ts index 65fe9ec..a4504be 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-return/fixed-asset-manage-return.component.ts @@ -5,83 +5,121 @@ import { AnyObject, TableOption } from 'app/shared/components/server-paginated-t 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 { AssetBusinessReturnFormComponent } from 'app/components' +import { BUSINESS_STATUS_MAP } from 'app/constants' @Component({ selector: 'app-fixed-asset-manage-return', standalone: true, - imports: [SharedModule], + imports: [SharedModule, AssetBusinessReturnFormComponent], templateUrl: './fixed-asset-manage-return.component.html', styleUrl: './fixed-asset-manage-return.component.less', }) export class FixedAssetManageReturnComponent { - 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: '选择数据', 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.getBusinessReturnInventoryPage({ ...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: AssetBusinessReturnFormComponent, + nzWidth: '80vw', + nzWrapClassName: 'modal-lg', + nzData: { + value: data, + preview, + }, + nzOnOk: async (e) => { + const vals = e.getValues() + if (vals) { + const res = await lastValueFrom(this.api.saveBusinessReturnInventory(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.confirmBusinessReturnInventory(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.deleteBusinessReturnInventory(ids)) + this.msg.success(res.desc) + this.table.ref.reload() }, }) - return this.api.getEntityPage(p, q) } } diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.html b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.html index 6781dd9..df5116d 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.html @@ -1,28 +1,81 @@ - + - -
- - - - - - +
+ + + @switch (key) { + @case ('status') { + + {{ BUSINESS_STATUS_MAP.get(data) ?? '-' }} + + } + @case ('_manager') { + {{ data?.userName ?? '-' }} + } + @case ('_warehouse') { + {{ data?.name ?? '-' }} + } + @case ('_position') { + {{ data?.name ?? '-' }} + } + @case ('_supplierVendor') { + {{ data?.name ?? '-' }} + } + @case ('_ownCompany') { + {{ data?.organizationName ?? '-' }} + } + @case ('_useOrganization') { + {{ data?.organizationName ?? '-' }} + } + @case ('_category') { + {{ data?.categoryName ?? '-' }} + } + @default { + {{ data }} + } + } + + + + + @for (item of BUSINESS_STATUS_MAP | keyvalue; track $index) { + + } + + + - + - + - + +
diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.ts index ec4c127..ae937c2 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-revert/fixed-asset-manage-revert.component.ts @@ -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) } } diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component.html b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component.html index aa62ba7..84d8fc0 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-scrap/fixed-asset-manage-scrap.component.html @@ -15,12 +15,7 @@ - + @@ -29,24 +24,14 @@ - + - + diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.html b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.html index 23e2dd2..df5116d 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.html @@ -1,62 +1,81 @@ - + - -
- - - - - - +
+ + + @switch (key) { + @case ('status') { + + {{ BUSINESS_STATUS_MAP.get(data) ?? '-' }} + + } + @case ('_manager') { + {{ data?.userName ?? '-' }} + } + @case ('_warehouse') { + {{ data?.name ?? '-' }} + } + @case ('_position') { + {{ data?.name ?? '-' }} + } + @case ('_supplierVendor') { + {{ data?.name ?? '-' }} + } + @case ('_ownCompany') { + {{ data?.organizationName ?? '-' }} + } + @case ('_useOrganization') { + {{ data?.organizationName ?? '-' }} + } + @case ('_category') { + {{ data?.categoryName ?? '-' }} + } + @default { + {{ data }} + } + } + + - - - - - - - - - - + @for (item of BUSINESS_STATUS_MAP | keyvalue; track $index) { + + } - - - + - + - + - + +
diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.ts index cd7c6d2..0defb22 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage-transfer/fixed-asset-manage-transfer.component.ts @@ -5,85 +5,123 @@ import { AnyObject, TableOption } from 'app/shared/components/server-paginated-t 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 { AssetBusinessTransferFormComponent } from 'app/components' +import { BUSINESS_STATUS_MAP } from 'app/constants' @Component({ selector: 'app-fixed-asset-manage-transfer', standalone: true, - imports: [SharedModule], + imports: [SharedModule, AssetBusinessTransferFormComponent], templateUrl: './fixed-asset-manage-transfer.component.html', styleUrl: './fixed-asset-manage-transfer.component.less', }) export class FixedAssetManageTransferComponent { - 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: true }, - { key: '转移说明', title: '转移说明', visible: false }, - { key: '制单人', title: '制单人', visible: true }, - { key: '业务日期', title: '业务日期', visible: false }, - { 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: '_useOrganization', title: '调入公司/部门', visible: true }, + { key: '_manager', title: '管理人员', visible: true }, + { key: '_useUser', 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.getBusinessTransferPage({ ...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: AssetBusinessTransferFormComponent, + nzWidth: '80vw', + nzWrapClassName: 'modal-lg', + nzData: { + value: data, + preview, + }, + nzOnOk: async (e) => { + const vals = e.getValues() + if (vals) { + const res = await lastValueFrom(this.api.saveBusinessTransfer(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.confirmBusinessTransfer(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.deleteBusinessTransfer(ids)) + this.msg.success(res.desc) + this.table.ref.reload() }, }) - return this.api.getEntityPage(p, q) } } diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.html b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.html index 834e1f3..5ab974a 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.html @@ -90,8 +90,7 @@ @@ -103,8 +102,7 @@ @@ -118,10 +116,10 @@ - + - +
diff --git a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.ts b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.ts index 5352dc4..83ebba1 100644 --- a/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/manage/fixed-asset-manage/fixed-asset-manage.component.ts @@ -64,12 +64,15 @@ export class FixedAssetManageComponent { { key: '_position', title: '存放位置', visible: true }, ]) .setRowOperate([ - { title: '查看' }, + { + title: '查看', + onClick: (v) => { + this.onCreate(v, true) + }, + }, { title: '修改', onClick: this.onCreate.bind(this) }, { title: '复制', onClick: this.onCopy.bind(this) }, - { title: '折旧记录' }, { title: '二维码', onClick: this.qrcode.bind(this) }, - { title: '操作明细' }, { title: '删除', onClick: this.deleteItem.bind(this) }, ]) } @@ -96,13 +99,16 @@ export class FixedAssetManageComponent { }) } - onCreate(data?: NzSafeAny) { + onCreate(data?: NzSafeAny, preview?: boolean) { this.modal.create({ nzTitle: data ? '编辑资产' : '添加资产', nzContent: AssetFormComponent, nzWidth: '80vw', nzWrapClassName: 'modal-lg', - nzData: data, + nzData: { + value: data, + preview, + }, nzOnOk: async (e) => { const vals = e.getValues() if (vals) { diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.html b/web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.html new file mode 100644 index 0000000..5f4a6bc --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.html @@ -0,0 +1,42 @@ + + + + + + +
+ + + @switch (key) { + @case ('img') { + @if (data) { + + } @else { + - + } + } + @default { + {{ data }} + } + } + + + + + + + + + + + + +
+
diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.less b/web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.ts b/web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.ts new file mode 100644 index 0000000..aa123ce --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/repair/repair-fault/repair-fault.component.ts @@ -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() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.html b/web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.html new file mode 100644 index 0000000..f9dc5af --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.html @@ -0,0 +1,38 @@ + + + + + + +
+ + + @switch (key) { + @default { + {{ data }} + } + } + + + + + + + + + + + + + + + +
+
diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.less b/web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.ts b/web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.ts new file mode 100644 index 0000000..babb69c --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/repair/repair-list/repair-list.component.ts @@ -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() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.html b/web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.html new file mode 100644 index 0000000..a8ebd79 --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.html @@ -0,0 +1,59 @@ + + + + + + +
+ + + @switch (key) { + @default { + {{ data }} + } + } + + + + + + + + + + + + + + + +
+
+ + +
+ + 名称 + + + + + + 配置信息 + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.less b/web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.less new file mode 100644 index 0000000..e69de29 diff --git a/web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.ts b/web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.ts new file mode 100644 index 0000000..a23d88b --- /dev/null +++ b/web-admin-app/src/app/pages/fixed-asset/repair/repair-type/repair-type.component.ts @@ -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() + }, + }) + } +} diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.html b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.html index 5de3863..402da0a 100644 --- a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.html @@ -92,7 +92,6 @@ ('/api/eamAsset/list', data) } + getAssetLog(data: {}) { + return this.http.post('/api/eamAssetLog/list', data) + } copyAsset(num: number, id: number) { return this.http.post(`/api/eamAsset/copyByNum?num=${num}&id=${id}`, null) } @@ -256,6 +259,157 @@ export class ApiService { return this.http.post(`/api/eamStocktakingJob/complete`, ids) } + getBusinessStoragePage(data: {}) { + return this.http.post('/api/eamBusinessStorage/list', data) + } + saveBusinessStorage(data: NzSafeAny) { + if (Utils.isEmpty(data.id)) { + Reflect.deleteProperty(data, 'id') + return this.http.post('/api/eamBusinessStorage/add', data) + } + return this.http.post('/api/eamBusinessStorage/update', data) + } + deleteBusinessStorage(ids: number[]) { + return this.http.post(`/api/eamBusinessStorage/delete`, ids) + } + confirmBusinessStorage(ids: number[]) { + return this.http.post(`/api/eamBusinessStorage/confirm`, ids) + } + + getBusinessCollectionPage(data: {}) { + return this.http.post('/api/eamBusinessCollection/list', data) + } + saveBusinessCollection(data: NzSafeAny) { + if (Utils.isEmpty(data.id)) { + return this.http.post('/api/eamBusinessCollection/add', data) + } + return this.http.post('/api/eamBusinessCollection/update', data) + } + deleteBusinessCollection(ids: number[]) { + return this.http.post(`/api/eamBusinessCollection/delete`, ids) + } + confirmBusinessCollection(ids: number[]) { + return this.http.post(`/api/eamBusinessCollection/confirm`, ids) + } + + getBusinessReturnInventoryPage(data: {}) { + return this.http.post('/api/eamBusinessReturnInventory/list', data) + } + saveBusinessReturnInventory(data: NzSafeAny) { + if (Utils.isEmpty(data.id)) { + return this.http.post('/api/eamBusinessReturnInventory/add', data) + } + return this.http.post('/api/eamBusinessReturnInventory/update', data) + } + deleteBusinessReturnInventory(ids: number[]) { + return this.http.post(`/api/eamBusinessReturnInventory/delete`, ids) + } + confirmBusinessReturnInventory(ids: number[]) { + return this.http.post(`/api/eamBusinessReturnInventory/confirm`, ids) + } + getBusinessBorrowPage(data: {}) { + return this.http.post('/api/eamBusinessBorrow/list', data) + } + saveBusinessBorrow(data: NzSafeAny) { + if (Utils.isEmpty(data.id)) { + return this.http.post('/api/eamBusinessBorrow/add', data) + } + return this.http.post('/api/eamBusinessBorrow/update', data) + } + deleteBusinessBorrow(ids: number[]) { + return this.http.post(`/api/eamBusinessBorrow/delete`, ids) + } + confirmBusinessBorrow(ids: number[]) { + return this.http.post(`/api/eamBusinessBorrow/confirm`, ids) + } + + getBusinessRevertPage(data: {}) { + return this.http.post('/api/eamBusinessReturn/list', data) + } + saveBusinessRevert(data: NzSafeAny) { + if (Utils.isEmpty(data.id)) { + return this.http.post('/api/eamBusinessReturn/add', data) + } + return this.http.post('/api/eamBusinessReturn/update', data) + } + deleteBusinessRevert(ids: number[]) { + return this.http.post(`/api/eamBusinessReturn/delete`, ids) + } + confirmBusinessRevert(ids: number[]) { + return this.http.post(`/api/eamBusinessReturn/confirm`, ids) + } + + getBusinessAllocatePage(data: {}) { + return this.http.post('/api/eamBusinessAllocate/list', data) + } + saveBusinessAllocate(data: NzSafeAny) { + if (Utils.isEmpty(data.id)) { + return this.http.post('/api/eamBusinessAllocate/add', data) + } + return this.http.post('/api/eamBusinessAllocate/update', data) + } + deleteBusinessAllocate(ids: number[]) { + return this.http.post(`/api/eamBusinessAllocate/delete`, ids) + } + confirmBusinessAllocate(ids: number[]) { + return this.http.post(`/api/eamBusinessAllocate/confirm`, ids) + } + + getBusinessTransferPage(data: {}) { + return this.http.post('/api/eamBusinessTransfer/list', data) + } + saveBusinessTransfer(data: NzSafeAny) { + if (Utils.isEmpty(data.id)) { + return this.http.post('/api/eamBusinessTransfer/add', data) + } + return this.http.post('/api/eamBusinessTransfer/update', data) + } + deleteBusinessTransfer(ids: number[]) { + return this.http.post(`/api/eamBusinessTransfer/delete`, ids) + } + confirmBusinessTransfer(ids: number[]) { + return this.http.post(`/api/eamBusinessTransfer/confirm`, ids) + } + + getRepairTypePage(data: {}) { + return this.http.post('/api/eamRepairType/list', data) + } + saveRepairType(data: NzSafeAny) { + if (Utils.isEmpty(data.repairTypeId)) { + return this.http.post('/api/eamRepairType/add', data) + } + return this.http.post('/api/eamRepairType/update', data) + } + deleteRepairType(ids: number[]) { + return this.http.post(`/api/eamRepairType/delete`, ids) + } + + getRepairPage(data: {}) { + return this.http.post('/api/eamRepair/list', data) + } + saveRepair(data: NzSafeAny) { + if (Utils.isEmpty(data.id)) { + return this.http.post('/api/eamRepair/add', data) + } + return this.http.post('/api/eamRepair/update', data) + } + deleteRepair(ids: number[]) { + return this.http.post(`/api/eamRepair/delete`, ids) + } + + getRepairFaultPage(data: {}) { + return this.http.post('/api/eamRepairFault/list', data) + } + saveRepairFault(data: NzSafeAny) { + if (Utils.isEmpty(data.faultId)) { + return this.http.post('/api/eamRepairFault/add', data) + } + return this.http.post('/api/eamRepairFault/update', data) + } + deleteRepairFault(ids: number[]) { + return this.http.post(`/api/eamRepairFault/delete`, ids) + } + /** * * diff --git a/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.html b/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.html index 84fd585..2838e48 100644 --- a/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.html +++ b/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.html @@ -1,4 +1,4 @@ - + @if (label) { {{ label }} } diff --git a/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.less b/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.less index ca2d647..d7f17f1 100644 --- a/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.less +++ b/web-admin-app/src/app/shared/components/server-paginated-table/query-item/query-item.component.less @@ -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%; +// } - } -} \ No newline at end of file +// .ant-select:not(.ant-select-customize-input) .ant-select-selector { +// border: none; +// } + + +// } +// } \ No newline at end of file diff --git a/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.html b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.html index 4191ba8..909ed15 100644 --- a/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.html +++ b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.html @@ -1,10 +1,10 @@
@if (formGroup) { -
+
} @else { -
+
} diff --git a/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.less b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.less index b7c5eca..cb41c7a 100644 --- a/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.less +++ b/web-admin-app/src/app/shared/components/server-paginated-table/server-paginated-table.component.less @@ -28,19 +28,19 @@ } } -.formgroup-container { - ::ng-deep { - nz-form-item { - padding-left: 10px; - background-color: #fff; - border-radius: 4px; - - input { - border-color: transparent !important; - } - } - } -} +// .formgroup-container { +// ::ng-deep { +// nz-form-item { +// padding-left: 10px; +// background-color: #fff; +// border-radius: 4px; + +// input { +// border-color: transparent !important; +// } +// } +// } +// } .server-paginated-table { diff --git a/web-admin-app/src/styles.less b/web-admin-app/src/styles.less index 7b542ac..78a7c1c 100644 --- a/web-admin-app/src/styles.less +++ b/web-admin-app/src/styles.less @@ -67,9 +67,9 @@ body { .ant-modal { top: 5vh !important; - &-body { - padding: 0; - } + // &-body { + // padding: 0; + // } } }