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
42951395
Commit
42951395
authored
Aug 18, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
5dacf22a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
230 additions
and
160 deletions
+230
-160
CustomInputSearch.tsx
src/components/NiceForm/components/CustomInputSearch.tsx
+0
-34
index.tsx
src/pages/classAndProperty/categoryAttributes/index.tsx
+1
-1
directChannel.tsx
src/pages/commodity/products/directChannel.tsx
+128
-125
channelSchema.tsx
src/pages/commodity/products/schema/channelSchema.tsx
+101
-0
No files found.
src/components/NiceForm/components/CustomInputSearch.tsx
View file @
42951395
...
...
@@ -15,28 +15,11 @@ const { Option } = Select
const
CustomInputSearch
=
props
=>
{
console
.
log
(
props
);
// const [state, setState] = useFieldState({
// filterSearch: false,
// });
const
justifyAlign
=
props
.
props
[
'x-component-props'
].
align
||
'flex-end'
;
// const changeFilterVisible = () => {
// if (state.filterSearch) {
// props.form.reset({
// // 清除FILTER_PARAMS下所有字段
// selector: `*.${FORM_FILTER_PATH}.*`,
// });
// }
// setState({
// filterSearch: !state.filterSearch,
// });
// };
const
[
brandData
,
setBrandData
]
=
useState
<
any
>
([])
const
[
brandValue
,
setBrandValue
]
=
useState
(
undefined
)
const
handleBrandSearch
=
(
value
:
any
)
=>
{
// end value
console
.
log
(
value
,
'handleBrandSearch'
)
if
(
value
)
{
...
...
@@ -49,33 +32,16 @@ const CustomInputSearch = props => {
}
}
return
(
<
Space
size=
{
20
}
style=
{
{
justifyContent
:
justifyAlign
,
width
:
'100%'
}
}
>
<
Select
showSearch=
{
true
}
showArrow=
{
true
}
placeholder=
"品牌"
value=
{
brandValue
}
defaultActiveFirstOption=
{
false
}
filterOption=
{
false
}
onSearch=
{
value
=>
handleBrandSearch
(
value
)
}
onChange=
{
v
=>
props
.
mutators
.
change
(
v
)
}
notFoundContent=
{
null
}
style=
{
{
width
:
'174px'
,
lineHeight
:
'32px'
}
}
{
...
props
.
props
['
x
-
component
-
props
']}
>
{
brandData
.
map
(
d
=>
<
Option
value=
{
d
.
id
}
key=
{
d
.
id
}
>
{
d
.
name
}
</
Option
>)
}
</
Select
>
{
/* <Input.Search
value={props.value || ''}
onChange={e => props.mutators.change(e.target.value)}
onSearch={(_, e) => {
e.preventDefault();
props.form.submit();
}}
{...props.props['x-component-props']}
/> */
}
</
Space
>
);
};
...
...
src/pages/classAndProperty/categoryAttributes/index.tsx
View file @
42951395
...
...
@@ -211,7 +211,7 @@ const CategoryAttributes: React.FC<{}> = () => {
let
_txt
:
string
=
''
if
(
text
===
2
)
{
_txt
=
'多选'
}
else
if
(
text
===
2
)
{
}
else
if
(
text
===
1
)
{
_txt
=
'单选'
}
else
if
(
text
===
3
)
{
_txt
=
'输入'
...
...
src/pages/commodity/products/directChannel.tsx
View file @
42951395
import
React
,
{
useState
,
useEffect
,
useRef
,
ReactNode
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Form
,
Card
,
Modal
,
Select
}
from
'antd'
import
{
Button
,
Form
,
Card
,
Modal
,
Select
,
Row
,
Col
,
Dropdown
,
Input
,
Menu
,
Space
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
PlusOutlined
,
EyeOutlined
,
DownOutlined
,
CaretUpOutlined
,
CaretDownOutlined
,
DeleteOutlined
,
VerticalAlignTopOutlined
,
VerticalAlignBottomOutlined
}
from
'@ant-design/icons'
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
{
IFormFilter
,
IButtonFilter
}
from
'god/dist/src/standard-table/TableController'
;
import
NiceForm
from
'@/components/NiceForm'
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
import
{
createFormActions
,
FormEffectHooks
}
from
'@formily/antd'
import
{
channelSchema
}
from
'./schema/channelSchema'
// 定义选择的行数据的类型
interface
Item
{
key
:
string
;
id
:
string
;
role
:
string
;
specification
:
string
;
type
:
string
;
...
...
@@ -25,7 +36,7 @@ interface Item {
const
data
=
[
{
key
:
'1'
,
id
:
'1'
,
role
:
'百达翡丽'
,
type
:
'小羊皮'
,
brand
:
'YSL'
,
...
...
@@ -37,7 +48,7 @@ const data = [
status
:
'0'
},
{
key
:
'2'
,
id
:
'2'
,
role
:
'万宝卡'
,
type
:
'小瓜皮'
,
brand
:
'MAC'
,
...
...
@@ -49,7 +60,7 @@ const data = [
status
:
'1'
},
{
key
:
'3'
,
id
:
'3'
,
role
:
'小宝SOD蜜'
,
type
:
'洗护一体'
,
brand
:
'AOC'
,
...
...
@@ -65,7 +76,7 @@ const data = [
// 模拟请求
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
queryResult
=
data
.
find
(
v
=>
v
.
key
===
params
.
keywords
)
const
queryResult
=
data
.
find
(
v
=>
v
.
id
===
params
.
keywords
)
setTimeout
(()
=>
{
resolve
({
code
:
200
,
...
...
@@ -76,8 +87,10 @@ const fetchData = (params:any) => {
})
}
const
formActions
=
createFormActions
();
const
DirectChannel
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
({})
const
ref
=
useRef
<
any
>
({})
const
[
selectRow
,
setSelectRow
]
=
useState
<
Item
[]
>
([])
// 模态框选择的行数据
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
Array
<
string
>>
([])
const
[
deleteBatchModal
,
setDeleteBatchModal
]
=
useState
(
false
)
...
...
@@ -87,9 +100,9 @@ const DirectChannel: React.FC<{}> = () => {
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'
key
'
,
dataIndex
:
'
id
'
,
align
:
'center'
,
key
:
'
key
'
,
key
:
'
id
'
,
},
{
title
:
'商品名称'
,
...
...
@@ -174,103 +187,26 @@ const DirectChannel: React.FC<{}> = () => {
}
];
const
search
:
IFormFilter
[]
=
[
{
type
:
'Input'
,
value
:
'keywords'
,
col
:
4
,
placeHolder
:
'商品ID'
},
{
type
:
'Input'
,
value
:
'name'
,
col
:
4
,
placeHolder
:
'商品名称'
},
{
type
:
'Input'
,
value
:
'brand'
,
col
:
4
,
placeHolder
:
'商品品牌'
},
{
type
:
'Input'
,
value
:
'type'
,
col
:
4
,
placeHolder
:
'商品品类'
},
{
type
:
'RangePicker'
,
// ... 此处应为数值型范围输入控件
value
:
'price'
,
col
:
4
,
placeHolder
:
'商品价格'
},
{
type
:
'Select'
,
value
:
'status'
,
col
:
4
,
placeHolder
:
'商品状态'
,
statusList
:
[{
type
:
'Select'
,
label
:
'还不错'
,
value
:
'1'
},{
type
:
'Select'
,
label
:
'还可以'
,
value
:
'2'
}]
},
]
const
handleBatchUp
=
()
=>
{
console
.
log
(
'批量上架'
)
setUpDownModal
(
true
)
setIsUp
(
1
)
}
const
searchBarActions
:
IButtonFilter
[]
=
[
{
text
:
'查询'
,
handler
:
()
=>
{
console
.
log
(
'查询'
)
}
},
{
text
:
'重置'
,
handler
:
()
=>
{
console
.
log
(
'重置'
)
}
},
{
type
:
'primary'
,
text
:
'新建'
,
icon
:
<
PlusOutlined
/>,
handler
:
()
=>
{
history
.
push
(
'/commodity/products/addDirectChannel'
)
}
},
{
text
:
'批量删除'
,
handler
:
()
=>
{
setDeleteBatchModal
(
true
)
console
.
log
(
'删除'
)
}
},
{
text
:
'批量上架'
,
handler
:
()
=>
{
console
.
log
(
'批量上架'
)
setUpDownModal
(
true
)
setIsUp
(
1
)
}
},
{
text
:
'批量下架'
,
handler
:
()
=>
{
console
.
log
(
'批量下架'
)
setUpDownModal
(
true
)
setIsUp
(
0
)
}
},
]
const
handleBatchDown
=
()
=>
{
console
.
log
(
'批量下架'
)
setUpDownModal
(
true
)
setIsUp
(
0
)
}
const
handleBatchDelete
=
()
=>
{
setDeleteBatchModal
(
true
)
console
.
log
(
'删除'
)
}
const
handleSee
=
(
record
:
any
)
=>
{
console
.
log
(
'see'
)
history
.
push
(
`/commodity/products/viewDirectChannel?id=
${
record
.
key
}
`
)
history
.
push
(
`/
memberCenter/commodityAbility/
commodity/products/viewDirectChannel?id=
${
record
.
key
}
`
)
}
const
confirm
=
()
=>
{
...
...
@@ -310,14 +246,56 @@ const DirectChannel: React.FC<{}> = () => {
setUpDownModal
(
true
)
}
const
handleUp
=
()
=>
{
const
handleUp
Down
=
()
=>
{
console
.
log
(
'ok上下架'
)
}
const
handleCancelUp
=
()
=>
{
const
handleCancelUpDown
=
()
=>
{
console
.
log
(
'不ok上下架'
)
setUpDownModal
(
false
)
}
const
handleMenuClick
=
(
param
)
=>
{
// param: 1.批量删除 2.批量上架 3.批量下架
console
.
log
(
param
,
'Click Menu'
)
if
(
param
.
key
===
'1'
){
handleBatchDelete
()
}
else
if
(
param
.
key
===
'2'
){
handleBatchUp
()
}
else
if
(
param
.
key
===
'3'
){
handleBatchDown
()
}
}
const
menuMore
=
(
<
Menu
onClick=
{
(
param
)
=>
handleMenuClick
(
param
)
}
>
<
Menu
.
Item
key=
"2"
icon=
{
<
VerticalAlignTopOutlined
/>
}
>
批量上架
</
Menu
.
Item
>
<
Menu
.
Item
key=
"3"
icon=
{
<
VerticalAlignBottomOutlined
/>
}
>
批量下架
</
Menu
.
Item
>
<
Menu
.
Item
key=
"1"
icon=
{
<
DeleteOutlined
/>
}
>
批量删除
</
Menu
.
Item
>
</
Menu
>
)
const
controllerBtns
=
(
<
Space
>
<
Button
type=
'primary'
onClick=
{
()
=>
history
.
push
(
'/memberCenter/commodityAbility/commodity/products/addDirectChannel'
)
}
>
<
PlusOutlined
/>
新建
</
Button
>
<
Dropdown
overlay=
{
menuMore
}
trigger=
{
[
'click'
]
}
>
<
Button
>
更多
<
DownOutlined
/>
</
Button
>
</
Dropdown
>
</
Space
>
);
return
(
<
PageHeaderWrapper
>
<
Card
>
...
...
@@ -326,34 +304,59 @@ const DirectChannel: React.FC<{}> = () => {
currentRef=
{
ref
}
rowSelection=
{
rowSelection
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
formFilters=
{
search
}
buttonFilters=
{
searchBarActions
}
tableProps=
{
{
rowKey
:
"id"
}
}
controlRender=
{
<
NiceForm
actions=
{
formActions
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
expressionScope=
{
{
controllerBtns
,
}
}
effects=
{
(
$
,
actions
)
=>
{
useStateFilterSearchLinkageEffect
(
$
,
actions
,
'name'
,
FORM_FILTER_PATH
,
);
FormEffectHooks
.
onFieldValueChange$
(
'brandId'
).
subscribe
(
state
=>
{
console
.
log
(
state
,
'state'
)
})
// useAsyncInitSelect(
// ['memberType', 'roleId', 'level', 'source'],
// fetchSearchItems,
// );
}
}
schema=
{
channelSchema
}
/>
}
/>
</
Card
>
<
Modal
title=
"批量删除"
visible=
{
deleteBatchModal
}
onOk=
{
handleOkDeleteBatch
}
onCancel=
{
handleCancelDelete
}
okButtonProps=
{
{
danger
:
true
}
}
>
<
Form
layout=
"vertical"
>
<
Form
.
Item
label=
"选择要删除的批次"
>
<
Select
placeholder=
"请选择批次号"
>
<
Select
.
Option
value=
"542424"
>
4245242452
</
Select
.
Option
>
</
Select
>
</
Form
.
Item
>
</
Form
>
title=
"批量删除"
visible=
{
deleteBatchModal
}
onOk=
{
handleOkDeleteBatch
}
onCancel=
{
handleCancelDelete
}
okButtonProps=
{
{
danger
:
true
}
}
>
<
Form
layout=
"vertical"
>
<
Form
.
Item
label=
"选择要删除的批次"
>
<
Select
placeholder=
"请选择批次号"
>
<
Select
.
Option
value=
"542424"
>
4245242452
</
Select
.
Option
>
</
Select
>
</
Form
.
Item
>
</
Form
>
</
Modal
>
<
Modal
title=
{
isUp
?
'批量上架'
:
'批量下架'
}
visible=
{
upDownModal
}
onOk=
{
handleUp
}
onCancel=
{
handleCancelUp
}
onOk=
{
handleUp
Down
}
onCancel=
{
handleCancelUp
Down
}
>
<
h1
>
批量上下架
</
h1
>
<
h1
>
批量上下架
</
h1
>
</
Modal
>
</
PageHeaderWrapper
>
)
...
...
src/pages/commodity/products/schema/channelSchema.tsx
0 → 100644
View file @
42951395
import
{
ISchema
}
from
'@formily/antd'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
export
const
channelSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
mageLayout
:
{
type
:
'object'
,
'x-component'
:
'mega-layout'
,
properties
:
{
topLayout
:
{
type
:
'object'
,
'x-component'
:
'mega-layout'
,
'x-component-props'
:
{
grid
:
true
,
},
properties
:
{
ctl
:
{
type
:
'object'
,
'x-component'
:
'Children'
,
'x-component-props'
:
{
children
:
'{{controllerBtns}}'
,
},
},
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'
,
},
colStyle
:
{
marginLeft
:
20
,
},
},
properties
:
{
id
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'商品ID'
},
},
brandId
:
{
type
:
'string'
,
'x-component'
:
'CustomInputSearch'
,
'x-component-props'
:
{
placeholder
:
'商品品牌'
,
showSearch
:
true
,
showArrow
:
true
,
defaultActiveFirstOption
:
false
,
filterOption
:
false
,
notFoundContent
:
null
,
style
:
{
width
:
'174px'
,
lineHeight
:
'32px'
},
},
},
customerCategoryId
:
{
type
:
'string'
,
enum
:
[],
'x-component-props'
:
{
placeholder
:
'商品品类'
,
},
},
status
:
{
type
:
'string'
,
enum
:
[],
'x-component-props'
:
{
placeholder
:
'商品状态'
},
},
price
:
{
type
:
'string'
,
'x-component-props'
:
{
placeholder
:
'商品价格'
},
},
submit
:
{
'x-component'
:
'Submit'
,
'x-mega-props'
:
{
span
:
1
,
},
'x-component-props'
:
{
children
:
'查询'
,
},
},
},
},
},
},
},
};
\ No newline at end of file
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