From 265a6e2c8b6e99cbe8dcac31952059e473f5e303 Mon Sep 17 00:00:00 2001 From: kely Date: Sun, 19 May 2024 21:09:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../select-user-by-org.component.ts | 3 +- .../pages/dashboard/dashboard.component.html | 6 +- .../pages/dashboard/dashboard.component.ts | 2 + .../stockaking-job.component.ts | 8 +- .../stockaking-plan.component.ts | 14 +-- .../stocktaking-detail.component.html | 57 ++++++++++ .../stocktaking-detail.component.ts | 102 +++++++++++++++++- web-admin-app/src/app/services/api.service.ts | 5 +- 8 files changed, 176 insertions(+), 21 deletions(-) diff --git a/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.ts b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.ts index 1fa21f1..b89c777 100644 --- a/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.ts +++ b/web-admin-app/src/app/components/select-user-by-org/select-user-by-org.component.ts @@ -90,7 +90,8 @@ export class SelectUserByOrgComponent implements ControlValueAccessor, OnInit { onOrgSelectedChange(v?: NzSafeAny, uid?: number) { this.api .getUserPage({ - tree: Boolean(v?.organizationId), + // tree: Boolean(v?.organizationId), + tree: false, pageSize: MAX_PAGE_SIZE, pageNum: 1, userId: uid, diff --git a/web-admin-app/src/app/pages/dashboard/dashboard.component.html b/web-admin-app/src/app/pages/dashboard/dashboard.component.html index 59e9b32..e6200bf 100644 --- a/web-admin-app/src/app/pages/dashboard/dashboard.component.html +++ b/web-admin-app/src/app/pages/dashboard/dashboard.component.html @@ -21,7 +21,7 @@ - {{ data.assetTotal.change }} + {{ Math.abs(data.assetTotal.change) }} 今日变化 @@ -49,7 +49,7 @@ - {{ data.borrowWarning.change }} + {{ Math.abs(data.borrowWarning.change) }} 今日变化 @@ -77,7 +77,7 @@ - {{ data.maintenanceWarning.change }} + {{ Math.abs(data.maintenanceWarning.change) }} 今日变化 diff --git a/web-admin-app/src/app/pages/dashboard/dashboard.component.ts b/web-admin-app/src/app/pages/dashboard/dashboard.component.ts index 627ebfd..8abf0f3 100644 --- a/web-admin-app/src/app/pages/dashboard/dashboard.component.ts +++ b/web-admin-app/src/app/pages/dashboard/dashboard.component.ts @@ -126,6 +126,8 @@ export class DashboardComponent implements OnInit, AfterViewInit { quickAction: NzSafeAny[] = [] + Math = Math + ngOnInit(): void { this.api.getHomeData().subscribe((res) => { this.data = res.body diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.ts b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.ts index 72664c6..e0be2c5 100644 --- a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-job/stockaking-job.component.ts @@ -161,10 +161,10 @@ export class StockakingJobComponent { stocktakingUserId: data._stocktakingUser?.userId ? [data._stocktakingUser?.userId] : [], head: data._head?.userId ? [data._head?.userId] : [], useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], - categoryId: data._category?.categoryId + '', - positionId: data._position?.positionId + '', - ownCompanyId: data._ownCompany?.organizationId + '', - useOrganizationId: data._useOrganization?.organizationId + '', + categoryId: data._category?.categoryId, + positionId: data._position?.positionId, + ownCompanyId: data._ownCompany?.organizationId, + useOrganizationId: data._useOrganization?.organizationId, warehouseId: data._warehouse?.warehouseId, }) } diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.ts b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.ts index 67bcdee..f585977 100644 --- a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stockaking-plan/stockaking-plan.component.ts @@ -54,7 +54,7 @@ export class StockakingPlanComponent { initCreateForm() { this.createForm = this.fb.group({ - stocktakingJobId: [], + stocktakingPlanId: [], name: ['', [FormValidators.required('请输入')]], notes: ['', []], stocktakingUserId: [[], []], @@ -83,7 +83,7 @@ export class StockakingPlanComponent { this.table .setConfig({ selectable: true, - rowKey: 'stocktakingJobId', + rowKey: 'stocktakingPlanId', }) .setColumn([ { key: 'name', title: '名称' }, @@ -158,10 +158,10 @@ export class StockakingPlanComponent { stocktakingUserId: data._stocktakingUser?.userId ? [data._stocktakingUser?.userId] : [], head: data._head?.userId ? [data._head?.userId] : [], useUserId: data._useUser?.userId ? [data._useUser?.userId] : [], - categoryId: data._category?.categoryId + '', - positionId: data._position?.positionId + '', - ownCompanyId: data._ownCompany?.organizationId + '', - useOrganizationId: data._useOrganization?.organizationId + '', + categoryId: data._category?.categoryId, + positionId: data._position?.positionId, + ownCompanyId: data._ownCompany?.organizationId, + useOrganizationId: data._useOrganization?.organizationId, warehouseId: data._warehouse?.warehouseId, status: data.status === 1, }) @@ -216,7 +216,7 @@ export class StockakingPlanComponent { nzTitle: '警告', nzContent: '是否要删除该盘点任务?', nzOnOk: async () => { - const res = await lastValueFrom(this.api.deleteStocktakingPlan([item.stocktakingJobId])) + const res = await lastValueFrom(this.api.deleteStocktakingPlan([item.stocktakingPlanId])) this.msg.success(res.desc) this.table.ref.reload() }, diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stocktaking-detail/stocktaking-detail.component.html b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stocktaking-detail/stocktaking-detail.component.html index 9a51181..2878937 100644 --- a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stocktaking-detail/stocktaking-detail.component.html +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stocktaking-detail/stocktaking-detail.component.html @@ -95,3 +95,60 @@ + + +
+ + 盘点状态 + + + @for (item of STOCKTAKING_JOB_STATUS_MAP | keyvalue; track $index) { + + } + + + + + 图片 + + +
+ +
+ +
+
+ + 附件 + + + + @if (startForm.get('attachment')?.value) { +
+ + {{ startForm.get('attachment')?.value }} + +
+ } +
+
+ + 盘点说明 + + + + +
+
+ + + + diff --git a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stocktaking-detail/stocktaking-detail.component.ts b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stocktaking-detail/stocktaking-detail.component.ts index 3f98a65..5d30d74 100644 --- a/web-admin-app/src/app/pages/fixed-asset/stocktaking/stocktaking-detail/stocktaking-detail.component.ts +++ b/web-admin-app/src/app/pages/fixed-asset/stocktaking/stocktaking-detail/stocktaking-detail.component.ts @@ -20,7 +20,7 @@ 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 { FormValidators, 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' @@ -44,6 +44,8 @@ export class StocktakingDetailComponent { private route: ActivatedRoute, ) {} + @ViewChild('startTpl') startTpl!: TemplateRef<{}> + originData: NzSafeAny[] = [] loading = false @@ -56,6 +58,12 @@ export class StocktakingDetailComponent { table = new TableOption(this.fetchData.bind(this)) + uploadImgLoading = false + + uploadLoading = false + + iconPreview = '' + queryForm = new FormGroup({ name: new FormControl(), model: new FormControl(), @@ -67,10 +75,48 @@ export class StocktakingDetailComponent { manufacturersVendorId: new FormControl(), }) - ngOnInit(): void { - this.api.getBasicSupplierVendorPage({ pageSize: MAX_PAGE_SIZE, pageNum: 1 }).subscribe((res) => { - this.originData = res.body.rows + onImgChange(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.startForm.get('img')?.setValue(res.body.fileName) + }) + } + + 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.startForm.get('attachment')?.setValue(res.body.fileName) }) + } + + ngOnInit(): void { + this.api + .getBasicSupplierVendorPage({ + pageSize: MAX_PAGE_SIZE, + pageNum: 1, + }) + .subscribe((res) => { + this.originData = res.body.rows + }) this.table .setConfig({ selectable: true, @@ -86,10 +132,22 @@ export class StocktakingDetailComponent { // { key: '_useOrganization', title: '使用组织', visible: true }, // { key: '_position', title: '存放位置', visible: true }, ]) + .setRowOperate([ + { + title: '开始盘点', + onClick: this.onStart.bind(this), + }, + ]) } fetchData(p: {}, q: AnyObject) { - return this.api.getStocktakingJobDetailPage({ ...p, ...q }).pipe() + return this.api + .getStocktakingJobDetailPage({ + ...p, + ...q, + stocktakingJobId: Number(this.route.snapshot.paramMap.get('id')), + }) + .pipe() } add(data?: NzSafeAny) { @@ -122,6 +180,40 @@ export class StocktakingDetailComponent { }) } + startForm = new FormGroup({ + status: new FormControl(null, [FormValidators.required('请选择盘点状态')]), + img: new FormControl(null, []), + attachment: new FormControl(null, []), + notes: new FormControl(null, []), + }) + + onStart(data: NzSafeAny) { + this.modal.create({ + nzTitle: '开始盘点', + nzContent: this.startTpl, + nzOnOk: async () => { + if (FormValidators.validateFormGroup(this.startForm)) { + const res = await lastValueFrom( + this.api.startStocktakingJob({ + ...this.startForm.value, + stocktakingJobId: Number(this.route.snapshot.paramMap.get('id')), + assetId: data._asset.assetId, + id: data.id, + }), + ) + this.msg.success(res.desc) + this.table.ref.reload() + this.startForm.reset() + return true + } + return false + }, + nzOnCancel: () => { + this.startForm.reset() + }, + }) + } + deleteItem() { this.modal.confirm({ nzTitle: '警告', diff --git a/web-admin-app/src/app/services/api.service.ts b/web-admin-app/src/app/services/api.service.ts index eca31dc..25991f5 100644 --- a/web-admin-app/src/app/services/api.service.ts +++ b/web-admin-app/src/app/services/api.service.ts @@ -317,7 +317,7 @@ export class ApiService { return this.http.post('/api/eamStocktakingPlan/list', data) } saveStocktakingPlan(data: NzSafeAny) { - if (Utils.isEmpty(data.stocktakingJobId)) { + if (Utils.isEmpty(data.stocktakingPlanId)) { return this.http.post('/api/eamStocktakingPlan/add', data) } return this.http.post('/api/eamStocktakingPlan/update', data) @@ -343,6 +343,9 @@ export class ApiService { deleteStocktakingDetail(ids: number[]) { return this.http.post(`/api/eamStocktakingDetails/delete`, ids) } + startStocktakingJob(data: {}) { + return this.http.post(`/api/eamStocktakingDetails/update`, data) + } getStocktakingJobPage(data: {}) { return this.http.post('/api/eamStocktakingJob/list', data)