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服务
location /ws-api/ {
location ^~ /ws-api/ {
proxy_pass http://huaxin-admin-server:8002/ws-api/;
proxy_read_timeout 300s;
proxy_send_timeout 300s;

View File

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

View File

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

View File

@ -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 <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: '产品名称',
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 <Tag color={color}>{label}</Tag>;
},
},
{
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;
},
},
];

View File

@ -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<API.MaterialsInOutEntity>[] => [
export const formSchemas = (isEdit: boolean = false): FormSchema<API.MaterialsInOutEntity>[] => [
{
field: 'inOrOut',
component: 'Select',
@ -267,8 +267,7 @@ export const formSchemas = (isEdit?: boolean): FormSchema<API.MaterialsInOutEnti
return formModel.inOrOut === MaterialsInOutEnum.Out;
},
componentProps: ({ formInstance, formModel }) => ({
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<API.MaterialsInOutEnti
},
componentProps: ({ formInstance, formModel }) => ({
disabled: isEdit,
onBlur(e) {
onChange(e) {
const { quantity, amount } = toRaw(formModel);
if (quantity) {
formInstance?.setFieldsValue({

View File

@ -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',
},