feat: inventory feature optimizied

This commit is contained in:
louis 2024-04-07 08:56:58 +08:00
parent ad26208dfb
commit b7a4dd963e
6 changed files with 89 additions and 64 deletions

View File

@ -69,7 +69,7 @@ http {
} }
# websocket服务 # websocket服务
location /ws-api/ { location ^~ /ws-api/ {
proxy_pass http://huaxin-admin-server:8002/ws-api/; proxy_pass http://huaxin-admin-server:8002/ws-api/;
proxy_read_timeout 300s; proxy_read_timeout 300s;
proxy_send_timeout 300s; proxy_send_timeout 300s;

View File

@ -1789,6 +1789,8 @@ declare namespace API {
type MaterialsInOutEntity = { type MaterialsInOutEntity = {
/** 入库后的库存Id */ /** 入库后的库存Id */
inventoryId: number; inventoryId: number;
/** 入库后的库存信息 */
inventory: MaterialsInventoryEntity;
/** 出入库编号 */ /** 出入库编号 */
inventoryInOutNumber: string; inventoryInOutNumber: string;
/** 公司信息 */ /** 公司信息 */

View File

@ -7,7 +7,7 @@
</div> </div>
<a-form layout="horizontal" :model="state.formInline" @submit.prevent="handleSubmit"> <a-form layout="horizontal" :model="state.formInline" @submit.prevent="handleSubmit">
<a-form-item> <a-form-item>
<a-input v-model:value="state.formInline.username" size="large" placeholder="rootadmin"> <a-input v-model:value="state.formInline.username" size="large" placeholder="admin">
<template #prefix><user-outlined type="user" /></template> <template #prefix><user-outlined type="user" /></template>
</a-input> </a-input>
</a-form-item> </a-form-item>
@ -16,7 +16,7 @@
v-model:value="state.formInline.password" v-model:value="state.formInline.password"
size="large" size="large"
type="password" type="password"
placeholder="a123456" placeholder="huaxin123"
autocomplete="new-password" autocomplete="new-password"
> >
<template #prefix><lock-outlined type="user" /></template> <template #prefix><lock-outlined type="user" /></template>
@ -63,7 +63,7 @@
captcha: '', captcha: '',
formInline: { formInline: {
username: 'admin', username: 'admin',
password: 'a123456', password: 'huaxin123',
verifyCode: '', verifyCode: '',
captchaId: '', captchaId: '',
}, },

View File

@ -13,21 +13,55 @@ export const baseColumns: TableColumnItem[] = [
title: '时间范围', title: '时间范围',
hideInTable: true, hideInTable: true,
dataIndex: 'time', dataIndex: 'time',
formItemProps: { formItemProps: {
component: 'RangePicker', component: 'RangePicker',
componentProps: ({ formInstance, schema, formModel }) => ({}), componentProps: ({ formInstance, schema, formModel }) => ({}),
}, },
}, },
{ {
title: '出入库单号', title: '出入库单号',
width: 100, width: 80,
fixed: 'left', fixed: 'left',
dataIndex: 'inventoryInOutNumber', dataIndex: 'inventoryInOutNumber',
customRender: ({ record }) => { customRender: ({ record }) => {
return record.inventoryInOutNumber || ''; return record.inventoryInOutNumber || '';
}, },
formItemProps: { 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 <Tag color={color}>{label}</Tag>;
},
},
{
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: '产品名称', title: '库存编号',
width: 100, width: 80,
dataIndex: 'product', dataIndex: 'inventoryNumber',
customRender: ({ record }) => { customRender: ({ record }) => {
return record.product?.name || ''; return record.inventory.inventoryNumber || '';
},
formItemProps: {
labelWidth: 80,
}, },
}, },
{ {
title: '单位', title: '单位',
width: 40, 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 <Tag color={color}>{label}</Tag>;
},
},
{ {
title: '时间', title: '时间',
width: 60, width: 60,
@ -133,18 +152,10 @@ export const baseColumns: TableColumnItem[] = [
component: 'MonthPicker', component: 'MonthPicker',
}, },
customRender: ({ record }) => { customRender: ({ record }) => {
return formatToDate(record.time); return formatToDate(record.time, 'YYYY-MM-DD HH:mm:ss');
},
},
{
title: '数量',
hideInSearch: true,
width: 60,
dataIndex: 'quantity',
customRender: ({ record }) => {
return parseFloat(record.quantity) || 0;
}, },
}, },
{ {
title: '单价', title: '单价',
hideInSearch: true, hideInSearch: true,
@ -169,6 +180,11 @@ export const baseColumns: TableColumnItem[] = [
width: 80, width: 80,
dataIndex: 'agent', dataIndex: 'agent',
}, },
{
title: '备注',
width: 80,
dataIndex: 'remark',
},
{ {
title: '领料单号', title: '领料单号',
width: 80, width: 80,
@ -176,9 +192,14 @@ export const baseColumns: TableColumnItem[] = [
}, },
{ {
title: '备注', title: '数量',
width: 80, hideInSearch: true,
dataIndex: 'remark', width: 60,
dataIndex: 'quantity',
fixed: 'right',
customRender: ({ record }) => {
return parseFloat(record.quantity) || 0;
},
}, },
]; ];

View File

@ -6,7 +6,7 @@ import { MaterialsInOutEnum } from '@/enums/materialsInventoryEnum';
import { toRaw } from 'vue'; import { toRaw } from 'vue';
import { calcNumber } from '@/utils/common'; import { calcNumber } from '@/utils/common';
import { formatToDate } from '@/utils/dateUtil'; import { formatToDate } from '@/utils/dateUtil';
export const formSchemas = (isEdit?: boolean): FormSchema<API.MaterialsInOutEntity>[] => [ export const formSchemas = (isEdit: boolean = false): FormSchema<API.MaterialsInOutEntity>[] => [
{ {
field: 'inOrOut', field: 'inOrOut',
component: 'Select', component: 'Select',
@ -267,8 +267,7 @@ export const formSchemas = (isEdit?: boolean): FormSchema<API.MaterialsInOutEnti
return formModel.inOrOut === MaterialsInOutEnum.Out; return formModel.inOrOut === MaterialsInOutEnum.Out;
}, },
componentProps: ({ formInstance, formModel }) => ({ componentProps: ({ formInstance, formModel }) => ({
disabled: isEdit, onChange(e) {
onBlur(e) {
const { quantity, unitPrice } = toRaw(formModel); const { quantity, unitPrice } = toRaw(formModel);
if (quantity) { if (quantity) {
formInstance?.setFieldsValue({ formInstance?.setFieldsValue({
@ -293,7 +292,7 @@ export const formSchemas = (isEdit?: boolean): FormSchema<API.MaterialsInOutEnti
}, },
componentProps: ({ formInstance, formModel }) => ({ componentProps: ({ formInstance, formModel }) => ({
disabled: isEdit, disabled: isEdit,
onBlur(e) { onChange(e) {
const { quantity, amount } = toRaw(formModel); const { quantity, amount } = toRaw(formModel);
if (quantity) { if (quantity) {
formInstance?.setFieldsValue({ formInstance?.setFieldsValue({

View File

@ -11,13 +11,30 @@ const dictStore = useDictStore();
export const baseColumns: TableColumnItem[] = [ export const baseColumns: TableColumnItem[] = [
{ {
title: '库存编号', title: '库存编号',
width: 120, width: 80,
dataIndex: 'inventoryNumber', dataIndex: 'inventoryNumber',
fixed: 'left', fixed: 'left',
customRender: ({ record }) => { customRender: ({ record }) => {
return record?.inventoryNumber || ''; 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: '所属项目', title: '所属项目',
width: 180, width: 180,
@ -34,22 +51,7 @@ export const baseColumns: TableColumnItem[] = [
return record?.product?.company?.name || ''; 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: '产品编号', title: '产品编号',
width: 180, width: 180,
@ -80,6 +82,7 @@ export const baseColumns: TableColumnItem[] = [
title: '入库库存单价', title: '入库库存单价',
hideInSearch: true, hideInSearch: true,
width: 80, width: 80,
fixed: 'right',
dataIndex: 'unitPrice', dataIndex: 'unitPrice',
customRender: ({ record }) => { customRender: ({ record }) => {
return parseFloat(record.unitPrice) || 0; return parseFloat(record.unitPrice) || 0;
@ -88,7 +91,7 @@ export const baseColumns: TableColumnItem[] = [
{ {
title: '库存数量', title: '库存数量',
hideInSearch: true, hideInSearch: true,
fixed:'right', fixed: 'right',
width: 80, width: 80,
dataIndex: 'quantity', dataIndex: 'quantity',
}, },