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
f8017223
Commit
f8017223
authored
Aug 14, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉本地权限
parent
7c59600c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
299 additions
and
233 deletions
+299
-233
index.ts
src/constants/index.ts
+1
-1
addRepository.tsx
src/pages/repositories/addRepository.tsx
+3
-231
adjustRepository.tsx
src/pages/repositories/adjustRepository.tsx
+0
-0
PositionSetting.tsx
src/pages/repositories/components/PositionSetting.tsx
+287
-0
index.tsx
src/pages/repositories/schema/index.tsx
+5
-1
index.ts
src/utils/index.ts
+3
-0
No files found.
src/constants/index.ts
View file @
f8017223
...
...
@@ -9,7 +9,7 @@ export const MALL_TYPE = {
}
// 本地环境跳过权限校验
export
const
isDev
=
tru
e
export
const
isDev
=
fals
e
export
const
Environment_Status
=
{
0
:
"所有"
,
...
...
src/pages/repositories/addRepository.tsx
View file @
f8017223
...
...
@@ -24,6 +24,7 @@ import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import
{
useInitValue
}
from
'@/formSchema/effects/useInitValue'
import
{
useWarehouseSelect
,
createAddRepositoryEffect
,
useUnitPreview
}
from
'./effects'
import
ModalTable
from
'@/components/ModalTable'
import
PositionSetting
from
'./components/PositionSetting'
const
fetchMemberList
=
async
(
params
)
=>
{
const
res
=
await
PublicApi
.
getMemberMaintenancePage
(
params
)
...
...
@@ -37,7 +38,6 @@ const fetchProductList = async (params) => {
const
addSchemaAction
=
createFormActions
()
const
AddRepository
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
const
ref
=
useRef
<
any
>
({})
const
{
id
,
preview
,
...
...
@@ -45,182 +45,9 @@ const AddRepository:React.FC<{}> = (props) => {
}
=
usePageStatus
()
const
initValue
=
useInitValue
(
PublicApi
.
getWarehouseFreightSpaceDetails
)
useUnitPreview
(
initValue
,
addSchemaAction
)
const
[
visibleChannelMember
,
setVisibleChannelMember
]
=
useState
(
false
)
const
[
visibleChannelRroduct
,
setVisibleChannelRroduct
]
=
useState
(
false
)
const
[
memberRowSelection
,
memberRowCtl
]
=
useRowSelectionTable
()
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
type
:
'radio'
})
const
columnsSetMember
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'memberId'
,
align
:
'center'
,
key
:
'memberId'
,
},
{
title
:
'会员名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
title
:
'会员类型'
,
dataIndex
:
'memberTypeName'
,
align
:
'center'
,
key
:
'memberTypeName'
,
},
{
title
:
'会员角色'
,
dataIndex
:
'roleName'
,
align
:
'center'
,
key
:
'roleName'
,
},
{
title
:
'会员等级'
,
dataIndex
:
'levelTag'
,
align
:
'center'
,
key
:
'levelTag'
,
}
]
const
columnsSetProduct
:
ColumnType
<
any
>
[]
=
[
{
title
:
'商品ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
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'
,
},
]
// 弹出会员
const
handleAddMemberBtn
=
()
=>
{
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'applyMember'
)
memberRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
memberId
))
memberRowCtl
.
setSelectRow
(
checkBoxs
)
setVisibleChannelMember
(
true
)
}
// 弹出商品选择
const
handleAddProductBtn
=
()
=>
{
productRowCtl
.
setSelectedRowKeys
([])
productRowCtl
.
setSelectRow
([])
setVisibleChannelRroduct
(
true
)
}
// 会员添加弹窗控制
const
handleOkAddMember
=
()
=>
{
setVisibleChannelMember
(
false
)
addSchemaAction
.
setFieldValue
(
'applyMember'
,
memberRowCtl
.
selectRow
)
}
const
handleCancelAddMember
=
()
=>
{
setVisibleChannelMember
(
false
)
}
// 商品添加弹窗控制
const
handleOkAddProduct
=
async
()
=>
{
setVisibleChannelRroduct
(
false
)
const
selectResult
=
productRowCtl
.
selectRow
[
0
]
if
(
!
selectResult
)
{
return
null
}
const
goodsId
=
selectResult
.
goodsId
addSchemaAction
.
setFieldValue
(
'productName'
,
selectResult
.
name
)
addSchemaAction
.
setFieldValue
(
'category'
,
selectResult
.
customerCategoryName
)
addSchemaAction
.
setFieldValue
(
'brand'
,
selectResult
.
brandName
)
addSchemaAction
.
setFieldValue
(
'unit'
,
selectResult
.
unitName
)
addSchemaAction
.
setFieldValue
(
'productId'
,
selectResult
.
id
)
addSchemaAction
.
setFieldState
(
'inventory'
,
state
=>
{
state
.
props
[
"x-props"
]
=
{
addonAfter
:
<
div
style=
{
{
marginLeft
:
4
}
}
>
{
selectResult
.
unitName
}
</
div
>
}
})
// 查询到的货品id
const
{
data
}
=
await
PublicApi
.
getProductGoodsGetGoods
({
id
:
goodsId
})
// 设置货品名称
addSchemaAction
.
setFieldValue
(
'itemNo'
,
data
.
name
)
}
const
handleCancelAddProduct
=
()
=>
{
setVisibleChannelRroduct
(
false
)
}
// 会员选择后的表格
const
handleDeleteTable
=
(
id
)
=>
{
const
value
=
addSchemaAction
.
getFieldValue
(
'applyMember'
)
addSchemaAction
.
setFieldValue
(
'applyMember'
,
findItemAndDelete
(
value
,
id
))
}
const
tableColumns
=
[
{
dataIndex
:
'memberId'
,
title
:
'ID'
,
align
:
'center'
},
{
dataIndex
:
'name'
,
align
:
'center'
,
title
:
'会员名称'
,
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`
}
>
{
_
}
</
EyePreview
>
},
{
dataIndex
:
'memberTypeName'
,
title
:
'会员类型'
,
align
:
'center'
},
{
dataIndex
:
'ctl'
,
title
:
'操作'
,
align
:
'center'
,
render
:
(
_
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDeleteTable
(
record
.
id
)
}
>
删除
</
Button
>
}
]
const
tableAddButton
=
<
Button
style=
{
{
marginBottom
:
16
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddMemberBtn
}
type=
'dashed'
>
选择指定会员
</
Button
>
const
formSearch
:
ISchema
=
{
type
:
'object'
,
properties
:
{
name
:
{
type
:
'string'
,
"x-component"
:
'Search'
,
"x-component-props"
:
{
placeholder
:
'请输入会员名称'
}
}
}
}
const
formProduct
:
ISchema
=
{
type
:
'object'
,
properties
:
{
name
:
{
type
:
'string'
,
"x-component"
:
'Search'
,
"x-component-props"
:
{
placeholder
:
'请输入商品名称'
}
}
}
}
// 商品选择
const
connectProduct
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<
div
className=
'connectBtn'
onClick=
{
handleAddProductBtn
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
// 整体表单提交
const
handle
Submit
=
async
(
values
)
=>
{
const
form
Submit
=
async
(
values
)
=>
{
const
params
=
omit
(
values
,
[
'NO_SUBMIT3'
])
if
(
params
[
'applyMember'
])
{
params
[
'applyMember'
]
=
params
[
'applyMember'
].
map
(
v
=>
v
.
memberId
)
...
...
@@ -244,63 +71,8 @@ const AddRepository:React.FC<{}> = (props) => {
]
}
>
<
Card
className=
''
>
<
NiceForm
previewPlaceholder=
'loading...'
editable=
{
pageStatus
!==
PageStatus
.
PREVIEW
}
initialValues=
{
initValue
}
expressionScope=
{
{
tableColumns
,
tableAddButton
,
connectProduct
}
}
effects=
{
()
=>
{
createAddRepositoryEffect
(
addSchemaAction
)
}
}
onSubmit=
{
handleSubmit
}
actions=
{
addSchemaAction
}
schema=
{
repositDetailSchema
}
/>
<
PositionSetting
addSchemaAction=
{
addSchemaAction
}
schema=
{
repositDetailSchema
}
formSubmit=
{
formSubmit
}
/>
</
Card
>
<
ModalTable
modalTitle=
'选择渠道会员'
confirm=
{
handleOkAddMember
}
cancel=
{
handleCancelAddMember
}
visible=
{
visibleChannelMember
}
columns=
{
columnsSetMember
}
rowSelection=
{
memberRowSelection
}
fetchTableData=
{
params
=>
fetchMemberList
(
params
)
}
formilyProps=
{
{
ctx
:
{
schema
:
formSearch
}
}
}
tableProps=
{
{
rowKey
:
'memberId'
}
}
/>
<
ModalTable
modalTitle=
'选择商品'
confirm=
{
handleOkAddProduct
}
cancel=
{
handleCancelAddProduct
}
visible=
{
visibleChannelRroduct
}
columns=
{
columnsSetProduct
}
rowSelection=
{
productRowSelection
}
fetchTableData=
{
params
=>
fetchProductList
(
params
)
}
formilyProps=
{
{
ctx
:
{
schema
:
formProduct
}
}
}
tableProps=
{
{
rowKey
:
'id'
,
onRow
:
(
record
)
=>
({
onClick
:
()
=>
{
productRowCtl
.
setSelectRow
([
record
]);
productRowCtl
.
setSelectedRowKeys
([
record
.
id
]);
},
})
}
}
/>
</
PageHeaderWrapper
>
)
}
...
...
src/pages/repositories/adjustRepository.tsx
View file @
f8017223
This diff is collapsed.
Click to expand it.
src/pages/repositories/components/PositionSetting.tsx
0 → 100644
View file @
f8017223
import
React
,
{
useState
}
from
'react'
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
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
createAddRepositoryEffect
,
useUnitPreview
}
from
'../effects'
import
{
PublicApi
}
from
'@/services/api'
import
{
PlusOutlined
,
LinkOutlined
,
}
from
'@ant-design/icons'
import
{
Button
}
from
'antd'
import
NiceForm
from
'@/components/NiceForm'
import
ModalTable
from
'@/components/ModalTable'
export
interface
PositionSettingProps
{
addSchemaAction
:
ISchemaFormActions
,
schema
:
ISchema
,
formSubmit
?(
values
)
}
const
fetchMemberList
=
async
(
params
)
=>
{
const
res
=
await
PublicApi
.
getMemberMaintenancePage
(
params
)
return
res
.
data
}
const
fetchProductList
=
async
(
params
)
=>
{
const
res
=
await
PublicApi
.
getProductCommodityGetCommodityDetailList
(
params
)
return
res
.
data
}
const
PositionSetting
:
React
.
FC
<
PositionSettingProps
>
=
(
props
)
=>
{
const
{
addSchemaAction
,
schema
,
formSubmit
}
=
props
const
[
visibleChannelMember
,
setVisibleChannelMember
]
=
useState
(
false
)
const
[
visibleChannelRroduct
,
setVisibleChannelRroduct
]
=
useState
(
false
)
const
[
memberRowSelection
,
memberRowCtl
]
=
useRowSelectionTable
()
const
[
productRowSelection
,
productRowCtl
]
=
useRowSelectionTable
({
type
:
'radio'
})
const
{
id
,
preview
,
pageStatus
}
=
usePageStatus
()
const
initValue
=
useInitValue
(
PublicApi
.
getWarehouseFreightSpaceDetails
)
useUnitPreview
(
initValue
,
addSchemaAction
)
// 会员选择后的表格
const
handleDeleteTable
=
(
id
)
=>
{
const
value
=
addSchemaAction
.
getFieldValue
(
'applyMember'
)
addSchemaAction
.
setFieldValue
(
'applyMember'
,
findItemAndDelete
(
value
,
id
))
}
const
handleAddMemberBtn
=
()
=>
{
const
checkBoxs
=
addSchemaAction
.
getFieldValue
(
'applyMember'
)
memberRowCtl
.
setSelectedRowKeys
(
checkBoxs
.
map
(
v
=>
v
.
memberId
))
memberRowCtl
.
setSelectRow
(
checkBoxs
)
setVisibleChannelMember
(
true
)
}
// 弹出商品选择
const
handleAddProductBtn
=
()
=>
{
productRowCtl
.
setSelectedRowKeys
([])
productRowCtl
.
setSelectRow
([])
setVisibleChannelRroduct
(
true
)
}
// 新增会员
const
tableAddButton
=
<
Button
style=
{
{
marginBottom
:
16
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddMemberBtn
}
type=
'dashed'
>
选择指定会员
</
Button
>
const
tableColumns
=
[
{
dataIndex
:
'memberId'
,
title
:
'ID'
,
align
:
'center'
},
{
dataIndex
:
'name'
,
align
:
'center'
,
title
:
'会员名称'
,
render
:
(
_
,
record
)
=>
<
EyePreview
url=
{
`/memberCenter/memberAbility/manage/addMember?id=${record.memberId}&preview=1`
}
>
{
_
}
</
EyePreview
>
},
{
dataIndex
:
'memberTypeName'
,
title
:
'会员类型'
,
align
:
'center'
},
{
dataIndex
:
'ctl'
,
title
:
'操作'
,
align
:
'center'
,
render
:
(
_
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDeleteTable
(
record
.
id
)
}
>
删除
</
Button
>
}
]
const
connectProduct
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<
div
className=
'connectBtn'
onClick=
{
handleAddProductBtn
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
// 仓位设置表单提交
const
handleSubmit
=
async
(
values
)
=>
{
formSubmit
&&
formSubmit
(
values
)
}
// 会员添加弹窗控制
const
handleOkAddMember
=
()
=>
{
setVisibleChannelMember
(
false
)
addSchemaAction
.
setFieldValue
(
'applyMember'
,
memberRowCtl
.
selectRow
)
}
const
handleCancelAddMember
=
()
=>
{
setVisibleChannelMember
(
false
)
}
// 商品添加弹窗控制
const
handleOkAddProduct
=
async
()
=>
{
setVisibleChannelRroduct
(
false
)
const
selectResult
=
productRowCtl
.
selectRow
[
0
]
if
(
!
selectResult
)
{
return
null
}
const
goodsId
=
selectResult
.
goodsId
addSchemaAction
.
setFieldValue
(
'productName'
,
selectResult
.
name
)
addSchemaAction
.
setFieldValue
(
'category'
,
selectResult
.
customerCategoryName
)
addSchemaAction
.
setFieldValue
(
'brand'
,
selectResult
.
brandName
)
addSchemaAction
.
setFieldValue
(
'unit'
,
selectResult
.
unitName
)
addSchemaAction
.
setFieldValue
(
'productId'
,
selectResult
.
id
)
addSchemaAction
.
setFieldState
(
'inventory'
,
state
=>
{
state
.
props
[
"x-props"
]
=
{
addonAfter
:
<
div
style=
{
{
marginLeft
:
4
}
}
>
{
selectResult
.
unitName
}
</
div
>
}
})
// 查询到的货品id
const
{
data
}
=
await
PublicApi
.
getProductGoodsGetGoods
({
id
:
goodsId
})
// 设置货品名称
addSchemaAction
.
setFieldValue
(
'itemNo'
,
data
.
name
)
}
const
handleCancelAddProduct
=
()
=>
{
setVisibleChannelRroduct
(
false
)
}
const
columnsSetMember
:
any
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'memberId'
,
align
:
'center'
,
key
:
'memberId'
,
},
{
title
:
'会员名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
title
:
'会员类型'
,
dataIndex
:
'memberTypeName'
,
align
:
'center'
,
key
:
'memberTypeName'
,
},
{
title
:
'会员角色'
,
dataIndex
:
'roleName'
,
align
:
'center'
,
key
:
'roleName'
,
},
{
title
:
'会员等级'
,
dataIndex
:
'levelTag'
,
align
:
'center'
,
key
:
'levelTag'
,
}
]
const
columnsSetProduct
:
any
[]
=
[
{
title
:
'商品ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
key
:
'id'
,
},
{
title
:
'商品名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
key
:
'name'
,
},
{
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'
,
},
]
const
formSearch
:
ISchema
=
{
type
:
'object'
,
properties
:
{
name
:
{
type
:
'string'
,
"x-component"
:
'Search'
,
"x-component-props"
:
{
placeholder
:
'请输入会员名称'
}
}
}
}
const
formProduct
:
ISchema
=
{
type
:
'object'
,
properties
:
{
name
:
{
type
:
'string'
,
"x-component"
:
'Search'
,
"x-component-props"
:
{
placeholder
:
'请输入商品名称'
}
}
}
}
return
(
<>
<
NiceForm
previewPlaceholder=
'loading...'
editable=
{
pageStatus
!==
PageStatus
.
PREVIEW
}
initialValues=
{
initValue
}
expressionScope=
{
{
tableColumns
,
tableAddButton
,
connectProduct
}
}
effects=
{
()
=>
{
createAddRepositoryEffect
(
addSchemaAction
)
}
}
onSubmit=
{
handleSubmit
}
actions=
{
addSchemaAction
}
schema=
{
schema
}
/>
<
ModalTable
modalTitle=
'选择渠道会员'
confirm=
{
handleOkAddMember
}
cancel=
{
handleCancelAddMember
}
visible=
{
visibleChannelMember
}
columns=
{
columnsSetMember
}
rowSelection=
{
memberRowSelection
}
fetchTableData=
{
params
=>
fetchMemberList
(
params
)
}
formilyProps=
{
{
ctx
:
{
schema
:
formSearch
}
}
}
tableProps=
{
{
rowKey
:
'memberId'
}
}
/>
<
ModalTable
modalTitle=
'选择商品'
confirm=
{
handleOkAddProduct
}
cancel=
{
handleCancelAddProduct
}
visible=
{
visibleChannelRroduct
}
columns=
{
columnsSetProduct
}
rowSelection=
{
productRowSelection
}
fetchTableData=
{
params
=>
fetchProductList
(
params
)
}
formilyProps=
{
{
ctx
:
{
schema
:
formProduct
}
}
}
tableProps=
{
{
rowKey
:
'id'
,
onRow
:
(
record
)
=>
({
onClick
:
()
=>
{
productRowCtl
.
setSelectRow
([
record
]);
productRowCtl
.
setSelectedRowKeys
([
record
.
id
]);
},
})
}
}
/>
</>
)
}
PositionSetting
.
defaultProps
=
{}
export
default
PositionSetting
\ No newline at end of file
src/pages/repositories/schema/index.tsx
View file @
f8017223
...
...
@@ -498,6 +498,7 @@ export const repositTabOneSchema: ISchema = {
type
:
'string'
,
required
:
true
,
title
:
'仓位名称'
,
editable
:
false
,
"x-component-props"
:
{
placeholder
:
'建议名称:商品名称+商城名称+渠道描述'
}
...
...
@@ -505,12 +506,12 @@ export const repositTabOneSchema: ISchema = {
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
editable
:
false
,
"x-mega-props"
:
{
full
:
true
},
"x-component-props"
:
{
disabled
:
true
,
addonAfter
:
"{{connectProduct}}"
},
required
:
true
},
...
...
@@ -533,6 +534,7 @@ export const repositTabOneSchema: ISchema = {
warehouseId
:
{
type
:
'string'
,
title
:
'仓库名称'
,
editable
:
false
,
enum
:
[]
},
itemNo
:
{
...
...
@@ -704,6 +706,7 @@ export const repositInSchema: ISchema = {
"foldInventory"
:
{
type
:
'number'
,
"x-component"
:
"CustomSlider"
,
required
:
true
,
"x-component-props"
:
{
width
:
'80%'
,
isNumber
:
true
,
...
...
@@ -784,6 +787,7 @@ export const repositOutSchema: ISchema = {
"foldInventory"
:
{
type
:
'number'
,
"x-component"
:
"CustomSlider"
,
required
:
true
,
"x-component-props"
:
{
width
:
'80%'
,
isNumber
:
true
,
...
...
src/utils/index.ts
View file @
f8017223
...
...
@@ -213,6 +213,9 @@ export const getDistanceNumber = (target, step, min) => {
// 将数字拆分成指定区间
export
const
getStepNumber
=
(
target
:
number
,
step
?:
number
)
=>
{
if
(
target
===
0
)
{
return
null
}
// 最小相差10
const
minDistance
=
10
...
...
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