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
黄庭坚
jinfa-platform
Commits
7792d18d
Commit
7792d18d
authored
Sep 02, 2020
by
LeeJiancong
Browse files
Options
Browse Files
Download
Plain Diff
'新增需求单回显'
parents
b875ac75
668eafb4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
587 additions
and
92 deletions
+587
-92
tranactionRoute.ts
config/routes/tranactionRoute.ts
+7
-0
index.js
scripts/services/index.js
+4
-0
CustomSlider.tsx
src/components/NiceForm/components/CustomSlider.tsx
+2
-2
index.less
src/components/NiceForm/index.less
+4
-2
global.d.ts~668eafb4417a6b5f478f8f12a3735f4ec118a5f6
...nfig/global.d.ts~668eafb4417a6b5f478f8f12a3735f4ec118a5f6
+60
-0
useLeavePageWarn.ts
src/hooks/useLeavePageWarn.ts
+10
-0
menu.ts
src/locales/zh-CN/menu.ts
+1
-0
index.tsx
src/pages/classAndProperty/propertyValue/index.tsx
+1
-0
index.tsx
src/pages/commodity/goods/index.tsx
+1
-0
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+10
-13
otherForm.tsx
src/pages/commodity/products/addProductsItem/otherForm.tsx
+7
-1
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+0
-0
productImageForm.tsx
...s/commodity/products/addProductsItem/productImageForm.tsx
+1
-3
selectGoodsForm.tsx
...es/commodity/products/addProductsItem/selectGoodsForm.tsx
+1
-0
index.tsx
src/pages/commodity/products/index.tsx
+0
-39
viewProducts.tsx
src/pages/commodity/products/viewProducts.tsx
+1
-1
adjustRepository.tsx
src/pages/repositories/adjustRepository.tsx
+30
-6
PositionSetting.tsx
src/pages/repositories/components/PositionSetting.tsx
+10
-3
index.tsx
src/pages/repositories/schema/index.tsx
+30
-17
index.ts
...transaction/purchaseOrder/readyAddOrder/constant/index.ts
+57
-0
detail.tsx
src/pages/transaction/purchaseOrder/readyAddOrder/detail.tsx
+93
-0
index.ts
.../transaction/purchaseOrder/readyAddOrder/effects/index.ts
+9
-0
index.tsx
src/pages/transaction/purchaseOrder/readyAddOrder/index.tsx
+2
-1
useDetailOrder.tsx
...tion/purchaseOrder/readyAddOrder/model/useDetailOrder.tsx
+44
-0
index.ts
...s/transaction/purchaseOrder/readyAddOrder/schema/index.ts
+169
-1
index.tsx
src/utils/index.tsx
+33
-3
No files found.
config/routes/tranactionRoute.ts
View file @
7792d18d
...
...
@@ -103,6 +103,13 @@ const TranactionRoute = {
key
:
'readyAddOrder'
,
component
:
'@/pages/transaction/purchaseOrder/readyAddOrder'
},
{
path
:
'/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/orderDetail'
,
name
:
'orderDetail'
,
key
:
'orderDetail'
,
hideInMenu
:
true
,
component
:
'@/pages/transaction/purchaseOrder/readyAddOrder/detail'
},
]
}
]
...
...
scripts/services/index.js
View file @
7792d18d
...
...
@@ -41,6 +41,10 @@ const serviceConfig = {
},
method
:
'get'
},
orderMode
:
{
url
:
'/order/rule/configuration/all'
,
method
:
'get'
}
// site: {
// url: '/manage/paas/site/all',
// method: 'get',
...
...
src/components/NiceForm/components/CustomSlider.tsx
View file @
7792d18d
import
React
from
'react'
import
{
Slider
,
Input
,
Space
}
from
'antd'
import
{
Slider
,
Input
,
Space
,
InputNumber
}
from
'antd'
const
CustomSlider
=
(
props
)
=>
{
const
value
=
props
.
value
||
0
...
...
@@ -16,7 +16,7 @@ const CustomSlider = (props) => {
{
isNumber
?
<
div
>
<
Input
type=
'number'
className=
'underline_input'
max=
{
max
}
value=
{
props
.
value
}
onChange=
{
e
=>
props
.
mutators
.
change
(
e
.
target
.
v
alue
)
}
/>
<
Input
Number
className=
'underline_input'
min=
{
0
}
max=
{
max
||
0
}
value=
{
props
.
value
}
onChange=
{
fieldValue
=>
props
.
mutators
.
change
(
fieldV
alue
)
}
/>
</
div
>
:
<
Space
>
...
...
src/components/NiceForm/index.less
View file @
7792d18d
...
...
@@ -10,15 +10,17 @@
}
.underline_input {
max-
width: 200px;
width: 200px;
background: none;
border: none;
outline: none;
font-size: 32px;
border-bottom: 1px solid #DFE1E6;
padding: 8px 19px;
display: block;
input {
text-align: center;
display: inline-block;
}
&:focus{
box-shadow: none;
border-bottom: 1px solid #DFE1E6;
...
...
src/global/config/global.d.ts~668eafb4417a6b5f478f8f12a3735f4ec118a5f6
0 → 100644
View file @
7792d18d
export interface MemberType {
id: number;
typeName: string;
}
export interface BusinessType {
id: number;
typeName: string;
}
export interface UseType {
memberType: MemberType[];
businessType: BusinessType[];
}
export interface UserRegister {
useType: UseType;
}
export interface ShopInfo {
id: number;
name: string;
type: number;
environment: number;
logoUrl: string;
describe?: any;
state: number;
url: string;
}
export interface OrderMode {
value: number;
label: string;
platformType: number;
}
export interface Web {
shopInfo: ShopInfo[];
orderMode: OrderMode[];
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Global {
siteId: number;
siteUrl: string;
logo: string;
countryList: CountryList[];
}
export interface RootObject {
userRegister: UserRegister;
web: Web;
global: Global;
}
\ No newline at end of file
src/hooks/useLeavePageWarn.ts
0 → 100644
View file @
7792d18d
// 离开页面时,如果有编辑过表单,需要进行提示
import
{
useState
}
from
'react'
export
const
useLeavePageWarn
=
(
initState
=
false
)
=>
{
const
[
isEditForm
,
setIsEditForm
]
=
useState
(
initState
)
return
[
isEditForm
,
setIsEditForm
]
}
\ No newline at end of file
src/locales/zh-CN/menu.ts
View file @
7792d18d
...
...
@@ -107,6 +107,7 @@ export default {
'menu.tranactionAbility.purchaseOrder'
:
'采购订单'
,
'menu.tranactionAbility.purchaseOrder.purchaseOrderSearch'
:
'订单查询'
,
'menu.tranactionAbility.purchaseOrder.readyAddOrder'
:
'待新增订单'
,
'menu.tranactionAbility.purchaseOrder.orderDetail'
:
'订单详情'
,
//物流能力
'menu.logisticsAbility'
:
'物流'
,
...
...
src/pages/classAndProperty/propertyValue/index.tsx
View file @
7792d18d
...
...
@@ -23,6 +23,7 @@ import { GetProductCustomerGetCustomerAttributeResponse } from '@/services';
const
treeActions
=
createTreeActions
()
const
fetchAttributeTreeData
=
async
(
params
?)
=>
{
// @ts-ignore
const
res
=
await
PublicApi
.
getProductCustomerGetCustomerAttributeTree
({
filterInput
:
true
})
return
res
}
...
...
src/pages/commodity/goods/index.tsx
View file @
7792d18d
...
...
@@ -303,6 +303,7 @@ const Goods: React.FC<{}> = () => {
ref
.
current
.
reload
()
})
},
okType
:
'danger'
,
onCancel
()
{
console
.
log
(
'Cancel'
);
},
...
...
src/pages/commodity/products/addProducts.tsx
View file @
7792d18d
...
...
@@ -31,6 +31,7 @@ const AddProducts: React.FC<{}> = (props) => {
const
{
ProductStore
}
=
store
const
{
productSelectAttribute
,
priceAttributeParams
,
productAttributeAndImageParams
,
areaOption
,
productDescription
,
...
...
@@ -131,12 +132,11 @@ const AddProducts: React.FC<{}> = (props) => {
if
(
productAttributeAndImageParams
.
length
>
0
){
productAttributeAndImageParams
.
map
(
_item
=>
{
console
.
log
(
_item
,
'_item'
)
if
(
_item
.
attributeAndValueList
.
length
>
0
){
_item
.
goods
=
{
id
:
_item
.
goodsId
}
_item
.
goods
=
{
id
:
_item
.
goodsId
}
// id为0表示无货品
delete
_item
.
goodsId
if
(
_item
.
attributeAndValueList
.
length
>
0
){
_item
.
attributeAndValueList
.
map
(
__item
=>
{
delete
__item
.
customerAttributeName
// __item.customerAttributeValueId = __item.id
// **** 新字段结构变更
__item
.
customerAttribute
=
{
id
:
__item
.
customerAttributeId
}
__item
.
customerAttributeValue
=
{
id
:
__item
.
id
,
value
:
__item
.
value
}
...
...
@@ -145,8 +145,6 @@ const AddProducts: React.FC<{}> = (props) => {
delete
__item
.
customerAttributeId
})
}
// _item.attributeAndValueList = _item.goodsCustomerAttributeList
// delete _item.goodsCustomerAttributeList
if
(
_item
.
commodityPic
.
length
>
0
){
// 编辑情况下兼顾手动添加图片列表属性
_item
.
commodityPic
=
_item
.
commodityPic
.
map
(
__item
=>
__item
?.
response
?.
data
||
__item
?.
url
)
...
...
@@ -157,31 +155,30 @@ const AddProducts: React.FC<{}> = (props) => {
throw
new
Error
(
'每项请至少上传一张商品图片!'
)
}
})
}
else
{
}
else
{
throw
new
Error
(
'每项请至少上传一张商品图片!'
)
}
}
catch
(
e
){
return
e
}
_params
.
unitPriceAndPicList
=
productAttributeAndImageParams
}
else
{
}
else
{
// 编辑 没有点击商品图片
_params
.
unitPriceAndPicList
=
productInfoByEdit
.
unitPriceAndPicList
}
if
(
clickTabIndex
.
indexOf
(
"3"
)
===-
1
)
if
(
clickTabIndex
.
indexOf
(
"3"
)
===-
1
)
// 商品属性
_params
.
commodityAttributeList
=
productInfoByEdit
.
commodityAttributeList
if
(
clickTabIndex
.
indexOf
(
"4"
)
===-
1
){
if
(
clickTabIndex
.
indexOf
(
"4"
)
===-
1
){
// 价格属性
_params
.
unitId
=
productInfoByEdit
.
unitId
_params
.
unitName
=
productInfoByEdit
.
unitName
_params
.
minOrder
=
productInfoByEdit
.
minOrder
_params
.
priceType
=
productInfoByEdit
.
priceType
_params
.
isMemberPrice
=
productInfoByEdit
.
isMemberPrice
}
if
(
clickTabIndex
.
indexOf
(
"6"
)
===-
1
)
if
(
clickTabIndex
.
indexOf
(
"6"
)
===-
1
)
// 商品描述
_params
.
commodityRemark
=
productInfoByEdit
.
commodityRemark
if
(
clickTabIndex
.
indexOf
(
"7"
)
===-
1
)
if
(
clickTabIndex
.
indexOf
(
"7"
)
===-
1
)
// 物流
_params
.
logistics
=
productInfoByEdit
.
logistics
if
(
clickTabIndex
.
indexOf
(
"8"
)
===-
1
){
if
(
clickTabIndex
.
indexOf
(
"8"
)
===-
1
){
// 其他
_params
.
isInvoice
=
productInfoByEdit
.
isInvoice
_params
.
marks
=
productInfoByEdit
.
marks
_params
.
packing
=
productInfoByEdit
.
packing
...
...
src/pages/commodity/products/addProductsItem/otherForm.tsx
View file @
7792d18d
...
...
@@ -40,11 +40,17 @@ const OtherForm: React.FC<Iprops> = (props) => {
ref=
{
otherFormRef
}
colon=
{
false
}
autoComplete=
"off"
initialValues=
{
history
.
location
.
query
?.
id
?
getOtherFormParamsByEdit
:
{
isInvoice
:
false
}
}
initialValues=
{
history
.
location
.
query
?.
id
?
getOtherFormParamsByEdit
:
{}
}
>
<
Form
.
Item
name=
"isInvoice"
label=
"提供发票"
rules=
{
[
{
required
:
true
,
message
:
'请选择是否提供发票'
}
]
}
>
<
Radio
.
Group
size=
"small"
>
<
Radio
.
Button
value=
{
true
}
style=
{
{
width
:
100
,
textAlign
:
'center'
}
}
>
是
</
Radio
.
Button
>
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
7792d18d
This diff is collapsed.
Click to expand it.
src/pages/commodity/products/addProductsItem/productImageForm.tsx
View file @
7792d18d
...
...
@@ -50,10 +50,8 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
/* 给数据添加图片字段 */
useEffect
(()
=>
{
// console.log('图片111', priceAttributeParams)
let
_priceAttributeParams
:
any
=
[]
if
(
productInfoByEdit
?.
id
){
// id判断是否新增还是编辑
// console.log('图片222', priceAttributeParams)
setSetImageType
(
productInfoByEdit
.
isAllAttributePic
)
setIsAllAttributePic
(
productInfoByEdit
.
isAllAttributePic
)
let
_commodityPicList
=
productInfoByEdit
.
unitPriceAndPicList
.
map
(
_
=>
_
.
commodityPic
)
...
...
@@ -87,7 +85,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
// }
setPriceAttributeParamsByRender
(
_priceAttributeParams
)
setProductAttributeAndImageParams
(
_priceAttributeParams
)
console
.
log
(
_priceAttributeParams
,
priceAttributeParams
,
'_p'
)
// 这里可能为空数组
console
.
log
(
_priceAttributeParams
,
priceAttributeParams
,
'_p'
)
// 这里可能为空数组
** 如果不到此页面 前一个是旧数据 后面的为新数据
// 初始化若是按所有属性共用做显示处理
if
(
setImageType
&&
_priceAttributeParams
.
length
>
0
){
setCommonImageList
(
_priceAttributeParams
[
0
].
commodityPic
)
...
...
src/pages/commodity/products/addProductsItem/selectGoodsForm.tsx
View file @
7792d18d
...
...
@@ -41,6 +41,7 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
item
[
next
.
id
]
=
next
;
return
item
},{}))
console
.
log
(
goodsArr
,
'goods'
)
if
(
goodsArr
.
length
>
0
){
setIsChecked
(
true
)
setIsSelectGoods
(
true
)
...
...
src/pages/commodity/products/index.tsx
View file @
7792d18d
...
...
@@ -84,13 +84,11 @@ const Products: React.FC<{}> = () => {
{
title
:
'ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
className
:
'commonPickColor'
,
render
:
(
text
:
any
,
record
:
any
)
=>
<
span
className=
"commonPickColor"
onClick=
{
()
=>
handleSee
(
record
)
}
>
{
text
}
<
EyeOutlined
/></
span
>
...
...
@@ -98,19 +96,16 @@ const Products: React.FC<{}> = () => {
{
title
:
'品类'
,
dataIndex
:
[
'customerCategory'
,
'name'
],
align
:
'center'
,
key
:
'customerCategory.name'
,
},
{
title
:
'品牌'
,
dataIndex
:
[
'brand'
,
'name'
],
align
:
'center'
,
key
:
'brand.name'
,
},
{
title
:
'单位'
,
dataIndex
:
'unitName'
,
align
:
'center'
,
key
:
'unitName'
,
},
{
...
...
@@ -156,7 +151,6 @@ const Products: React.FC<{}> = () => {
{
title
:
'审核状态'
,
dataIndex
:
'status'
,
align
:
'center'
,
key
:
'status'
,
render
:
(
text
:
any
,
record
:
any
)
=>
{
let
component
:
ReactNode
=
null
...
...
@@ -205,40 +199,7 @@ const Products: React.FC<{}> = () => {
{
title
:
'操作'
,
dataIndex
:
'option'
,
align
:
'center'
,
render
:
(
text
:
any
,
record
:
any
)
=>
renderOptionButton
(
record
)
// {
// return (
// <>
// <Popconfirm
// title="确定要执行这个操作?"
// onConfirm={() => handleBatchDelete([record.id])}
// onCancel={cancel}
// okText="是"
// cancelText="否"
// >
// <Button type='link'>删除</Button>
// </Popconfirm>
// <Dropdown overlay={
// <Menu>
// <Menu.Item>
// {record.status === 1 ? <Button type='link' onClick={()=>clickSubmitCheck(record)}>提交审核</Button> : ''}
// </Menu.Item>
// {(record.status === 4 || record.status === 6) ? <Menu.Item><Button type='link' onClick={() => clickUp(1, record.id)}>上架</Button></Menu.Item> : ''}
// {record.status === 5 ? <Menu.Item><Button type='link' onClick={() => clickUp(0, record.id)}>下架</Button></Menu.Item> : ''}
// {record.status === 3 || record.status === 1 ? <Menu.Item><Button type='link' onClick={() => clickModify(record.id)}>修改</Button></Menu.Item> : ''}
// <Menu.Item>
// <Button type='link' onClick={()=>clickCopy(record)}>复制</Button>
// </Menu.Item>
// </Menu>
// }>
// <a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
// 更多 <CaretDownOutlined />
// </a>
// </Dropdown>
// </>
// )
// }
}
];
...
...
src/pages/commodity/products/viewProducts.tsx
View file @
7792d18d
...
...
@@ -360,7 +360,7 @@ const viewProducts: React.FC<{}> = () => {
<
Col
span=
{
20
}
>
<
p
>
{
productDetail
?.
commodityAreaList
.
map
(
_item
=>
<
p
>
{
_item
.
provinceName
+
'/'
+
(
_item
.
cityName
||
''
)
}
</
p
>)
productDetail
?.
commodityAreaList
.
length
>
0
?
productDetail
?.
commodityAreaList
.
map
(
_item
=>
<
p
>
{
_item
.
provinceName
+
'/'
+
(
_item
.
cityName
||
''
)
}
</
p
>)
:
'全国'
}
</
p
>
</
Col
>
...
...
src/pages/repositories/adjustRepository.tsx
View file @
7792d18d
import
React
,
{
useState
,
useRef
,
useEffect
}
from
'react'
import
{
history
}
from
'umi'
import
{
history
,
Prompt
}
from
'umi'
import
moment
from
'moment'
import
{
Button
,
Card
,
Row
,
Tabs
,
Tag
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
...
...
@@ -12,7 +12,7 @@ import './index.less'
import
NiceForm
from
'@/components/NiceForm'
import
{
repositInSchema
,
repositOutSchema
,
repositTabOneSchema
}
from
'./schema'
import
{
createFormActions
,
FormEffectHooks
,
FormProvider
,
FormSpy
,
createAsyncFormActions
}
from
'@formily/antd'
import
{
getStepNumber
}
from
'@/utils'
import
{
getStepNumber
,
padRequiredMessage
}
from
'@/utils'
import
{
PublicApi
}
from
'@/services/api'
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
import
{
useInitValue
}
from
'@/formSchema/effects/useInitValue'
...
...
@@ -20,6 +20,7 @@ import { useLinkageUtils } from '@/utils/formEffectUtils'
import
{
useUnitPreview
}
from
'./effects'
import
PositionSetting
from
'./components/PositionSetting'
import
{
useHttpRequest
}
from
'@/hooks/useHttpRequest'
import
{
useLeavePageWarn
}
from
'@/hooks/useLeavePageWarn'
const
addSchemaAction
=
createFormActions
()
const
repositInAction
=
createAsyncFormActions
()
...
...
@@ -31,6 +32,7 @@ const AddRepository:React.FC<{}> = (props) => {
}
=
usePageStatus
()
// 获取到的所有仓库, 用于选中后获得仓库库存
const
[
reposits
,
setReposits
]
=
useState
<
any
>
([])
const
[
isEdit
,
setIsEdit
]
=
useState
(
false
)
const
{
data
:
foldValue
,
loading
:
foldLoading
,
run
:
foldFn
}
=
useHttpRequest
(
PublicApi
.
postWarehouseFreightSpaceAllotFold
)
const
{
data
:
exportValue
,
loading
:
exportLoading
,
run
:
exportFn
}
=
useHttpRequest
(
PublicApi
.
postWarehouseFreightSpaceAllotExport
)
...
...
@@ -98,6 +100,7 @@ const AddRepository:React.FC<{}> = (props) => {
repositInAction
.
setFieldValue
(
'NO_SUBMIT2'
,
bringUpTheInventory
)
repositInAction
.
setFieldValue
(
'NO_SUBMIT1'
,
callInInventory
)
repositInAction
.
setFieldValue
(
'foldInventory'
,
''
)
tableRecordRef
.
current
.
reload
&&
tableRecordRef
.
current
.
reload
()
}
...
...
@@ -115,6 +118,7 @@ const AddRepository:React.FC<{}> = (props) => {
repositOutAction
.
setFieldValue
(
'NO_SUBMIT1'
,
bringUpTheInventory
)
repositOutAction
.
setFieldValue
(
'NO_SUBMIT2'
,
callInInventory
)
repositOutAction
.
setFieldValue
(
'foldInventory'
,
0
)
tableRecordRef
.
current
.
reload
&&
tableRecordRef
.
current
.
reload
()
}
...
...
@@ -140,16 +144,22 @@ const AddRepository:React.FC<{}> = (props) => {
inventory
:
values
.
inventory
,
inventoryDeductWay
:
values
.
inventoryDeductWay
,
shopIds
:
values
.
shopIds
,
isAllMemberShare
:
values
.
isAllMemberShare
isAllMemberShare
:
values
.
isAllMemberShare
,
shopType
:
values
.
shopType
}
if
(
values
[
'applyMember'
])
{
params
[
'applyMember'
]
=
values
[
'applyMember'
].
map
(
v
=>
v
.
memberId
)
}
setIsEdit
(
false
)
await
PublicApi
.
postWarehouseFreightSpaceUpdata
(
params
)
setTimeout
(()
=>
{
history
.
goBack
(
-
1
)
},
1000
)
}
const
onPublicFieldChange
=
()
=>
{
setIsEdit
(
true
)
}
return
(
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
...
...
@@ -167,7 +177,7 @@ const AddRepository:React.FC<{}> = (props) => {
<
Tabs
type=
'card'
defaultActiveKey=
'tab1'
onChange=
{
topTableChange
}
>
<
Tabs
.
TabPane
key=
'tab1'
tab=
'仓位设置'
>
<
PositionSetting
addSchemaAction=
{
addSchemaAction
}
schema=
{
repositTabOneSchema
}
formSubmit=
{
formSubmit
}
/>
<
PositionSetting
onFieldChange=
{
onPublicFieldChange
}
addSchemaAction=
{
addSchemaAction
}
schema=
{
repositTabOneSchema
}
formSubmit=
{
formSubmit
}
/>
</
Tabs
.
TabPane
>
<
Tabs
.
TabPane
key=
'tab2'
tab=
'库存调入\调拨'
>
<
Tabs
defaultActiveKey=
'tab2-1'
tabPosition=
'left'
>
...
...
@@ -182,6 +192,9 @@ const AddRepository:React.FC<{}> = (props) => {
onSubmit=
{
handleRespotIn
}
effects=
{
async
(
$
,
{
setFieldState
})
=>
{
const
utils
=
useLinkageUtils
()
// FormEffectHooks.onFormInputChange$().subscribe(() =>
{
// setIsEdit(true)
//
})
FormEffectHooks
.
onFormMount$
().
subscribe
(()
=>
{
const
name
=
spyForm
.
getFieldValue
(
'name'
)
const
asyncEnums
=
reposits
.
map
(
v
=>
({
...
...
@@ -190,8 +203,12 @@ const AddRepository:React.FC<{}> = (props) => {
}))
utils
.
enum
(
'freightSpaceId'
,
asyncEnums
)
$
(
'onFieldInputChange'
,
'freightSpaceId'
).
subscribe
(
state
=>
{
const
numberValue
=
reposits
.
find
(
v
=>
v
.
id
===
state
.
value
).
inventory
||
0
const
repositValue
=
reposits
.
find
(
v
=>
v
.
id
===
state
.
value
)
const
numberValue
=
repositValue
.
inventory
||
0
utils
.
value
(
'NO_SUBMIT1'
,
numberValue
)
setFieldState
(
'NO_SUBMIT1'
,
state
=>
{
state
.
props
.
title
=
`当前仓位库存(${repositValue.unit})`
})
setFieldState
(
'foldInventory'
,
state
=>
{
state
.
props
[
"x-component-props"
].
max
=
numberValue
state
.
props
[
"x-component-props"
].
marks
=
getStepNumber
(
numberValue
)
...
...
@@ -202,6 +219,10 @@ const AddRepository:React.FC<{}> = (props) => {
{
label
:
name
,
value
:
id
}
])
utils
.
value
(
'foldFreightSpaceId'
,
id
)
setFieldState
(
'NO_SUBMIT2'
,
state
=>
{
state
.
props
.
title
=
`当前仓位库存(${initValue.unit})`
})
utils
.
value
(
'NO_SUBMIT2'
,
spyForm
.
getFieldValue
(
'inventory'
))
})
}
}
...
...
@@ -225,6 +246,9 @@ const AddRepository:React.FC<{}> = (props) => {
onSubmit=
{
handleRespotOut
}
effects=
{
async
(
$
,
{
setFieldState
})
=>
{
const
utils
=
useLinkageUtils
()
// FormEffectHooks.onFormInputChange$().subscribe(() =>
{
// setIsEdit(true)
//
})
FormEffectHooks
.
onFormMount$
().
subscribe
(()
=>
{
const
name
=
spyForm
.
getFieldValue
(
'name'
)
const
inventoryNumber
=
spyForm
.
getFieldValue
(
'inventory'
)
...
...
@@ -271,7 +295,7 @@ const AddRepository:React.FC<{}> = (props) => {
</
Tabs
>
</
FormProvider
>
</
Card
>
<
Prompt
when=
{
isEdit
as
boolean
}
message=
"有未提交的数据, 你确定要离开么?"
/>
</
PageHeaderWrapper
>
)
}
...
...
src/pages/repositories/components/PositionSetting.tsx
View file @
7792d18d
...
...
@@ -3,7 +3,7 @@ import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import
{
useInitValue
}
from
'@/formSchema/effects/useInitValue'
import
EyePreview
from
'@/components/EyePreview'
import
{
findItemAndDelete
}
from
'@/utils'
import
{
ISchemaFormActions
,
ISchema
}
from
'@formily/antd'
import
{
ISchemaFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
createAddRepositoryEffect
,
useUnitPreview
}
from
'../effects'
import
{
PublicApi
}
from
'@/services/api'
...
...
@@ -24,6 +24,7 @@ import Submit from '@/components/NiceForm/components/Submit'
export
interface
PositionSettingProps
{
addSchemaAction
:
ISchemaFormActions
,
schema
:
ISchema
,
onFieldChange
?(),
formSubmit
?(
values
)
}
...
...
@@ -35,7 +36,7 @@ const fetchMemberList = async (params) => {
const
PositionSetting
:
React
.
FC
<
PositionSettingProps
>
=
(
props
)
=>
{
const
{
addSchemaAction
,
schema
,
formSubmit
}
=
props
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{}
}
=
props
const
[
visibleChannelMember
,
setVisibleChannelMember
]
=
useState
(
false
)
const
[
visibleChannelRroduct
,
setVisibleChannelRroduct
]
=
useState
(
false
)
...
...
@@ -296,12 +297,18 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
connectProduct
}
}
effects=
{
(
$
,
{
setFieldState
})
=>
{
FormEffectHooks
.
onFormInputChange$
().
subscribe
(()
=>
{
onFieldChange
()
})
createAddRepositoryEffect
(
addSchemaAction
)
$
(
'onFieldValueChange'
,
'shopType'
).
subscribe
(
parentState
=>
{
if
(
parentState
.
value
)
{
console
.
log
(
'review'
)
setFieldState
(
'shopIds'
,
state
=>
{
state
.
props
[
"x-component-props"
].
dataSource
=
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
type
===
parentState
.
value
)
state
.
props
[
"x-component-props"
].
dataSource
=
pageStatus
===
PageStatus
.
PREVIEW
?
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
type
===
parentState
.
value
&&
state
.
value
.
includes
(
v
.
id
))
:
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
type
===
parentState
.
value
)
})
}
})
...
...
src/pages/repositories/schema/index.tsx
View file @
7792d18d
...
...
@@ -4,6 +4,7 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import
{
GlobalConfig
}
from
'@/global/config'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
SHOP_TYPES
}
from
'@/constants'
;
import
{
padRequiredMessage
}
from
'@/utils'
;
// 将获取的商城转化为可用类型
const
getShopTypeMap
=
(()
=>
{
...
...
@@ -19,7 +20,7 @@ const getShopTypeMap = (() => {
},
[])
})()
export
const
repositSchema
:
ISchema
=
{
export
const
repositSchema
:
ISchema
=
padRequiredMessage
(
{
type
:
'object'
,
properties
:
{
megaLayout
:
{
...
...
@@ -89,7 +90,7 @@ export const repositSchema: ISchema = {
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCategory
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectC
ustomerC
ategory
,
placeholder
:
'请选择品类'
,
style
:
{
width
:
160
,
...
...
@@ -125,9 +126,9 @@ export const repositSchema: ISchema = {
}
}
}
}
}
)
export
const
repositMoreSchema
:
ISchema
=
{
export
const
repositMoreSchema
:
ISchema
=
padRequiredMessage
(
{
type
:
'object'
,
properties
:
{
REPOSIT_TABS
:
{
...
...
@@ -336,10 +337,10 @@ export const repositMoreSchema: ISchema = {
}
}
}
}
}
)
// 新增仓位
export
const
repositDetailSchema
:
ISchema
=
{
export
const
repositDetailSchema
:
ISchema
=
padRequiredMessage
(
{
type
:
'object'
,
properties
:
{
REPOSIT_TABS
:
{
...
...
@@ -371,7 +372,13 @@ export const repositDetailSchema: ISchema = {
title
:
'仓位名称'
,
"x-component-props"
:
{
placeholder
:
'建议名称:商品名称+商城名称+渠道描述'
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
60
}
]
},
shopType
:
{
type
:
'string'
,
...
...
@@ -527,10 +534,10 @@ export const repositDetailSchema: ISchema = {
}
}
}
}
}
)
// 仓位设置
export
const
repositTabOneSchema
:
ISchema
=
{
export
const
repositTabOneSchema
:
ISchema
=
padRequiredMessage
(
{
type
:
'object'
,
properties
:
{
REPOSIT_TABS
:
{
...
...
@@ -563,7 +570,13 @@ export const repositTabOneSchema: ISchema = {
editable
:
false
,
"x-component-props"
:
{
placeholder
:
'建议名称:商品名称+商城名称+渠道描述'
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
60
}
]
},
shopType
:
{
type
:
'string'
,
...
...
@@ -720,10 +733,10 @@ export const repositTabOneSchema: ISchema = {
}
}
}
}
}
)
// 库存调入
export
const
repositInSchema
:
ISchema
=
{
export
const
repositInSchema
:
ISchema
=
padRequiredMessage
(
{
type
:
'object'
,
properties
:
{
repos_layout
:
{
...
...
@@ -761,14 +774,14 @@ export const repositInSchema: ISchema = {
'NO_SUBMIT1'
:
{
type
:
'object'
,
readOnly
:
true
,
title
:
'当前仓位库存(尺)'
,
"x-component"
:
'CircleBox'
,
title
:
'当前仓位库存'
,
default
:
0
},
'NO_SUBMIT2'
:
{
type
:
'object'
,
title
:
'当前仓位库存(尺)'
,
"x-component"
:
'CircleBox'
,
title
:
'当前仓位库存'
,
default
:
0
},
"foldInventory"
:
{
...
...
@@ -801,10 +814,10 @@ export const repositInSchema: ISchema = {
}
}
}
}
}
)
// 库存调出
export
const
repositOutSchema
:
ISchema
=
{
export
const
repositOutSchema
:
ISchema
=
padRequiredMessage
(
{
type
:
'object'
,
properties
:
{
repos_layout
:
{
...
...
@@ -842,14 +855,14 @@ export const repositOutSchema: ISchema = {
'NO_SUBMIT1'
:
{
type
:
'object'
,
readOnly
:
true
,
title
:
'当前仓位库存(尺)'
,
"x-component"
:
'CircleBox'
,
title
:
'当前仓位库存'
,
default
:
0
},
'NO_SUBMIT2'
:
{
type
:
'object'
,
title
:
'当前仓位库存(尺)'
,
"x-component"
:
'CircleBox'
,
title
:
'当前仓位库存'
,
default
:
0
},
"foldInventory"
:
{
...
...
@@ -882,4 +895,4 @@ export const repositOutSchema: ISchema = {
}
}
}
}
}
)
src/pages/transaction/purchaseOrder/readyAddOrder/constant/index.ts
0 → 100644
View file @
7792d18d
export
enum
OrderModalType
{
/**
* 进货单下单
*/
PURCHASE_ORDER
=
5
,
/**
* 手工下单
*/
HAND_ORDER
,
/**
* 询价报价下单
*/
INQUIRY_QUOTATION_ORDER
,
/**
* 需求报价下单
*/
DEMAND_QUOTATION_ORDER
,
/**
* 合并订单下单
*/
CONSOLIDATED_ORDER
,
/**
* 渠道直采进货单下单
*/
CHANNEL_DIRECT_PURCHASE_ORDER
,
/**
* 渠道直采手工下单
*/
CHANNEL_DIRECT_MINING_ORDER
,
/**
* 渠道现货进货单下单
*/
CHANNEL_SPOT_PURCHASE_ORDER
,
/**
* 渠道现货手工下单
*/
CHANNEL_SPOT_MANUAL_ORDER
,
}
export
const
orderTypeLabel
=
[
''
,
'询价采购'
,
'需求采购'
,
'现货采购'
,
'集采'
,
'积分兑换'
,
'渠道直采'
,
'渠道现货'
,
'渠道积分兑换'
]
\ No newline at end of file
src/pages/transaction/purchaseOrder/readyAddOrder/detail.tsx
0 → 100644
View file @
7792d18d
import
React
from
'react'
import
{
history
}
from
'umi'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
ReutrnEle
from
'@/components/ReturnEle'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
{
Button
,
Card
}
from
'antd'
import
{
createFormActions
}
from
'@formily/antd'
import
{
SaveOutlined
,
LinkOutlined
}
from
'@ant-design/icons'
import
NiceForm
from
'@/components/NiceForm'
import
{
orderDetailSchema
}
from
'./schema'
import
{
useDetailOrder
}
from
'./model/useDetailOrder'
import
ModalTable
from
'@/components/ModalTable'
import
{
useModelTypeChange
}
from
'./effects'
import
{
OrderModalType
,
orderTypeLabel
}
from
'./constant'
export
interface
PurchaseOrderDetailProps
{}
const
addSchemaAction
=
createFormActions
()
// 采购订单详情页. 包含新增和编辑
const
PurchaseOrderDetail
:
React
.
FC
<
PurchaseOrderDetailProps
>
=
(
props
)
=>
{
const
{
orderModel
}
=
history
.
location
.
query
const
{
productColumns
,
setShowProBtn
,
showProBtn
}
=
useDetailOrder
({
orderModel
})
// 页面进入时, 当前所处的下单模式
const
{
pageStatus
}
=
usePageStatus
()
const
handleOrderNo
=
()
=>
{}
const
handleOrderMember
=
()
=>
{}
const
orderNoPrice
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<
div
className=
'connectBtn'
onClick=
{
handleOrderNo
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
const
orderMember
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<
div
className=
'connectBtn'
onClick=
{
handleOrderMember
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
const
productAddButton
=
showProBtn
&&
<
Button
block
type=
'default'
style=
{
{
margin
:
'24px auto'
}
}
>
选择订单商品
</
Button
>
return
(
<
PageHeaderWrapper
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
className=
'addRepository'
title=
{
pageStatus
===
PageStatus
.
PREVIEW
?
'查看订单'
:
'新建订单'
}
extra=
{
[
<
Button
key=
"1"
onClick=
{
()
=>
addSchemaAction
.
submit
()
}
type=
"primary"
icon=
{
<
SaveOutlined
/>
}
>
保存
</
Button
>,
]
}
>
<
Card
className=
''
>
<
NiceForm
actions=
{
addSchemaAction
}
schema=
{
orderDetailSchema
}
className=
'useConnectBtnWrapper'
effects=
{
(
$
,
ctx
)
=>
{
useModelTypeChange
(
state
=>
{
const
{
value
}
=
state
// 报价单的值 等同于是否填写过报价单
const
quotationOrderValue
=
ctx
.
getFieldValue
(
'quotationNo'
)
// 当选择了手工下单、渠道直采手工下单、渠道现货手工下单、或者选择了合并订单下单并未选择报价单则需要显示商品列表添加接口
if
(
value
===
OrderModalType
.
HAND_ORDER
||
value
===
OrderModalType
.
CHANNEL_DIRECT_MINING_ORDER
||
value
===
OrderModalType
.
CHANNEL_SPOT_MANUAL_ORDER
||
(
value
===
OrderModalType
.
CONSOLIDATED_ORDER
&&
quotationOrderValue
)
)
{
setShowProBtn
(
true
)
}
else
{
setShowProBtn
(
false
)
}
// 选择某种类型时, 需显示对应的订单类型
ctx
.
setFieldValue
(
'type'
,
orderTypeLabel
[
value
-
4
])
// -4 获得对应的数组下标, 由于id是固定的
})
}
}
expressionScope=
{
{
orderNoPrice
,
orderMember
,
productColumns
,
productAddButton
}
}
/>
</
Card
>
<
ModalTable
modalTitle=
'选择订单商品'
columns=
{
productColumns
}
/>
</
PageHeaderWrapper
>
)
}
PurchaseOrderDetail
.
defaultProps
=
{}
export
default
PurchaseOrderDetail
\ No newline at end of file
src/pages/transaction/purchaseOrder/readyAddOrder/effects/index.ts
0 → 100644
View file @
7792d18d
import
{
ISchemaFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
export
const
useModelTypeChange
=
(
callback
)
=>
{
// 下单模式发生改变时
FormEffectHooks
.
onFieldValueChange$
(
'orderModel'
).
subscribe
(
state
=>
{
callback
(
state
)
})
}
\ No newline at end of file
src/pages/transaction/purchaseOrder/readyAddOrder/index.tsx
View file @
7792d18d
import
React
from
'react'
import
{
history
}
from
'umi'
import
{
Card
,
Button
,
Space
,
Dropdown
,
Menu
}
from
'antd'
import
{
StandardTable
}
from
'god'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
...
...
@@ -67,7 +68,7 @@ const ReadyAddOrder:React.FC<ReadyAddOrderProps> = (props) => {
}
}
formilyChilds=
{
{
children
:
<
Space
>
<
Button
icon=
{
<
PlusCircleOutlined
/>
}
type=
'primary'
>
新建
</
Button
>
<
Button
icon=
{
<
PlusCircleOutlined
/>
}
type=
'primary'
onClick=
{
()
=>
history
.
push
(
'/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder/orderDetail'
)
}
>
新建
</
Button
>
<
Button
>
批量提交审核
</
Button
>
<
DropDeleteDown
>
<
Menu
onClick=
{
(
e
)
=>
handleMenuClick
(
e
)
}
>
...
...
src/pages/transaction/purchaseOrder/readyAddOrder/model/useDetailOrder.tsx
0 → 100644
View file @
7792d18d
import
React
,
{
useState
}
from
'react'
import
{
OrderModalType
}
from
'../constant'
export
const
useDetailOrder
=
(
options
)
=>
{
// const [productDataSource, setProductDataSource] = useState
const
[
showProBtn
,
setShowProBtn
]
=
useState
(
options
.
orderModel
)
const
[
showMemberType
,
setShowMemberType
]
=
useState
(
false
)
const
productColumns
:
any
[]
=
[
{
title
:
'商品ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
title
:
'品类'
,
dataIndex
:
'customerCategoryName'
,
align
:
'center'
,
key
:
'customerCategoryName'
,
},
{
title
:
'品牌'
,
dataIndex
:
'brandName'
,
align
:
'center'
,
key
:
'brandName'
,
},
]
return
{
productColumns
,
showProBtn
,
setShowProBtn
,
showMemberType
,
setShowMemberType
}
}
\ No newline at end of file
src/pages/transaction/purchaseOrder/readyAddOrder/schema/index.ts
View file @
7792d18d
import
{
ISchema
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
export
const
tableListSchema
:
ISchema
=
{
type
:
'object'
,
...
...
@@ -8,7 +9,7 @@ export const tableListSchema: ISchema = {
type
:
'string'
,
"x-component"
:
'SearchFilter'
,
'x-component-props'
:
{
placeholder
:
'
搜索
'
,
placeholder
:
'
请输入订单编号
'
,
align
:
'flex-end'
,
},
},
...
...
@@ -28,6 +29,12 @@ export const tableListSchema: ISchema = {
placeholder
:
'请输入订单摘要'
,
}
},
"supplyMembersName"
:
{
type
:
'string'
,
"x-component-props"
:
{
placeholder
:
'请输入供应会员名称'
}
},
"[startCreateTime,endCreateTime]"
:
{
type
:
'array'
,
"x-component"
:
'daterangepicker'
,
...
...
@@ -45,3 +52,163 @@ export const tableListSchema: ISchema = {
},
}
}
/**
* 订单详情(新增订单, 编辑订单)
*/
// 基本信息
const
basicInfo
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'基本信息'
},
properties
:
{
NO_SUBMIT_LAYOUT
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
labelCol
:
4
,
labelAlign
:
'left'
,
wrapperCol
:
10
},
properties
:
{
orderModel
:
{
type
:
'string'
,
enum
:
GlobalConfig
.
web
.
orderMode
.
map
(
v
=>
{
delete
v
.
platformType
;
return
v
}),
title
:
'下单模式'
},
orderThe
:
{
type
:
'string'
,
title
:
'订单摘要'
,
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
60
}
]
},
quotationNo
:
{
type
:
'string'
,
title
:
'对应报价单号'
,
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{orderNoPrice}}"
},
},
supplyMembersName
:
{
type
:
'string'
,
title
:
'供应会员'
,
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{orderMember}}"
},
},
orderNo
:
{
type
:
'string'
,
title
:
'订单编号'
,
"x-component"
:
'text'
},
type
:
{
type
:
'string'
,
title
:
'订单类型'
,
"x-component"
:
'text'
},
createTime
:
{
type
:
'string'
,
title
:
'下单时间'
},
interiorState
:
{
type
:
'string'
,
title
:
'内部状态'
},
externalState
:
{
type
:
'string'
,
title
:
'外部状态'
},
}
},
}
}
// 订单商品
const
orderProduct
:
ISchema
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'订单商品'
},
properties
:
{
orderProductRequests
:
{
type
:
'array'
,
"x-component"
:
'MultTable'
,
"x-component-props"
:
{
rowKey
:
'id'
,
columns
:
"{{productColumns}}"
,
prefix
:
"{{productAddButton}}"
}
}
}
}
// 支付信息
const
payInfo
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'支付信息'
},
properties
:
{
}
}
// 交付信息
const
submitInfo
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'交付信息'
},
properties
:
{
}
}
// 其他信息
const
ortherInfo
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'其他信息'
},
properties
:
{
}
}
// 流转记录
const
transformRecord
=
{
type
:
'object'
,
"x-component"
:
'tabpane'
,
"x-component-props"
:
{
tab
:
'流转记录'
},
properties
:
{
}
}
// 新增订单详情
export
const
orderDetailSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
NO_SUBMIT_TABS
:
{
type
:
'object'
,
"x-component"
:
'tab'
,
properties
:
{
NO_SUBMIT_TABPANE1
:
basicInfo
,
NO_SUBMIT_TABPANE2
:
orderProduct
,
NO_SUBMIT_TABPANE3
:
payInfo
,
NO_SUBMIT_TABPANE4
:
submitInfo
,
NO_SUBMIT_TABPANE5
:
ortherInfo
,
NO_SUBMIT_TABPANE6
:
transformRecord
,
}
}
}
}
\ No newline at end of file
src/utils/index.tsx
View file @
7792d18d
...
...
@@ -203,6 +203,12 @@ export const dupliArr = (arr: any[]) => {
// 获取最小的差距值
export
const
getDistanceNumber
=
(
target
,
step
,
min
)
=>
{
// 当递归到只能被1整除时, 直接返回target
if
(
step
===
1
)
{
return
{
[
target
]:
target
}
}
const
value
=
target
/
step
if
(
value
>=
min
)
{
let
num
=
0
...
...
@@ -214,17 +220,17 @@ export const getDistanceNumber = (target, step, min) => {
result
[
target
]
=
target
return
result
}
else
{
return
getDistanceNumber
(
target
,
step
--
,
min
)
return
getDistanceNumber
(
target
,
--
step
,
min
)
}
}
// 将数字拆分成指定区间
export
const
getStepNumber
=
(
target
:
number
,
step
?:
number
)
=>
{
if
(
target
===
0
)
{
return
null
return
{}
}
// 最小相差10
const
minDistance
=
10
const
minDistance
=
4
step
=
step
||
4
...
...
@@ -392,6 +398,30 @@ export const getQueryStringParams = (url?: string) => {
return
queryString
.
parse
(
searchParam
)
}
// 填充必填的schema message提示
export
const
padRequiredMessage
=
(
originSchema
:
ISchema
)
=>
{
const
messageSwich
=
(
type
)
=>
{
return
type
?
'请选择'
:
'请输入'
}
const
todoFn
=
(
targetSchema
)
=>
{
}
Object
.
entries
(
originSchema
.
properties
).
map
(([
key
,
value
])
=>
{
if
(
value
.
required
)
{
const
isSelect
=
value
.
enum
const
message
=
messageSwich
(
isSelect
)
+
(
value
.
title
||
''
)
value
[
'x-rules'
]
=
Array
.
isArray
(
value
[
'x-rules'
])
?
value
[
'x-rules'
].
concat
([{
message
,
required
:
true
}])
:
[{
message
,
required
:
true
}]
}
if
(
value
.
properties
)
{
padRequiredMessage
(
value
)
}
return
value
})
return
originSchema
}
export
default
{
isArray
,
isObject
,
...
...
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