From b7a4dd963e8292f2008a36c4ac06fa7925034701 Mon Sep 17 00:00:00 2001 From: louis <869322496@qq.com> Date: Sun, 7 Apr 2024 08:56:58 +0800 Subject: [PATCH] feat: inventory feature optimizied --- nginx.conf | 2 +- src/api/backend/api/typings.d.ts | 2 + src/views/login/index.vue | 6 +- .../materials-inventory/in-out/columns.tsx | 97 +++++++++++-------- .../materials-inventory/in-out/formSchemas.ts | 7 +- .../inventory-check/columns.tsx | 39 ++++---- 6 files changed, 89 insertions(+), 64 deletions(-) diff --git a/nginx.conf b/nginx.conf index 65202de..1244a76 100644 --- a/nginx.conf +++ b/nginx.conf @@ -69,7 +69,7 @@ http { } # websocket服务 - location /ws-api/ { + location ^~ /ws-api/ { proxy_pass http://huaxin-admin-server:8002/ws-api/; proxy_read_timeout 300s; proxy_send_timeout 300s; diff --git a/src/api/backend/api/typings.d.ts b/src/api/backend/api/typings.d.ts index e521a20..039d843 100644 --- a/src/api/backend/api/typings.d.ts +++ b/src/api/backend/api/typings.d.ts @@ -1789,6 +1789,8 @@ declare namespace API { type MaterialsInOutEntity = { /** 入库后的库存Id */ inventoryId: number; + /** 入库后的库存信息 */ + inventory: MaterialsInventoryEntity; /** 出入库编号 */ inventoryInOutNumber: string; /** 公司信息 */ diff --git a/src/views/login/index.vue b/src/views/login/index.vue index a2a750a..d75c1e5 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -7,7 +7,7 @@ - + @@ -16,7 +16,7 @@ v-model:value="state.formInline.password" size="large" type="password" - placeholder="a123456" + placeholder="huaxin123" autocomplete="new-password" > @@ -63,7 +63,7 @@ captcha: '', formInline: { username: 'admin', - password: 'a123456', + password: 'huaxin123', verifyCode: '', captchaId: '', }, diff --git a/src/views/materials-inventory/in-out/columns.tsx b/src/views/materials-inventory/in-out/columns.tsx index 1181199..58dc05a 100644 --- a/src/views/materials-inventory/in-out/columns.tsx +++ b/src/views/materials-inventory/in-out/columns.tsx @@ -13,21 +13,55 @@ export const baseColumns: TableColumnItem[] = [ title: '时间范围', hideInTable: true, dataIndex: 'time', - formItemProps: { + formItemProps: { component: 'RangePicker', componentProps: ({ formInstance, schema, formModel }) => ({}), }, }, + { title: '出入库单号', - width: 100, + width: 80, fixed: 'left', dataIndex: 'inventoryInOutNumber', customRender: ({ record }) => { return record.inventoryInOutNumber || ''; }, formItemProps: { - labelWidth: 120, + labelWidth: 80, + }, + }, + { + title: '入库/出库', + width: 60, + dataIndex: 'inOrOut', + formItemProps: { + component: 'Select', + componentProps: { + options: Object.values(MaterialsInOutEnum) + .filter((value) => typeof value === 'number') + .map((item) => formatStatus(item as MaterialsInOutEnum)), + }, + }, + customRender: ({ record }) => { + const { color, label } = formatStatus(record.inOrOut); + return {label}; + }, + }, + { + title: '产品名称', + width: 100, + dataIndex: 'product', + customRender: ({ record }) => { + return record.product?.name || ''; + }, + }, + { + title: '产品规格', + width: 100, + dataIndex: 'product', + customRender: ({ record }) => { + return record.product?.productSpecification || ''; }, }, { @@ -88,14 +122,16 @@ export const baseColumns: TableColumnItem[] = [ }, }, { - title: '产品名称', - width: 100, - dataIndex: 'product', + title: '库存编号', + width: 80, + dataIndex: 'inventoryNumber', customRender: ({ record }) => { - return record.product?.name || ''; + return record.inventory.inventoryNumber || ''; + }, + formItemProps: { + labelWidth: 80, }, }, - { title: '单位', width: 40, @@ -106,23 +142,6 @@ export const baseColumns: TableColumnItem[] = [ }, }, - { - title: '入库/出库', - width: 60, - dataIndex: 'inOrOut', - formItemProps: { - component: 'Select', - componentProps: { - options: Object.values(MaterialsInOutEnum) - .filter((value) => typeof value === 'number') - .map((item) => formatStatus(item as MaterialsInOutEnum)), - }, - }, - customRender: ({ record }) => { - const { color, label } = formatStatus(record.inOrOut); - return {label}; - }, - }, { title: '时间', width: 60, @@ -133,18 +152,10 @@ export const baseColumns: TableColumnItem[] = [ component: 'MonthPicker', }, customRender: ({ record }) => { - return formatToDate(record.time); - }, - }, - { - title: '数量', - hideInSearch: true, - width: 60, - dataIndex: 'quantity', - customRender: ({ record }) => { - return parseFloat(record.quantity) || 0; + return formatToDate(record.time, 'YYYY-MM-DD HH:mm:ss'); }, }, + { title: '单价', hideInSearch: true, @@ -169,6 +180,11 @@ export const baseColumns: TableColumnItem[] = [ width: 80, dataIndex: 'agent', }, + { + title: '备注', + width: 80, + dataIndex: 'remark', + }, { title: '领料单号', width: 80, @@ -176,9 +192,14 @@ export const baseColumns: TableColumnItem[] = [ }, { - title: '备注', - width: 80, - dataIndex: 'remark', + title: '数量', + hideInSearch: true, + width: 60, + dataIndex: 'quantity', + fixed: 'right', + customRender: ({ record }) => { + return parseFloat(record.quantity) || 0; + }, }, ]; diff --git a/src/views/materials-inventory/in-out/formSchemas.ts b/src/views/materials-inventory/in-out/formSchemas.ts index c63eb46..f4c3d8c 100644 --- a/src/views/materials-inventory/in-out/formSchemas.ts +++ b/src/views/materials-inventory/in-out/formSchemas.ts @@ -6,7 +6,7 @@ import { MaterialsInOutEnum } from '@/enums/materialsInventoryEnum'; import { toRaw } from 'vue'; import { calcNumber } from '@/utils/common'; import { formatToDate } from '@/utils/dateUtil'; -export const formSchemas = (isEdit?: boolean): FormSchema[] => [ +export const formSchemas = (isEdit: boolean = false): FormSchema[] => [ { field: 'inOrOut', component: 'Select', @@ -267,8 +267,7 @@ export const formSchemas = (isEdit?: boolean): FormSchema ({ - disabled: isEdit, - onBlur(e) { + onChange(e) { const { quantity, unitPrice } = toRaw(formModel); if (quantity) { formInstance?.setFieldsValue({ @@ -293,7 +292,7 @@ export const formSchemas = (isEdit?: boolean): FormSchema ({ disabled: isEdit, - onBlur(e) { + onChange(e) { const { quantity, amount } = toRaw(formModel); if (quantity) { formInstance?.setFieldsValue({ diff --git a/src/views/materials-inventory/inventory-check/columns.tsx b/src/views/materials-inventory/inventory-check/columns.tsx index 562ae74..648e29a 100644 --- a/src/views/materials-inventory/inventory-check/columns.tsx +++ b/src/views/materials-inventory/inventory-check/columns.tsx @@ -11,13 +11,30 @@ const dictStore = useDictStore(); export const baseColumns: TableColumnItem[] = [ { title: '库存编号', - width: 120, + width: 80, dataIndex: 'inventoryNumber', fixed: 'left', customRender: ({ record }) => { return record?.inventoryNumber || ''; }, }, + { + title: '产品名称', + fixed: 'left', + width: 180, + dataIndex: 'product', + customRender: ({ record }) => { + return record?.product?.name || ''; + }, + }, + { + title: '产品规格', + width: 180, + dataIndex: 'productSpecification', + customRender: ({ record }) => { + return record?.product?.productSpecification || ''; + }, + }, { title: '所属项目', width: 180, @@ -34,22 +51,7 @@ export const baseColumns: TableColumnItem[] = [ return record?.product?.company?.name || ''; }, }, - { - title: '产品名称', - width: 180, - dataIndex: 'product', - customRender: ({ record }) => { - return record?.product?.name || ''; - }, - }, - { - title: '产品规格', - width: 180, - dataIndex: 'productSpecification', - customRender: ({ record }) => { - return record?.product?.productSpecification || ''; - }, - }, + { title: '产品编号', width: 180, @@ -80,6 +82,7 @@ export const baseColumns: TableColumnItem[] = [ title: '入库库存单价', hideInSearch: true, width: 80, + fixed: 'right', dataIndex: 'unitPrice', customRender: ({ record }) => { return parseFloat(record.unitPrice) || 0; @@ -88,7 +91,7 @@ export const baseColumns: TableColumnItem[] = [ { title: '库存数量', hideInSearch: true, - fixed:'right', + fixed: 'right', width: 80, dataIndex: 'quantity', },