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
86684447
Commit
86684447
authored
Jan 08, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:处理商品品类同步平台后台弹框关闭后清空对应的弹框数据
parent
7c37b7ac
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
102 additions
and
56 deletions
+102
-56
index.tsx
src/components/TabTree/index.tsx
+33
-7
index.ts
src/constants/index.ts
+1
-1
index.tsx
src/pages/classAndProperty/attribute/index.tsx
+53
-42
index.tsx
src/pages/classAndProperty/class/index.tsx
+14
-5
index.tsx
src/pages/classAndProperty/propertyValue/index.tsx
+1
-1
index.tsx
src/pages/trademark/index.tsx
+0
-0
No files found.
src/components/TabTree/index.tsx
View file @
86684447
...
...
@@ -44,6 +44,8 @@ export interface TabTreeProps extends TreeProps {
handleCheck
?:
(
keys
:
any
,
nodes
:
any
)
=>
{};
customExpandkeys
?:
any
[];
// props 传入自定义展开的key
enableSearch
?:
boolean
;
// 是否可搜索
searchPlaceholder
?:
string
;
// 搜索
resetSearch
?:
boolean
;
}
export
interface
InnermostTreeNodeProps
{}
...
...
@@ -220,7 +222,9 @@ const TabTree: React.FC<TabTreeProps> = props => {
handleCheck
,
customExpandkeys
,
enableSearch
=
false
,
checkStrictly
=
false
searchPlaceholder
=
"搜索"
,
checkStrictly
=
false
,
resetSearch
,
}
=
props
;
const
selfActions
=
useTreeActions
(
actions
)
...
...
@@ -230,7 +234,18 @@ const TabTree: React.FC<TabTreeProps> = props => {
// 当前选中的node
const
[
selectKey
,
setSelectKey
]
=
useState
<
string
|
number
>
(
''
);
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
<
boolean
>
(
false
)
// 自动展开父级
// 自动展开父级
const
[
autoExpandParent
,
setAutoExpandParent
]
=
useState
<
boolean
>
(
false
)
// 搜索的值
const
[
searchValue
,
setSearchValue
]
=
useState
()
useEffect
(()
=>
{
if
(
resetSearch
)
{
setSearchValue
(
null
)
setExpandkeys
([])
}
},
[
resetSearch
])
const
data
=
transformSingleTitle
(
deepClone
(
treeData
),
...
...
@@ -319,10 +334,15 @@ const TabTree: React.FC<TabTreeProps> = props => {
const
onSearchChange
=
v
=>
{
// todo 找到目标节点的父级key
const
reductData
=
Object
.
values
(
treeReduction
(
treeData
))
const
expandedKeys
=
reductData
.
filter
(
item
=>
item
[
'title'
].
indexOf
(
v
)
>
-
1
).
map
(
_item
=>
_item
[
'parentId'
])
setExpandkeys
(
expandedKeys
)
setAutoExpandParent
(
true
)
setSearchValue
(
v
)
if
(
v
)
{
const
reductData
=
Object
.
values
(
treeReduction
(
treeData
))
const
expandedKeys
=
reductData
.
filter
(
item
=>
item
[
'title'
].
indexOf
(
v
)
>
-
1
).
map
(
_item
=>
_item
[
'parentId'
])
setExpandkeys
(
expandedKeys
)
setAutoExpandParent
(
true
)
}
else
{
setExpandkeys
([])
}
}
return
(
...
...
@@ -343,7 +363,13 @@ const TabTree: React.FC<TabTreeProps> = props => {
</
div
>
)
}
{
enableSearch
&&
data
?.
length
>
0
&&
<
Search
style=
{
{
marginBottom
:
8
}
}
placeholder=
"搜索"
onSearch=
{
onSearchChange
}
/>
enableSearch
&&
data
?.
length
>
0
&&
<
Search
style=
{
{
marginBottom
:
8
}
}
placeholder=
{
searchPlaceholder
}
value=
{
searchValue
}
onChange=
{
(
v
:
any
)
=>
setSearchValue
(
v
.
target
.
value
)
}
onSearch=
{
onSearchChange
}
/>
}
<
Tree
className=
"god-tabtree"
...
...
src/constants/index.ts
View file @
86684447
...
...
@@ -1098,7 +1098,7 @@ export const OrderTransformOutWorkStateTexts = {
14
:
'不接受订单'
,
15
:
'确认未到账'
,
16
:
'待新增采购入库单'
,
17
:
'手工确认发货'
17
:
'手工确认发货'
,
}
// 采购订单流转记录内部状态
...
...
src/pages/classAndProperty/attribute/index.tsx
View file @
86684447
import
React
,
{
ReactNode
,
useRef
,
useState
}
from
'react'
import
{
history
}
from
'umi'
import
{
Button
,
Popconfirm
,
Card
,
Modal
,
Tooltip
,
message
}
from
'antd'
import
{
Button
,
Popconfirm
,
Card
,
Modal
,
Tooltip
,
message
,
Space
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
import
{
PlusOutlined
,
...
...
@@ -12,8 +12,15 @@ import {
import
{
StandardTable
}
from
'god'
import
{
ColumnType
}
from
'antd/lib/table/interface'
import
{
PublicApi
}
from
'@/services/api'
import
{
createFormActions
,
Reset
}
from
'@formily/antd'
import
NiceForm
from
'@/components/NiceForm'
// import styles from './index.less'
const
formActions
=
createFormActions
();
const
Attribute
:
React
.
FC
<
{}
>
=
()
=>
{
const
ref
=
useRef
<
any
>
({})
const
syncRef
=
useRef
<
any
>
({})
...
...
@@ -164,6 +171,20 @@ const Attribute: React.FC<{}> = () => {
}
}
const
Actions
=
(
<
Space
>
<
Button
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
history
.
push
(
'/memberCenter/commodityAbility/classAndProperty/attribute/add'
)
}
}
>
新建
</
Button
>
<
span
>
<
Button
type=
"default"
style=
{
{
marginLeft
:
16
}
}
onClick=
{
syncAttribute
}
>
平台属性同步
</
Button
>
<
Tooltip
title=
"同步平台维护的属性,同步时按属性结构进行同步。"
>
<
QuestionCircleOutlined
/>
</
Tooltip
>
</
span
>
</
Space
>
);
return
(
<
PageHeaderWrapper
>
<
Card
>
...
...
@@ -171,58 +192,48 @@ const Attribute: React.FC<{}> = () => {
columns=
{
columns
}
currentRef=
{
ref
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
formilyLayouts=
{
{
justify
:
'space-between'
}
}
formilyProps=
{
{
layouts
:
{
order
:
1
,
span
:
4
},
ctx
:
{
inline
:
false
,
schema
:
{
controlRender=
{
<
NiceForm
actions=
{
formActions
}
expressionScope=
{
{
Actions
,
}
}
effects=
{
(
$
,
actions
)
=>
{
}
}
schema=
{
{
type
:
'object'
,
properties
:
{
megaLayout0
:
{
searchWrap
:
{
type
:
'object'
,
'x-component'
:
'
mega-l
ayout'
,
"x-component-props"
:
{
'x-component'
:
'
Mega-L
ayout'
,
'x-component-props'
:
{
grid
:
true
,
columns
:
1
,
},
properties
:
{
actions
:
{
type
:
'object'
,
'x-component'
:
'Children'
,
'x-component-props'
:
{
children
:
'{{Actions}}'
,
},
},
name
:
{
type
:
'string'
,
'x-component'
:
'Search'
,
'x-component-props'
:
{
placeholder
:
'属性名称'
,
advanced
:
false
,
// tip: '输入 属性名称 进行搜索',
},
'x-component'
:
'Search'
}
}
}
}
}
}
}
}
formilyChilds=
{
{
layouts
:
{
order
:
0
},
children
:
(
<>
<
Button
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
{
history
.
push
(
'/memberCenter/commodityAbility/classAndProperty/attribute/add'
)
}
}
>
新建
</
Button
>
<
span
>
<
Button
type=
"default"
style=
{
{
marginLeft
:
16
}
}
onClick=
{
syncAttribute
}
>
平台属性同步
</
Button
>
<
Tooltip
title=
"同步平台维护的属性,同步时按属性结构进行同步。"
>
<
QuestionCircleOutlined
/>
</
Tooltip
>
</
span
>
</>
)
}
}
},
},
},
},
}
}
onSubmit=
{
values
=>
ref
.
current
.
reload
(
values
)
}
/>
}
/>
<
Modal
title=
"同步平台属性"
...
...
src/pages/classAndProperty/class/index.tsx
View file @
86684447
...
...
@@ -50,6 +50,7 @@ const ClassProperty: React.FC<{}> = () => {
const
[
syncLoading
,
setSyncLoading
]
=
useState
<
boolean
>
(
false
)
const
[
finshLoading
,
setFinshLoading
]
=
useState
<
boolean
>
(
false
)
const
[
deleteLoading
,
setDeleteLoading
]
=
useState
<
boolean
>
(
false
)
const
[
resetSearch
,
setResetSearch
]
=
useState
(
false
)
/* 选择品类树 */
const
{
...
...
@@ -152,6 +153,7 @@ const ClassProperty: React.FC<{}> = () => {
// 同步平台品类
const
asyncClass
=
()
=>
{
setSyncVisible
(
true
)
setResetSearch
(
false
)
}
const
handleSyncOk
=
()
=>
{
...
...
@@ -160,10 +162,9 @@ const ClassProperty: React.FC<{}> = () => {
if
(
syncIds
.
length
)
{
// @ts-ignore
PublicApi
.
postProductCustomerSyncCategory
({
idList
:
syncIds
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
resetMenu
()
syncTreeActions
.
setSelectKeys
([])
}
resetMenu
()
syncTreeActions
.
setSelectKeys
([])
setResetSearch
(
true
)
setSyncVisible
(
false
)
setSyncLoading
(
false
)
})
...
...
@@ -174,13 +175,16 @@ const ClassProperty: React.FC<{}> = () => {
}
const
handleSyncCancel
=
()
=>
{
setResetSearch
(
true
)
setSyncVisible
(
false
)
resetMenu
()
syncTreeActions
.
setSelectKeys
([])
}
const
connectCategory
=
<
div
className=
'connectBtn'
onClick=
{
handleConnectCategroyBtn
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
关联
</
div
>
return
<
PageHeaderWrapper
return
<
PageHeaderWrapper
title=
"品类"
className=
"useConnectBtnWrapper"
>
...
...
@@ -278,6 +282,8 @@ const ClassProperty: React.FC<{}> = () => {
actions=
{
plateformTreeActions
}
customKey="id"
enableSearch=
{
true
}
searchPlaceholder="品类名称"
resetSearch=
{
resetSearch
}
customExpandkeys=
{
customPlateformExpandkeys
}
/
>
</
Modal
>
...
...
@@ -291,6 +297,7 @@ const ClassProperty: React.FC<{}> = () => {
forceRender
getContainer=
'#root'
confirmLoading=
{
syncLoading
}
destroyOnClose=
{
true
}
>
<
TabTree
fetchData
=
{
params
=
>
fetchPlatformTreeData(params)}
...
...
@@ -299,6 +306,8 @@ const ClassProperty: React.FC<{}> = () => {
actions=
{
syncTreeActions
}
customKey="id"
enableSearch
searchPlaceholder="品类名称"
resetSearch=
{
resetSearch
}
customExpandkeys=
{
customPlateformExpandkeys
}
checkable=
{
true
}
/
>
...
...
src/pages/classAndProperty/propertyValue/index.tsx
View file @
86684447
...
...
@@ -240,7 +240,7 @@ const PropertyValue: React.FC<{}> = () => {
// @ts-ignore
PublicApi
.
postProductCustomerSyncAttributeValue
({
idList
:
selectedRowKeys
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
()
ref
?.
current
?
.
reload
()
setSelectedRowKeys
([])
}
setSyncVisible
(
false
)
...
...
src/pages/trademark/index.tsx
View file @
86684447
This diff is collapsed.
Click to expand it.
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