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
b252db73
Commit
b252db73
authored
Sep 17, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:渠道商品批量上下架
parent
052b717c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
132 additions
and
219 deletions
+132
-219
SearchSelect.tsx
src/components/NiceForm/components/SearchSelect.tsx
+4
-3
directChannel.tsx
src/pages/commodity/products/directChannel.tsx
+63
-14
channelSchema.tsx
src/pages/commodity/products/schema/channelSchema.tsx
+52
-137
RuleSetting.tsx
...s/transaction/transactionRules/components/RuleSetting.tsx
+0
-0
index.tsx
src/pages/transaction/transactionRules/effects/index.tsx
+6
-22
index.less
src/pages/transaction/transactionRules/index.less
+0
-41
index.tsx
src/pages/transaction/transactionRules/schema/index.tsx
+0
-0
index.tsx
src/utils/index.tsx
+7
-2
No files found.
src/components/NiceForm/components/SearchSelect.tsx
View file @
b252db73
...
@@ -128,9 +128,10 @@ const SearchSelect = (props: ISchemaFieldComponentProps) => {
...
@@ -128,9 +128,10 @@ const SearchSelect = (props: ISchemaFieldComponentProps) => {
filterOption=
{
false
}
filterOption=
{
false
}
loading=
{
loading
}
loading=
{
loading
}
options=
{
dataSource
}
options=
{
dataSource
}
getPopupContainer=
{
triggerNode
=>
{
// getPopupContainer={triggerNode => {
return
triggerNode
// return triggerNode
}
}
// }}
getPopupContainer=
{
()
=>
document
.
getElementById
(
'root'
)
}
/* 处理option被遮挡 */
value=
{
props
.
value
}
value=
{
props
.
value
}
dropdownRender=
{
originNode
=>
<
SelectContent
confirm=
{
confirm
}
resetField=
{
resetField
}
parentRef=
{
ref
}
handleChange=
{
handleChange
}
multiple=
{
multiple
}
value=
{
props
.
value
}
>
{
originNode
}
</
SelectContent
>
}
dropdownRender=
{
originNode
=>
<
SelectContent
confirm=
{
confirm
}
resetField=
{
resetField
}
parentRef=
{
ref
}
handleChange=
{
handleChange
}
multiple=
{
multiple
}
value=
{
props
.
value
}
>
{
originNode
}
</
SelectContent
>
}
{
...
multipleProps
}
{
...
multipleProps
}
...
...
src/pages/commodity/products/directChannel.tsx
View file @
b252db73
...
@@ -307,27 +307,76 @@ const DirectChannel: React.FC<{}> = () => {
...
@@ -307,27 +307,76 @@ const DirectChannel: React.FC<{}> = () => {
const
handleUpDown
=
()
=>
{
const
handleUpDown
=
()
=>
{
setIsDisabledOKbtn
(
true
)
setIsDisabledOKbtn
(
true
)
let
params
:
any
=
{
let
params
:
any
=
{}
idList
:
isBatchOption
?
selectRow
.
map
(
item
=>
item
.
id
)
:
[
currentOptionId
],
if
(
isBatchOption
){
shopList
:
checkedValues
params
=
{
idList
:
selectRow
.
map
(
item
=>
item
.
id
),
shopList
:
checkedValues
}
}
else
{
params
=
{
id
:
currentOptionId
,
shopList
:
checkedValues
}
}
}
if
(
isUp
)
if
(
checkedValues
.
length
>
0
){
if
(
isBatchOption
){
// 批量操作区分上下架
PublicApi
.
postProductChannelCommodityPublishCommodity
(
params
).
then
(
res
=>
{
if
(
isUp
){
if
(
checkedValues
.
length
>
0
){
PublicApi
.
postProductChannelCommodityBatchPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
})
}
else
{
setIsDisabledOKbtn
(
false
)
message
.
error
(
'请选择需要上架的渠道商城'
)
}
}
else
{
PublicApi
.
postProductChannelCommodityBatchOffPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
setUpDownModal
(
false
)
ref
.
current
.
reload
()
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
setIsDisabledOKbtn
(
false
)
})
})
}
}
else
{
if
(
isUp
){
if
(
checkedValues
.
length
>
0
){
PublicApi
.
postProductChannelCommodityPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
})
}
else
{
setIsDisabledOKbtn
(
false
)
message
.
error
(
'请选择需要上架的渠道商城'
)
}
}
else
{
}
else
{
setIsDisabledOKbtn
(
false
)
PublicApi
.
postProductChannelCommodityPublishCommodity
(
params
).
then
(
res
=>
{
message
.
error
(
'请选择需要上架的渠道商城'
)
setUpDownModal
(
false
)
ref
.
current
.
reload
()
setIsDisabledOKbtn
(
false
)
})
}
}
else
}
PublicApi
.
postProductChannelCommodityOffPublishCommodity
(
params
).
then
(
res
=>
{
setUpDownModal
(
false
)
// if(isUp)
ref
.
current
.
reload
()
// if(checkedValues.length > 0){
setIsDisabledOKbtn
(
false
)
// PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
})
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
// }else{
// setIsDisabledOKbtn(false)
// message.error('请选择需要上架的渠道商城')
// }
// else
// PublicApi.postProductChannelCommodityOffPublishCommodity(params).then(res => {
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
}
}
...
...
src/pages/commodity/products/schema/channelSchema.tsx
View file @
b252db73
...
@@ -208,150 +208,64 @@ export const channelSchema: ISchema = {
...
@@ -208,150 +208,64 @@ export const channelSchema: ISchema = {
// 添加渠道商品模态框高级筛选
// 添加渠道商品模态框高级筛选
export
const
addChannelSchema
:
ISchema
=
{
export
const
addChannelSchema
:
ISchema
=
{
type
:
'object'
,
type
:
'object'
,
properties
:
{
properties
:
{
name
:
{
name
:
{
type
:
'string'
,
type
:
'string'
,
'x-component'
:
'ModalSearch'
,
'x-component'
:
'ModalSearch'
,
'x-component-props'
:
{
'x-component-props'
:
{
placeholder
:
'商品名称'
,
placeholder
:
'商品名称'
,
align
:
'flex-left'
,
align
:
'flex-left'
,
},
},
[
FORM_FILTER_PATH
]:
{
type
:
'object'
,
'x-component'
:
'flex-layout'
,
'x-component-props'
:
{
rowStyle
:
{
flexWrap
:
'nowrap'
,
style
:
{
marginRight
:
0
}
},
colStyle
:
{
marginTop
:
20
,
},
},
},
},
[
FORM_FILTER_PATH
]:
{
properties
:
{
type
:
'object'
,
categoryId
:
{
'x-component'
:
'flex-layout'
,
type
:
'string'
,
'x-component-props'
:
{
"x-component"
:
'SearchSelect'
,
rowStyle
:
{
"x-component-props"
:
{
flexWrap
:
'nowrap'
,
placeholder
:
'请选择品类'
,
style
:
{
className
:
'fixed-ant-selected-down'
,
marginRight
:
0
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCategory
,
}
}
},
colStyle
:
{
marginTop
:
20
,
},
},
},
properties
:
{
brandId
:
{
categoryId
:
{
type
:
'string'
,
type
:
'string'
,
"x-component"
:
'SearchSelect'
,
"x-component"
:
'SearchSelect'
,
"x-component-props"
:
{
"x-component-props"
:
{
placeholder
:
'请选择品牌'
,
placeholder
:
'请选择品类'
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectBrand
,
className
:
'fixed-ant-selected-down'
,
// 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
}
fetchSearch
:
PublicApi
.
getProductSelectGetSelectCategory
,
},
}
parentMemberId
:
{
},
type
:
'string'
,
brandId
:
{
enum
:
[],
type
:
'string'
,
'x-component-props'
:
{
"x-component"
:
'SearchSelect'
,
placeholder
:
'上级渠道'
,
"x-component-props"
:
{
placeholder
:
'请选择品牌'
,
fetchSearch
:
PublicApi
.
getProductSelectGetSelectBrand
,
}
},
},
parentMemberId
:
{
},
type
:
'string'
,
submit
:
{
enum
:
[],
"x-component"
:
'Submit'
,
'x-component-props'
:
{
"x-mega-props"
:
{
placeholder
:
'上级渠道'
,
span
:
1
},
},
},
submit
:
{
"x-component-props"
:
{
"x-component"
:
'Submit'
,
children
:
'查询'
"x-mega-props"
:
{
span
:
1
},
"x-component-props"
:
{
children
:
'查询'
}
}
}
}
}
}
}
}
}
}
// type: 'object',
// properties: {
// mageLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// properties: {
// topLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// 'x-component-props': {
// grid: true,
// },
// properties: {
// name: {
// type: 'string',
// 'x-component': 'Search',
// 'x-component-props': {
// placeholder: '商品名称',
// },
// },
// },
// },
// [FORM_FILTER_PATH]: {
// type: 'object',
// 'x-component': 'flex-layout',
// 'x-component-props': {
// rowStyle: {
// flexWrap: 'nowrap',
// justifyContent: 'flex-start'
// },
// colStyle: {
// marginLeft: 20,
// },
// },
// properties: {
// brandId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品牌',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// customerCategoryId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品类',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// parentMemberId: {
// type: 'string',
// enum: [],
// 'x-component-props': {
// placeholder: '上级渠道',
// },
// },
// submit: {
// 'x-component': 'Submit',
// 'x-mega-props': {
// span: 1,
// },
// 'x-component-props': {
// children: '查询',
// },
// },
// },
// },
// },
// },
// },
}
}
\ No newline at end of file
src/pages/transaction/transactionRules/components/RuleSetting.tsx
View file @
b252db73
This diff is collapsed.
Click to expand it.
src/pages/transaction/transactionRules/effects/index.tsx
View file @
b252db73
...
@@ -4,26 +4,11 @@ import { PublicApi } from '@/services/api';
...
@@ -4,26 +4,11 @@ import { PublicApi } from '@/services/api';
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
import
{
useAsyncSelect
}
from
'@/formSchema/effects/useAsyncSelect'
;
const
{
onFieldValueChange$
}
=
FormEffectHooks
const
{
onFieldValueChange$
}
=
FormEffectHooks
export
const
useWarehouseSelect
=
(
context
:
ISchemaFormActions
)
=>
{
export
const
createAddContractTemplateEffect
=
(
context
:
ISchemaFormActions
)
=>
{
onFieldValueChange$
(
'warehouseId'
).
subscribe
(
state
=>
{
const
fetchListContractTemplateAll
=
async
()
=>
{
// 货品ID
const
{
data
}
=
await
PublicApi
.
getOrderSelectListContractTemplate
()
const
goodsId
=
context
.
getFieldValue
(
'productId'
)
context
.
setFieldState
(
'contractTemplateId'
,
state
=>
{
const
warehouseId
=
state
.
value
state
.
contractTemplateLists
=
data
PublicApi
.
getWarehouseInventoryByItemNo
({
warehouseId
,
itemId
:
goodsId
}).
then
(
res
=>
{
const
{
data
}
=
res
context
.
setFieldValue
(
'NO_SUBMIT3'
,
data
.
inventory
)
})
})
}
export
const
createAddRepositoryEffect
=
(
context
:
ISchemaFormActions
)
=>
{
const
fetchWarehouseAll
=
async
()
=>
{
const
{
data
}
=
await
PublicApi
.
getWarehouseWarehouseAll
()
context
.
setFieldState
(
'warehouseId'
,
state
=>
{
state
.
warehouseLists
=
data
})
})
return
data
.
map
(
v
=>
({
return
data
.
map
(
v
=>
({
value
:
v
.
id
,
value
:
v
.
id
,
...
@@ -31,8 +16,7 @@ export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
...
@@ -31,8 +16,7 @@ export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
}))
}))
}
}
useAsyncSelect
(
'warehouseId'
,
fetchWarehouseAll
)
useAsyncSelect
(
'contractTemplateId'
,
fetchListContractTemplateAll
)
useWarehouseSelect
(
context
)
}
}
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
export
const
useUnitPreview
=
(
initValue
,
context
)
=>
{
...
...
src/pages/transaction/transactionRules/index.less
View file @
b252db73
...
@@ -13,43 +13,3 @@
...
@@ -13,43 +13,3 @@
cursor: pointer;
cursor: pointer;
}
}
}
}
// 添加仓位
.storeItemRadio{
display: flex;
flex-wrap: wrap;
// width: 320px;
margin: 0 auto;
& label{
width: 320px !important;
height: 48px !important;
line-height: 48px !important;
margin: 8px 0;
margin-right: 24px;
}
}
//仓位调拨
.circleAmount{
width: 160px;
height: 160px;
border: 4px solid #edeef2;
background-color: #fafbfc;
border-radius: 50%;
& p{
height: 160px;
line-height: 160px;
text-align: center;
font-size: 20px;
font-weight: bold;
}
}
//查看仓位
.amount{
font-size:24px;
font-weight:bold;
color:rgba(23,43,77,1);
}
\ No newline at end of file
src/pages/transaction/transactionRules/schema/index.tsx
View file @
b252db73
This diff is collapsed.
Click to expand it.
src/utils/index.tsx
View file @
b252db73
...
@@ -165,10 +165,15 @@ export function omit(obj: any, arr: string[]) {
...
@@ -165,10 +165,15 @@ export function omit(obj: any, arr: string[]) {
return
tempObj
return
tempObj
}
}
export
const
findItemAndDelete
=
(
arr
:
any
[],
target
)
=>
{
/**
* @param { Object[] } arr 源数据
* @param { any } target 目标值 通常是id等主键
* @param { string } customKey 可选 自定义主键 默认'id'
*/
export
const
findItemAndDelete
=
(
arr
:
any
[],
target
:
any
,
customKey
?:
string
)
=>
{
const
newArr
=
[...
arr
]
const
newArr
=
[...
arr
]
if
(
newArr
.
length
>
0
&&
isObject
(
newArr
[
0
]))
{
if
(
newArr
.
length
>
0
&&
isObject
(
newArr
[
0
]))
{
return
newArr
.
filter
(
v
=>
v
.
id
!==
target
)
return
newArr
.
filter
(
v
=>
v
[
customKey
||
'id'
]
!==
target
)
}
}
const
targetIndex
=
arr
.
indexOf
(
target
)
const
targetIndex
=
arr
.
indexOf
(
target
)
if
(
targetIndex
===
-
1
)
{
if
(
targetIndex
===
-
1
)
{
...
...
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