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
shenshaokai
jinfa-platform
Commits
6f6b2e04
Commit
6f6b2e04
authored
Apr 13, 2022
by
Bill
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-material-links' into 'v2-220418'
fix: 修改物料物料组穿梭框父子联动逻辑 See merge request linkseeks-design/pro-platform!262
parents
3529ed15
9bd8090f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
31 deletions
+51
-31
index.ts
config/routes/index.ts
+1
-1
material.ts
src/locales/zh-CN/material.ts
+1
-1
index.tsx
...alAuditProcessConfig/components/formilyTransfer/index.tsx
+49
-29
No files found.
config/routes/index.ts
View file @
6f6b2e04
...
...
@@ -26,7 +26,7 @@ import ProcurementRoute from './procurementRoute'; // todo wuting
// import contracRoute from './contracRoute';
// export const routes = [CommodityRoute, MemberRoute, ShopRoute, ChannelRoute, TranactionRoute, AfterService, PayandSettleRoute, LogisticsRoute, AuthConfigRoute, HandlingRoute, BalaceRoute]
const
isDev
=
process
.
env
.
NODE_ENV
===
"development"
;
const
isDev
=
false
;
const
homeRoute
=
{
path
:
`/memberCenter/home`
,
name
:
'home'
,
...
...
src/locales/zh-CN/material.ts
View file @
6f6b2e04
...
...
@@ -85,7 +85,7 @@ export default {
'material.belong.materialGroup'
:
'所属物料组'
,
'material.remark'
:
'备注'
,
'material.goodsPic.validate.format'
:
'仅支持JPG/PNG/JPEG格式'
,
'material.goodsPic.validate.size'
:
'图片大小小于600KB'
,
'material.goodsPic.validate.size'
:
'图片大小
需要
小于600KB'
,
'material.columns.file'
:
'文件'
,
'material.columns.description'
:
'备注'
,
'material.sourceList.column.memberId'
:
'会员id'
,
...
...
src/pages/commodity/material/materialAuditProcessConfig/components/formilyTransfer/index.tsx
View file @
6f6b2e04
...
...
@@ -85,7 +85,7 @@ const FormilyTransfer: React.FC<Iprops> & { isFieldComponent: boolean } = (props
const
onChecked
=
(
checkedKeys
,
info
)
=>
{
const
{
checked
,
node
}
=
info
;
const
newCheckedKeys
=
[...
checkedKeys
,
node
.
id
];
const
newCheckedKeys
=
checked
?
[...
checkedKeys
,
node
.
id
]
:
[
node
.
id
];
// 从上到下, 联动勾选
for
(
let
i
=
0
;
i
<
levelSet
.
maxLevel
;
i
++
)
{
...
...
@@ -103,38 +103,58 @@ const FormilyTransfer: React.FC<Iprops> & { isFieldComponent: boolean } = (props
})
}
// 从下而上,联动勾选
const
visitedKeys
=
new
Set
();
for
(
let
level
=
levelSet
.
maxLevel
;
level
>=
0
;
level
-=
1
)
{
const
entities
=
levelSet
.
levelMap
.
get
(
level
)
||
new
Set
();
entities
.
forEach
(
entity
=>
{
const
{
parent
,
node
}
=
entity
;
if
(
!
entity
.
parent
||
visitedKeys
.
has
(
entity
.
parent
.
id
))
{
return
;
if
(
checked
)
{
// 从下而上,联动勾选
const
visitedKeys
=
new
Set
();
for
(
let
level
=
levelSet
.
maxLevel
;
level
>=
0
;
level
-=
1
)
{
const
entities
=
levelSet
.
levelMap
.
get
(
level
)
||
new
Set
();
entities
.
forEach
(
entity
=>
{
const
{
parent
,
node
}
=
entity
;
if
(
!
entity
.
parent
||
visitedKeys
.
has
(
entity
.
parent
.
id
))
{
return
;
}
let
allChecked
=
true
;
(
parent
.
children
||
[])
.
forEach
(({
id
})
=>
{
const
checked
=
newCheckedKeys
.
includes
(
id
);
if
(
allChecked
&&
!
checked
)
{
allChecked
=
false
;
}
});
if
(
allChecked
)
{
newCheckedKeys
.
push
(
parent
.
id
);
}
visitedKeys
.
add
(
parent
.
key
);
});
}
}
else
{
// 有向图, 维护队列一直向上找他的父亲节点
const
queue
=
[...
newCheckedKeys
];
const
parentSet
=
new
Set
();
while
(
queue
.
length
>
0
)
{
const
item
=
queue
.
pop
();
if
(
parentSet
.
has
(
item
))
{
continue
;
}
let
allChecked
=
true
;
(
parent
.
children
||
[])
.
forEach
(({
id
})
=>
{
const
checked
=
newCheckedKeys
.
includes
(
id
);
if
(
allChecked
&&
!
checked
)
{
allChecked
=
false
;
}
});
const
current
=
treeNodes
[
item
];
if
(
current
)
{
if
(
allChecked
)
{
newCheckedKeys
.
push
(
parent
.
id
);
parentSet
.
add
(
current
.
id
);
queue
.
push
(
current
.
parentId
);
newCheckedKeys
.
push
(
current
.
parentId
);
}
visitedKeys
.
add
(
parent
.
key
);
});
}
}
console
.
log
(
"newCheckedKeys"
,
newCheckedKeys
);
return
newCheckedKeys
return
Array
.
from
(
new
Set
(
newCheckedKeys
))
}
...
...
@@ -151,7 +171,6 @@ const FormilyTransfer: React.FC<Iprops> & { isFieldComponent: boolean } = (props
{
({
direction
,
onItemSelect
,
selectedKeys
,
onItemSelectAll
})
=>
{
if
(
direction
===
'left'
)
{
const
checkedKeys
=
[...
selectedKeys
,
...
value
];
console
.
log
(
"selectedKeys"
,
selectedKeys
,
checkedKeys
)
const
treeData
=
generateTree
(
dataSource
,
value
||
[])
return
(
<
Tree
...
...
@@ -163,6 +182,7 @@ const FormilyTransfer: React.FC<Iprops> & { isFieldComponent: boolean } = (props
onCheck=
{
(
checkedKeysValue
,
e
)
=>
{
const
isChecked
=
e
.
checked
;
const
newData
=
onChecked
(
checkedKeys
,
e
)
onItemSelectAll
(
newData
,
isChecked
);
}
}
/>
...
...
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