Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-platform
Commits
df9f916a
Commit
df9f916a
authored
Sep 21, 2020
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成库存相关
parent
11bb64cf
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
174 additions
and
64 deletions
+174
-64
index.ts
src/pages/member/memberPrSubmit/schema/index.ts
+6
-1
index.less
src/pages/transaction/stockSellStorage/inventory/index.less
+8
-0
index.tsx
src/pages/transaction/stockSellStorage/inventory/index.tsx
+105
-53
index.tsx
...s/transaction/stockSellStorage/inventory/schema/index.tsx
+55
-10
No files found.
src/pages/member/memberPrSubmit/schema/index.ts
View file @
df9f916a
...
...
@@ -222,9 +222,14 @@ export const auditModalSchema: ISchema = {
'x-component'
:
'textarea'
,
'x-component-props'
:
{
placeholder
:
'在此输入你的内容,最长120个字符,60个汉字'
,
maxLength
:
60
,
rows
:
5
,
},
'x-rules'
:
[
{
limitByte
:
true
,
// 自定义校验规则
maxByte
:
120
,
}
],
},
},
},
...
...
src/pages/transaction/stockSellStorage/inventory/index.less
View file @
df9f916a
.safe {
padding: 4px 11px;
min-height: 32px;
border-radius: 4px;
border: 1px solid #d9d9d9;
cursor: pointer;
}
\ No newline at end of file
src/pages/transaction/stockSellStorage/inventory/index.tsx
View file @
df9f916a
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
;
import
{
history
}
from
'umi'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
Input
,
Card
}
from
'antd'
;
import
{
Input
,
Card
,
Space
,
Modal
}
from
'antd'
;
import
{
SettingOutlined
,
}
from
'@ant-design/icons'
;
import
{
StandardTable
}
from
'god'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
EyePreview
from
'@/components/EyePreview'
;
...
...
@@ -9,47 +12,39 @@ import NiceForm from '@/components/NiceForm';
import
{
createFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
inventorySchema
}
from
'./schema'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
import
{
inventorySchema
,
safetyModalSchema
}
from
'./schema'
;
import
styles
from
'./index.less'
;
const
formActions
=
createFormActions
();
// 模拟请求
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getWarehouseInventoryList
({
itemNo
:
''
,
goodsName
:
''
,
specifications
:
''
,
category
:
''
,
brand
:
''
,
warehouseId
:
''
,
current
:
params
.
current
,
pageSize
:
params
.
pageSize
,
}).
then
(
res
=>
{
resolve
(
res
.
data
);
});
});
};
const
modalFormActions
=
createFormActions
();
const
Inventory
:
React
.
FC
<
{}
>
=
()
=>
{
const
[
current
,
setCurrent
]
=
useState
(
null
);
const
[
modalVisible
,
setModalVisible
]
=
useState
(
false
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
ref
=
useRef
<
any
>
({});
const
handleUpdateSafetyStock
=
record
=>
{
setCurrent
(
record
);
setModalVisible
(
true
);
};
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
align
:
'center'
,
dataIndex
:
'id'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'goodsName'
,
align
:
'center'
,
key
:
'goodsName'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
EyePreview
url=
{
`/repositories/viewRepository?id=${record.
key
}&preview=1`
}
url=
{
`/repositories/viewRepository?id=${record.
id
}&preview=1`
}
>
{
text
}
</
EyePreview
>
...
...
@@ -57,65 +52,98 @@ const Inventory: React.FC<{}> = () => {
},
{
title
:
'规格型号'
,
align
:
'center'
,
dataIndex
:
'specifications'
,
key
:
'specifications
'
,
align
:
'center
'
,
},
{
title
:
'品类'
,
align
:
'center'
,
dataIndex
:
'category'
,
key
:
'category
'
,
align
:
'center
'
,
},
{
title
:
'品牌'
,
align
:
'center'
,
dataIndex
:
'brand'
,
key
:
'brand
'
,
align
:
'center
'
,
},
{
title
:
'单位'
,
align
:
'center'
,
dataIndex
:
'unit'
,
key
:
'unit
'
,
align
:
'center
'
,
},
{
title
:
'价格'
,
dataIndex
:
'costPrice'
,
align
:
'center'
,
dataIndex
:
'price'
,
key
:
'price'
,
render
:
text
=>
`¥
${
text
}
`
},
{
title
:
'仓库'
,
align
:
'center'
,
dataIndex
:
'warehouse'
,
key
:
'warehouse
'
,
align
:
'center
'
,
},
{
title
:
'库存'
,
align
:
'center'
,
dataIndex
:
'inventory'
,
key
:
'inventory
'
,
align
:
'center
'
,
},
{
title
:
'安全库存'
,
title
:
'金额'
,
dataIndex
:
'price'
,
align
:
'center'
,
dataIndex
:
'safeStock'
,
key
:
'safeStock'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
return
(
<
Input
value=
{
record
.
safeInventory
}
allowClear
onChange=
{
e
=>
handleChange
(
e
)
}
></
Input
>
);
render
:
text
=>
`¥
${
text
}
`
},
{
title
:
(
<
Space
>
安全库存
<
SettingOutlined
/>
</
Space
>
),
dataIndex
:
'safeStock'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<
div
className=
{
styles
.
safe
}
onClick=
{
()
=>
handleUpdateSafetyStock
(
record
)
}
>
{
text
}
</
div
>
),
},
];
const
handleChange
=
(
e
:
any
)
=>
{
console
.
log
(
e
);
const
fetchListData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
PublicApi
.
getWarehouseInventoryList
(
params
)
.
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resolve
(
res
.
data
);
}
reject
();
})
.
catch
(()
=>
{
reject
();
});
});
};
// 获取对应仓库
const
fetchInventory
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getWarehouseWarehouseAll
();
return
data
.
map
(
v
=>
({
label
:
v
.
name
,
value
:
v
.
id
}));
};
// 修改安全库存
const
handleSubmit
=
async
values
=>
{
setConfirmLoading
(
true
);
const
res
=
await
PublicApi
.
postWarehouseInventorySafetyUpdate
({
id
:
current
.
id
,
safetyInvoices
:
+
values
.
safetyInvoices
,
});
if
(
res
.
code
===
1000
)
{
setModalVisible
(
false
);
ref
.
current
.
reload
();
}
setConfirmLoading
(
false
);
};
return
(
...
...
@@ -124,8 +152,10 @@ const Inventory: React.FC<{}> = () => {
<
StandardTable
columns=
{
columns
}
currentRef=
{
ref
}
tableProps=
{
{
rowKey
:
'key'
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
tableProps=
{
{
rowKey
:
'id'
,
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchListData
(
params
)
}
controlRender=
{
<
NiceForm
actions=
{
formActions
}
...
...
@@ -134,15 +164,37 @@ const Inventory: React.FC<{}> = () => {
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'
search
'
,
'
goodsName
'
,
FORM_FILTER_PATH
,
);
useAsyncSelect
(
'warehouseId'
,
fetchInventory
);
}
}
schema=
{
inventorySchema
}
/>
}
/>
</
Card
>
<
Modal
title=
"调整安全库存"
visible=
{
modalVisible
}
confirmLoading=
{
confirmLoading
}
onOk=
{
()
=>
modalFormActions
.
submit
()
}
onCancel=
{
()
=>
setModalVisible
(
false
)
}
destroyOnClose
>
<
NiceForm
effects=
{
(
$
,
{
setFieldState
})
=>
{
}
}
initialValues=
{
{
safetyInvoices
:
current
?.
safeStock
,
}
}
actions=
{
modalFormActions
}
schema=
{
safetyModalSchema
}
onSubmit=
{
handleSubmit
}
/>
</
Modal
>
</
PageHeaderWrapper
>
);
};
...
...
src/pages/transaction/stockSellStorage/inventory/schema/index.tsx
View file @
df9f916a
import
{
ISchema
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
PATTERN_MAPS
}
from
'@/constants/regExp'
;
export
const
inventorySchema
:
ISchema
=
{
type
:
'object'
,
...
...
@@ -8,7 +9,7 @@ export const inventorySchema: ISchema = {
type
:
'object'
,
'x-component'
:
'mega-layout'
,
properties
:
{
search
:
{
goodsName
:
{
type
:
'string'
,
'x-component'
:
'Search'
,
'x-mega-props'
:
{},
...
...
@@ -21,38 +22,82 @@ export const inventorySchema: ISchema = {
type
:
'object'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
inline
:
true
,
grid
:
true
,
full
:
true
,
autoRow
:
true
,
columns
:
6
,
},
properties
:
{
itemNo
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'货号'
,
},
},
specifications
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'
请选择
'
,
placeholder
:
'
规格型号
'
,
},
enum
:
[],
},
category
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'
请选择
品类'
,
placeholder
:
'品类'
,
},
enum
:
[],
},
brand
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'
请选择
品牌'
,
placeholder
:
'品牌'
,
},
enum
:
[],
},
warehouse
:
{
warehouse
Id
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'
请选择
仓库'
,
placeholder
:
'仓库'
,
},
enum
:
[],
},
submit
:
{
'x-component'
:
'Submit'
,
'x-mega-props'
:
{
span
:
1
,
},
'x-component-props'
:
{
children
:
'查询'
,
},
},
},
},
},
},
},
};
export
const
safetyModalSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
MEAGLAYOUT
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
labelAlign
:
'top'
,
},
properties
:
{
safetyInvoices
:
{
type
:
'string'
,
title
:
'安全库存'
,
required
:
true
,
'x-component-props'
:
{
placeholder
:
'请输入'
,
},
'x-rules'
:
[
{
pattern
:
PATTERN_MAPS
.
weight
,
message
:
'请输入正数'
,
},
],
},
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment