@hzab/group-user-selector 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -31
- package/README.md +13 -3
- package/package.json +9 -4
- package/src/components/ItemRenter/index.jsx +47 -46
- package/src/components/SearchRenter/index.jsx +108 -108
- package/src/index.less +168 -163
- package/src/index.tsx +234 -221
package/CHANGELOG.md
CHANGED
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
# @hzab/group-user-selector@0.0.
|
|
2
|
-
|
|
3
|
-
feat:
|
|
4
|
-
|
|
5
|
-
# @hzab/group-user-selector@0.0.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# @hzab/group-user-selector@0.0.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# @hzab/group-user-selector@0.0.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# @hzab/group-user-selector@0.0.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# @hzab/group-user-selector@0.0.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# @hzab/group-user-selector@0.0.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
# @hzab/group-user-selector@0.0.
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
# @hzab/group-user-selector@0.0.10
|
|
2
|
+
|
|
3
|
+
feat: 搜索情况下默认不展示下级
|
|
4
|
+
|
|
5
|
+
# @hzab/group-user-selector@0.0.9
|
|
6
|
+
|
|
7
|
+
feat: 增加一键清除 API
|
|
8
|
+
|
|
9
|
+
# @hzab/group-user-selector@0.0.8
|
|
10
|
+
|
|
11
|
+
feat: 搜索条件提示词改为传入
|
|
12
|
+
|
|
13
|
+
# @hzab/group-user-selector@0.0.7
|
|
14
|
+
|
|
15
|
+
fix:部门点击下一级时,pageNum 初始化
|
|
16
|
+
|
|
17
|
+
# @hzab/group-user-selector@0.0.6
|
|
18
|
+
|
|
19
|
+
fix:部门分页切换带上部门 id
|
|
20
|
+
|
|
21
|
+
# @hzab/group-user-selector@0.0.5
|
|
22
|
+
|
|
23
|
+
完善请求类型
|
|
24
|
+
|
|
25
|
+
# @hzab/group-user-selector@0.0.4
|
|
26
|
+
|
|
27
|
+
修复分页 bug
|
|
28
|
+
|
|
29
|
+
# @hzab/group-user-selector@0.0.3
|
|
30
|
+
|
|
31
|
+
增加列表自定义分页
|
|
32
|
+
|
|
33
|
+
# @hzab/group-user-selector@0.0.2
|
|
34
|
+
|
|
35
|
+
增加搜索列表自定义分页
|
|
36
|
+
|
|
37
|
+
# @hzab/group-user-selector@0.0.1
|
|
38
|
+
|
|
39
|
+
组件初始化
|
package/README.md
CHANGED
|
@@ -58,17 +58,27 @@ import Demo from "@hzab/group-user-selector";
|
|
|
58
58
|
|
|
59
59
|
- 生成文档:npm run docs
|
|
60
60
|
- 本地运行:npm run dev
|
|
61
|
-
- 打包编译:npm run build
|
|
62
61
|
|
|
63
62
|
## 发布
|
|
64
63
|
|
|
65
|
-
-
|
|
64
|
+
- npm 源和云效源都需要发布
|
|
66
65
|
|
|
67
|
-
- 编译组件:npm run build
|
|
68
66
|
- 命令:npm publish --access public
|
|
69
67
|
- 发布目录:
|
|
70
68
|
- src
|
|
71
69
|
|
|
70
|
+
### nrm
|
|
71
|
+
|
|
72
|
+
- 安装
|
|
73
|
+
npm install -g nrm
|
|
74
|
+
- 增加源
|
|
75
|
+
nrm add aliyun https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
|
|
76
|
+
- 切换源
|
|
77
|
+
nrm use aliyun
|
|
78
|
+
nrm use npm
|
|
79
|
+
- 登录(账号密码在 https://packages.aliyun.com/npm/npm-registry/guide 查看)
|
|
80
|
+
npm login --registry=https://packages.aliyun.com/62046985b3ead41b374a17f7/npm/npm-registry/
|
|
81
|
+
|
|
72
82
|
## 配置
|
|
73
83
|
|
|
74
84
|
### 配置文件
|
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/group-user-selector",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "webpack serve -c ./config/webpack.config.js --env local",
|
|
8
8
|
"build": "webpack -c ./config/webpack.config.js --env production",
|
|
9
|
-
"
|
|
10
|
-
"publish
|
|
11
|
-
"
|
|
9
|
+
"version:alpha": "npm version prerelease --preid=alpha",
|
|
10
|
+
"publish:alpha": "npm publish --tag alpha",
|
|
11
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
12
|
+
"publish:beta": "npm publish --tag beta",
|
|
13
|
+
"version:patch": "npm version patch",
|
|
14
|
+
"version:minior": "npm version minor",
|
|
15
|
+
"version:major": "npm version major",
|
|
16
|
+
"publish:stable": "npm publish --access public",
|
|
12
17
|
"prepare": "husky install",
|
|
13
18
|
"mac-chmod": "chmod +x .husky && chmod +x .husky/pre-commit",
|
|
14
19
|
"docs": "typedoc"
|
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
import { Checkbox } from "antd";
|
|
3
|
-
|
|
4
|
-
import defaultAvatar from "../../assets/imgs/defaultAvatar.png";
|
|
5
|
-
import department from "../../assets/imgs/department.png";
|
|
6
|
-
|
|
7
|
-
import "./index.less";
|
|
8
|
-
|
|
9
|
-
function ItemRenter(props, ref) {
|
|
10
|
-
const {
|
|
11
|
-
labelKey = "label",
|
|
12
|
-
valueKey = "value",
|
|
13
|
-
isUserKey = "isUser",
|
|
14
|
-
imgKey = "img",
|
|
15
|
-
isCheck = false,
|
|
16
|
-
item,
|
|
17
|
-
handleClickItem,
|
|
18
|
-
handleCheckItem
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { Checkbox } from "antd";
|
|
3
|
+
|
|
4
|
+
import defaultAvatar from "../../assets/imgs/defaultAvatar.png";
|
|
5
|
+
import department from "../../assets/imgs/department.png";
|
|
6
|
+
|
|
7
|
+
import "./index.less";
|
|
8
|
+
|
|
9
|
+
function ItemRenter(props, ref) {
|
|
10
|
+
const {
|
|
11
|
+
labelKey = "label",
|
|
12
|
+
valueKey = "value",
|
|
13
|
+
isUserKey = "isUser",
|
|
14
|
+
imgKey = "img",
|
|
15
|
+
isCheck = false,
|
|
16
|
+
item,
|
|
17
|
+
handleClickItem,
|
|
18
|
+
handleCheckItem,
|
|
19
|
+
noNextLevel = false
|
|
20
|
+
} = props;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<div className="group-selection-list-item" key={item[valueKey]}>
|
|
26
|
+
<div className="avatar" onClick={() => handleCheckItem(item)}>
|
|
27
|
+
<Checkbox checked={isCheck} />
|
|
28
|
+
<img src={item[imgKey] ? item[imgKey] : item[isUserKey] ? defaultAvatar : department} />
|
|
29
|
+
<div className="label">{item[labelKey]}</div>
|
|
30
|
+
</div>
|
|
31
|
+
{(item[isUserKey] || noNextLevel) ? null : <div
|
|
32
|
+
className={`next ${isCheck ? "noNext" : ""}`}
|
|
33
|
+
onClick={() => {
|
|
34
|
+
if (isCheck) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
handleClickItem(item);
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
下级
|
|
41
|
+
</div>}
|
|
42
|
+
</div>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default forwardRef(ItemRenter);
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import { useEffect, useState, forwardRef } from "react";
|
|
2
|
-
import { Input, message, Pagination } from "antd";
|
|
3
|
-
|
|
4
|
-
import "./index.less";
|
|
5
|
-
|
|
6
|
-
function SearchRenter(props, ref) {
|
|
7
|
-
const {
|
|
8
|
-
searchModel,
|
|
9
|
-
searchQueryKey = "search",
|
|
10
|
-
searchPlaceholder = "搜索成员",
|
|
11
|
-
hasSearchPagination = true,
|
|
12
|
-
hasSearch = true,
|
|
13
|
-
ItemRenter,
|
|
14
|
-
setLoading = () => {},
|
|
15
|
-
} = props;
|
|
16
|
-
|
|
17
|
-
const [search, setSearch] = useState("");
|
|
18
|
-
const [searchList, setSearchList] = useState([]);
|
|
19
|
-
const [total, setTotal] = useState(0);
|
|
20
|
-
const [pageData, setPageData] = useState(
|
|
21
|
-
hasSearchPagination
|
|
22
|
-
? {
|
|
23
|
-
pageSize: 10,
|
|
24
|
-
pageNum: 1,
|
|
25
|
-
}
|
|
26
|
-
: {},
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const handleSearch = (data) => {
|
|
30
|
-
setLoading && setLoading(true);
|
|
31
|
-
searchModel &&
|
|
32
|
-
searchModel
|
|
33
|
-
.getList({ ...data })
|
|
34
|
-
.then((res) => {
|
|
35
|
-
setSearchList(res?.list || res || []);
|
|
36
|
-
setTotal(res?.pagination?.total || res?.total || 0);
|
|
37
|
-
})
|
|
38
|
-
.catch((err) => {
|
|
39
|
-
message.error(err._message || "未知错误");
|
|
40
|
-
})
|
|
41
|
-
.finally(() => {
|
|
42
|
-
setLoading && setLoading(false);
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const handleChangePage = (pageNum, pageSize) => {
|
|
47
|
-
const pages = {
|
|
48
|
-
pageNum: pageSize !== pageData?.pageSize ? 1 : pageNum,
|
|
49
|
-
pageSize,
|
|
50
|
-
};
|
|
51
|
-
setPageData({
|
|
52
|
-
...pages,
|
|
53
|
-
});
|
|
54
|
-
handleSearch({
|
|
55
|
-
[searchQueryKey]: search,
|
|
56
|
-
...pages,
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const onSearch = (value) => {
|
|
61
|
-
setSearch(value);
|
|
62
|
-
if (!value) {
|
|
63
|
-
setPageData({
|
|
64
|
-
pageSize: 10,
|
|
65
|
-
pageNum: 1,
|
|
66
|
-
});
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const data = {
|
|
70
|
-
pageSize: pageData?.pageSize || 10,
|
|
71
|
-
pageNum: 1,
|
|
72
|
-
};
|
|
73
|
-
setPageData(data);
|
|
74
|
-
handleSearch({
|
|
75
|
-
[searchQueryKey]: value,
|
|
76
|
-
...data,
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<>
|
|
82
|
-
{hasSearch ? <Input.Search onSearch={onSearch} enterButton placeholder={searchPlaceholder} allowClear /> : null}
|
|
83
|
-
{search ? (
|
|
84
|
-
<div className="group-selection-search-view">
|
|
85
|
-
<div className="group-selection-search-list">
|
|
86
|
-
{searchList.map((item, index) => {
|
|
87
|
-
return ItemRenter(item);
|
|
88
|
-
})}
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
{hasSearchPagination ? (
|
|
92
|
-
<div className="group-selection-search-pagination">
|
|
93
|
-
<Pagination
|
|
94
|
-
current={pageData?.pageNum}
|
|
95
|
-
total={total}
|
|
96
|
-
pageSize={pageData?.pageSize}
|
|
97
|
-
onChange={handleChangePage}
|
|
98
|
-
size="small"
|
|
99
|
-
/>
|
|
100
|
-
</div>
|
|
101
|
-
) : null}
|
|
102
|
-
</div>
|
|
103
|
-
) : null}
|
|
104
|
-
</>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export default forwardRef(SearchRenter);
|
|
1
|
+
import { useEffect, useState, forwardRef } from "react";
|
|
2
|
+
import { Input, message, Pagination } from "antd";
|
|
3
|
+
|
|
4
|
+
import "./index.less";
|
|
5
|
+
|
|
6
|
+
function SearchRenter(props, ref) {
|
|
7
|
+
const {
|
|
8
|
+
searchModel,
|
|
9
|
+
searchQueryKey = "search",
|
|
10
|
+
searchPlaceholder = "搜索成员",
|
|
11
|
+
hasSearchPagination = true,
|
|
12
|
+
hasSearch = true,
|
|
13
|
+
ItemRenter,
|
|
14
|
+
setLoading = () => {},
|
|
15
|
+
} = props;
|
|
16
|
+
|
|
17
|
+
const [search, setSearch] = useState("");
|
|
18
|
+
const [searchList, setSearchList] = useState([]);
|
|
19
|
+
const [total, setTotal] = useState(0);
|
|
20
|
+
const [pageData, setPageData] = useState(
|
|
21
|
+
hasSearchPagination
|
|
22
|
+
? {
|
|
23
|
+
pageSize: 10,
|
|
24
|
+
pageNum: 1,
|
|
25
|
+
}
|
|
26
|
+
: {},
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const handleSearch = (data) => {
|
|
30
|
+
setLoading && setLoading(true);
|
|
31
|
+
searchModel &&
|
|
32
|
+
searchModel
|
|
33
|
+
.getList({ ...data })
|
|
34
|
+
.then((res) => {
|
|
35
|
+
setSearchList(res?.list || res || []);
|
|
36
|
+
setTotal(res?.pagination?.total || res?.total || 0);
|
|
37
|
+
})
|
|
38
|
+
.catch((err) => {
|
|
39
|
+
message.error(err._message || "未知错误");
|
|
40
|
+
})
|
|
41
|
+
.finally(() => {
|
|
42
|
+
setLoading && setLoading(false);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const handleChangePage = (pageNum, pageSize) => {
|
|
47
|
+
const pages = {
|
|
48
|
+
pageNum: pageSize !== pageData?.pageSize ? 1 : pageNum,
|
|
49
|
+
pageSize,
|
|
50
|
+
};
|
|
51
|
+
setPageData({
|
|
52
|
+
...pages,
|
|
53
|
+
});
|
|
54
|
+
handleSearch({
|
|
55
|
+
[searchQueryKey]: search,
|
|
56
|
+
...pages,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const onSearch = (value) => {
|
|
61
|
+
setSearch(value);
|
|
62
|
+
if (!value) {
|
|
63
|
+
setPageData({
|
|
64
|
+
pageSize: 10,
|
|
65
|
+
pageNum: 1,
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const data = {
|
|
70
|
+
pageSize: pageData?.pageSize || 10,
|
|
71
|
+
pageNum: 1,
|
|
72
|
+
};
|
|
73
|
+
setPageData(data);
|
|
74
|
+
handleSearch({
|
|
75
|
+
[searchQueryKey]: value,
|
|
76
|
+
...data,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
{hasSearch ? <Input.Search onSearch={onSearch} enterButton placeholder={searchPlaceholder} allowClear /> : null}
|
|
83
|
+
{search ? (
|
|
84
|
+
<div className="group-selection-search-view">
|
|
85
|
+
<div className="group-selection-search-list">
|
|
86
|
+
{searchList.map((item, index) => {
|
|
87
|
+
return ItemRenter(item, true);
|
|
88
|
+
})}
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
{hasSearchPagination ? (
|
|
92
|
+
<div className="group-selection-search-pagination">
|
|
93
|
+
<Pagination
|
|
94
|
+
current={pageData?.pageNum}
|
|
95
|
+
total={total}
|
|
96
|
+
pageSize={pageData?.pageSize}
|
|
97
|
+
onChange={handleChangePage}
|
|
98
|
+
size="small"
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
) : null}
|
|
102
|
+
</div>
|
|
103
|
+
) : null}
|
|
104
|
+
</>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default forwardRef(SearchRenter);
|
package/src/index.less
CHANGED
|
@@ -1,163 +1,168 @@
|
|
|
1
|
-
.group-selection {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 100%;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
display: grid;
|
|
7
|
-
grid-template-columns: 1fr 1fr;
|
|
8
|
-
|
|
9
|
-
.group-selection-loading {
|
|
10
|
-
position: absolute;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
width: 100%;
|
|
14
|
-
height: 100%;
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
background: rgba(255, 255, 255, 0.5);
|
|
19
|
-
z-index: 100;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.group-selection-list {
|
|
23
|
-
box-sizing: border-box;
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
position: relative;
|
|
27
|
-
height: 100%;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
padding: 24px;
|
|
30
|
-
border-right: 1px solid #e8e8e8;
|
|
31
|
-
|
|
32
|
-
// .group-selection-search-view {
|
|
33
|
-
// display: flex;
|
|
34
|
-
// flex-direction: column;
|
|
35
|
-
// box-sizing: border-box;
|
|
36
|
-
// position: absolute;
|
|
37
|
-
// top: 56px;
|
|
38
|
-
// left: 24px;
|
|
39
|
-
// width: calc(100% - 48px);
|
|
40
|
-
// height: calc(100% - 80px);
|
|
41
|
-
// overflow-y: hidden;
|
|
42
|
-
// z-index: 10;
|
|
43
|
-
// background-color: #fff;
|
|
44
|
-
|
|
45
|
-
// .group-selection-search-list {
|
|
46
|
-
// box-sizing: border-box;
|
|
47
|
-
// flex: 1;
|
|
48
|
-
// overflow-y: auto;
|
|
49
|
-
// padding: 24px ;
|
|
50
|
-
|
|
51
|
-
// &::-webkit-scrollbar {
|
|
52
|
-
// display: none;
|
|
53
|
-
// }
|
|
54
|
-
// }
|
|
55
|
-
|
|
56
|
-
// .group-selection-search-pagination {
|
|
57
|
-
// position: absolute;
|
|
58
|
-
// left: 0;
|
|
59
|
-
// bottom: 0;
|
|
60
|
-
// width: 100%;
|
|
61
|
-
// height: 40px;
|
|
62
|
-
// display: flex;
|
|
63
|
-
// align-items: center;
|
|
64
|
-
// justify-content: center;
|
|
65
|
-
// background-color: #fff;
|
|
66
|
-
// }
|
|
67
|
-
// }
|
|
68
|
-
|
|
69
|
-
.group-selection-breadcrumb {
|
|
70
|
-
margin-top: 12px;
|
|
71
|
-
.group-selection-breadcrumb-item {
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.group-selection-list-check {
|
|
77
|
-
margin: 12px 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.group-selection-list-view {
|
|
81
|
-
flex: 1;
|
|
82
|
-
overflow: auto;
|
|
83
|
-
|
|
84
|
-
&::-webkit-scrollbar {
|
|
85
|
-
display: none;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// .group-selection-list-item {
|
|
90
|
-
// display: flex;
|
|
91
|
-
// align-items: center;
|
|
92
|
-
// justify-content: space-between;
|
|
93
|
-
// margin-bottom: 24px;
|
|
94
|
-
|
|
95
|
-
// .avatar {
|
|
96
|
-
// display: flex;
|
|
97
|
-
// align-items: center;
|
|
98
|
-
// cursor: pointer;
|
|
99
|
-
|
|
100
|
-
// img {
|
|
101
|
-
// width: 32px;
|
|
102
|
-
// height: auto;
|
|
103
|
-
// margin: 0 12px;
|
|
104
|
-
// }
|
|
105
|
-
|
|
106
|
-
// .label {
|
|
107
|
-
// font-size: 16px;
|
|
108
|
-
// color: #141414;
|
|
109
|
-
// }
|
|
110
|
-
// }
|
|
111
|
-
|
|
112
|
-
// .next {
|
|
113
|
-
// color: rgb(64, 62, 245);
|
|
114
|
-
// cursor: pointer;
|
|
115
|
-
// flex-shrink: 0;
|
|
116
|
-
// }
|
|
117
|
-
|
|
118
|
-
// .noNext {
|
|
119
|
-
// opacity: 0.5;
|
|
120
|
-
// }
|
|
121
|
-
// }
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.group-selection-detail {
|
|
125
|
-
position: relative;
|
|
126
|
-
height: 100%;
|
|
127
|
-
overflow: auto;
|
|
128
|
-
|
|
129
|
-
&::-webkit-scrollbar {
|
|
130
|
-
display: none;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
1
|
+
.group-selection {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: 1fr 1fr;
|
|
8
|
+
|
|
9
|
+
.group-selection-loading {
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
background: rgba(255, 255, 255, 0.5);
|
|
19
|
+
z-index: 100;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.group-selection-list {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
position: relative;
|
|
27
|
+
height: 100%;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
padding: 24px;
|
|
30
|
+
border-right: 1px solid #e8e8e8;
|
|
31
|
+
|
|
32
|
+
// .group-selection-search-view {
|
|
33
|
+
// display: flex;
|
|
34
|
+
// flex-direction: column;
|
|
35
|
+
// box-sizing: border-box;
|
|
36
|
+
// position: absolute;
|
|
37
|
+
// top: 56px;
|
|
38
|
+
// left: 24px;
|
|
39
|
+
// width: calc(100% - 48px);
|
|
40
|
+
// height: calc(100% - 80px);
|
|
41
|
+
// overflow-y: hidden;
|
|
42
|
+
// z-index: 10;
|
|
43
|
+
// background-color: #fff;
|
|
44
|
+
|
|
45
|
+
// .group-selection-search-list {
|
|
46
|
+
// box-sizing: border-box;
|
|
47
|
+
// flex: 1;
|
|
48
|
+
// overflow-y: auto;
|
|
49
|
+
// padding: 24px ;
|
|
50
|
+
|
|
51
|
+
// &::-webkit-scrollbar {
|
|
52
|
+
// display: none;
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
|
+
|
|
56
|
+
// .group-selection-search-pagination {
|
|
57
|
+
// position: absolute;
|
|
58
|
+
// left: 0;
|
|
59
|
+
// bottom: 0;
|
|
60
|
+
// width: 100%;
|
|
61
|
+
// height: 40px;
|
|
62
|
+
// display: flex;
|
|
63
|
+
// align-items: center;
|
|
64
|
+
// justify-content: center;
|
|
65
|
+
// background-color: #fff;
|
|
66
|
+
// }
|
|
67
|
+
// }
|
|
68
|
+
|
|
69
|
+
.group-selection-breadcrumb {
|
|
70
|
+
margin-top: 12px;
|
|
71
|
+
.group-selection-breadcrumb-item {
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.group-selection-list-check {
|
|
77
|
+
margin: 12px 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.group-selection-list-view {
|
|
81
|
+
flex: 1;
|
|
82
|
+
overflow: auto;
|
|
83
|
+
|
|
84
|
+
&::-webkit-scrollbar {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// .group-selection-list-item {
|
|
90
|
+
// display: flex;
|
|
91
|
+
// align-items: center;
|
|
92
|
+
// justify-content: space-between;
|
|
93
|
+
// margin-bottom: 24px;
|
|
94
|
+
|
|
95
|
+
// .avatar {
|
|
96
|
+
// display: flex;
|
|
97
|
+
// align-items: center;
|
|
98
|
+
// cursor: pointer;
|
|
99
|
+
|
|
100
|
+
// img {
|
|
101
|
+
// width: 32px;
|
|
102
|
+
// height: auto;
|
|
103
|
+
// margin: 0 12px;
|
|
104
|
+
// }
|
|
105
|
+
|
|
106
|
+
// .label {
|
|
107
|
+
// font-size: 16px;
|
|
108
|
+
// color: #141414;
|
|
109
|
+
// }
|
|
110
|
+
// }
|
|
111
|
+
|
|
112
|
+
// .next {
|
|
113
|
+
// color: rgb(64, 62, 245);
|
|
114
|
+
// cursor: pointer;
|
|
115
|
+
// flex-shrink: 0;
|
|
116
|
+
// }
|
|
117
|
+
|
|
118
|
+
// .noNext {
|
|
119
|
+
// opacity: 0.5;
|
|
120
|
+
// }
|
|
121
|
+
// }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.group-selection-detail {
|
|
125
|
+
position: relative;
|
|
126
|
+
height: 100%;
|
|
127
|
+
overflow: auto;
|
|
128
|
+
|
|
129
|
+
&::-webkit-scrollbar {
|
|
130
|
+
display: none;
|
|
131
|
+
}
|
|
132
|
+
.group-selection-detail-title {
|
|
133
|
+
text-align: end;
|
|
134
|
+
color: var(--ant-primary-color);
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.group-selection-detail-list {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
flex-wrap: wrap;
|
|
142
|
+
padding: 24px;
|
|
143
|
+
|
|
144
|
+
.group-selection-detail-item {
|
|
145
|
+
flex-shrink: 0;
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
padding: 4px 8px;
|
|
149
|
+
margin: 0 12px 12px 0;
|
|
150
|
+
color: #e8e8e8;
|
|
151
|
+
border-radius: 8px;
|
|
152
|
+
background-color: aliceblue;
|
|
153
|
+
|
|
154
|
+
img {
|
|
155
|
+
width: 32px;
|
|
156
|
+
height: auto;
|
|
157
|
+
margin-right: 12px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.label {
|
|
161
|
+
font-size: 16px;
|
|
162
|
+
color: #141414;
|
|
163
|
+
margin-right: 12px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -1,221 +1,234 @@
|
|
|
1
|
-
import { useEffect, useState, useImperativeHandle, forwardRef, useReducer, useRef } from "react";
|
|
2
|
-
import { Input, Breadcrumb, Checkbox, message, Spin, Pagination, ConfigProvider } from "antd";
|
|
3
|
-
import zhCN from "antd/es/locale/zh_CN";
|
|
4
|
-
import { CloseCircleFilled, SearchOutlined } from "@ant-design/icons";
|
|
5
|
-
import "moment/locale/zh-cn";
|
|
6
|
-
import _ from "lodash";
|
|
7
|
-
|
|
8
|
-
import defaultAvatar from "./assets/imgs/defaultAvatar.png";
|
|
9
|
-
import department from "./assets/imgs/department.png";
|
|
10
|
-
import SearchRenter from "./components/SearchRenter";
|
|
11
|
-
import ItemRenter from "./components/ItemRenter";
|
|
12
|
-
|
|
13
|
-
import "./index.less";
|
|
14
|
-
|
|
15
|
-
function GroupSelection(props, ref) {
|
|
16
|
-
const {
|
|
17
|
-
model,
|
|
18
|
-
queryKey = "parentId",
|
|
19
|
-
value = [],
|
|
20
|
-
labelKey = "label",
|
|
21
|
-
valueKey = "value",
|
|
22
|
-
isUserKey = "isUser",
|
|
23
|
-
imgKey = "img",
|
|
24
|
-
hasPagination = true,
|
|
25
|
-
modelGetType = "getList",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const [
|
|
35
|
-
const [
|
|
36
|
-
const [
|
|
37
|
-
const [
|
|
38
|
-
const [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
useImperativeHandle
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
return prev
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
1
|
+
import { useEffect, useState, useImperativeHandle, forwardRef, useReducer, useRef } from "react";
|
|
2
|
+
import { Input, Breadcrumb, Checkbox, message, Spin, Pagination, ConfigProvider } from "antd";
|
|
3
|
+
import zhCN from "antd/es/locale/zh_CN";
|
|
4
|
+
import { CloseCircleFilled, SearchOutlined } from "@ant-design/icons";
|
|
5
|
+
import "moment/locale/zh-cn";
|
|
6
|
+
import _ from "lodash";
|
|
7
|
+
|
|
8
|
+
import defaultAvatar from "./assets/imgs/defaultAvatar.png";
|
|
9
|
+
import department from "./assets/imgs/department.png";
|
|
10
|
+
import SearchRenter from "./components/SearchRenter";
|
|
11
|
+
import ItemRenter from "./components/ItemRenter";
|
|
12
|
+
|
|
13
|
+
import "./index.less";
|
|
14
|
+
|
|
15
|
+
function GroupSelection(props, ref) {
|
|
16
|
+
const {
|
|
17
|
+
model,
|
|
18
|
+
queryKey = "parentId",
|
|
19
|
+
value = [],
|
|
20
|
+
labelKey = "label",
|
|
21
|
+
valueKey = "value",
|
|
22
|
+
isUserKey = "isUser",
|
|
23
|
+
imgKey = "img",
|
|
24
|
+
hasPagination = true,
|
|
25
|
+
modelGetType = "getList",
|
|
26
|
+
allowClear = false,
|
|
27
|
+
} = props;
|
|
28
|
+
const [breadcrumb, setBreadcrumb] = useState([
|
|
29
|
+
{
|
|
30
|
+
[labelKey]: "首页",
|
|
31
|
+
[valueKey]: undefined,
|
|
32
|
+
},
|
|
33
|
+
]);
|
|
34
|
+
const [loading, setLoading] = useState(false);
|
|
35
|
+
const [checkAll, setCheckAll] = useState(false);
|
|
36
|
+
const [selectList, setSelectList] = useState([]);
|
|
37
|
+
const [selectedList, setSelectedList] = useState([...value]);
|
|
38
|
+
const [queryValue, setQueryValue] = useState(undefined);
|
|
39
|
+
const [total, setTotal] = useState(0);
|
|
40
|
+
|
|
41
|
+
const pageData = useRef(
|
|
42
|
+
hasPagination
|
|
43
|
+
? {
|
|
44
|
+
pageSize: 10,
|
|
45
|
+
pageNum: 1,
|
|
46
|
+
}
|
|
47
|
+
: {},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// 通过useImperativeHandle定义要抛出的值或方法
|
|
51
|
+
useImperativeHandle(ref, () => ({
|
|
52
|
+
selectedList,
|
|
53
|
+
handleAllowClear,
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
const handleAllowClear = () => {
|
|
57
|
+
setSelectedList([]);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const selectedValues = new Set(selectedList.map((item) => item[valueKey]));
|
|
62
|
+
const isAllSelected = selectList.every((item) => selectedValues.has(item[valueKey]));
|
|
63
|
+
setCheckAll(isAllSelected);
|
|
64
|
+
}, [selectList, selectedList]);
|
|
65
|
+
|
|
66
|
+
const getTreeData = (value?: string | number) => {
|
|
67
|
+
setLoading(true);
|
|
68
|
+
model &&
|
|
69
|
+
model[modelGetType]({ [queryKey]: value, ...pageData.current })
|
|
70
|
+
.then((res) => {
|
|
71
|
+
setSelectList(res?.list || res || []);
|
|
72
|
+
setTotal(res?.pagination?.total || res?.total || 0);
|
|
73
|
+
})
|
|
74
|
+
.catch((err) => {
|
|
75
|
+
message.error(err._message || "未知错误");
|
|
76
|
+
})
|
|
77
|
+
.finally(() => {
|
|
78
|
+
setLoading(false);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
getTreeData();
|
|
84
|
+
}, []);
|
|
85
|
+
|
|
86
|
+
const handleChangePage = (pageNum, pageSize) => {
|
|
87
|
+
const pages = {
|
|
88
|
+
pageNum: pageSize !== pageData.current?.pageSize ? 1 : pageNum,
|
|
89
|
+
pageSize,
|
|
90
|
+
};
|
|
91
|
+
pageData.current = pages;
|
|
92
|
+
|
|
93
|
+
getTreeData(queryValue);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const handleBreadcrumb = (e) => {
|
|
97
|
+
const index = breadcrumb.findIndex((item) => item[valueKey] === e[valueKey]);
|
|
98
|
+
const arr = [...breadcrumb];
|
|
99
|
+
arr.splice(index + 1);
|
|
100
|
+
setBreadcrumb(arr);
|
|
101
|
+
setQueryValue(e[valueKey]);
|
|
102
|
+
getTreeData(e[valueKey]);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const handleClickItem = (item) => {
|
|
106
|
+
const arr = [...breadcrumb];
|
|
107
|
+
arr.push(item);
|
|
108
|
+
setBreadcrumb(arr);
|
|
109
|
+
setQueryValue(item[valueKey]);
|
|
110
|
+
if (hasPagination) {
|
|
111
|
+
pageData.current.pageNum = 1;
|
|
112
|
+
}
|
|
113
|
+
getTreeData(item[valueKey]);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const handleCheckDelete = (item) => {
|
|
117
|
+
setSelectedList(selectedList.filter((i) => i[valueKey] !== item[valueKey]));
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const handleCheckItem = (item) => {
|
|
121
|
+
const is = selectedList.some((i) => i[valueKey] === item[valueKey]);
|
|
122
|
+
if (is) {
|
|
123
|
+
handleCheckDelete(item);
|
|
124
|
+
} else {
|
|
125
|
+
setSelectedList([...selectedList, item]);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const handleCheckAll = (e) => {
|
|
130
|
+
const isChecked = e.target.checked;
|
|
131
|
+
if (isChecked) {
|
|
132
|
+
// 全选:合并 selectList 并去重
|
|
133
|
+
setSelectedList((prev) => {
|
|
134
|
+
const selectedValues = new Set(prev.map((item) => item[valueKey])); // 已选值的 Set
|
|
135
|
+
const newItems = selectList.filter((item) => !selectedValues.has(item[valueKey]));
|
|
136
|
+
return [...prev, ...newItems]; // 合并新项
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
// 取消全选:仅移除 selectList 中的项
|
|
140
|
+
setSelectedList((prev) => {
|
|
141
|
+
const selectValues = new Set(selectList.map((item) => item[valueKey])); // 需移除值的 Set
|
|
142
|
+
return prev.filter((item) => !selectValues.has(item[valueKey])); // 过滤保留其他项
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const handleCheck = (item) => {
|
|
148
|
+
const is = selectedList.some((i) => i[valueKey] === item[valueKey]);
|
|
149
|
+
return is;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const Renter = (item, noNextLevel) => {
|
|
153
|
+
const isCheck = handleCheck(item);
|
|
154
|
+
return (
|
|
155
|
+
<ItemRenter
|
|
156
|
+
{...props}
|
|
157
|
+
item={item}
|
|
158
|
+
isCheck={isCheck}
|
|
159
|
+
handleCheckItem={handleCheckItem}
|
|
160
|
+
handleCheckDelete={handleCheckDelete}
|
|
161
|
+
handleClickItem={handleClickItem}
|
|
162
|
+
noNextLevel={noNextLevel}
|
|
163
|
+
/>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<ConfigProvider locale={zhCN}>
|
|
169
|
+
<div className="group-selection">
|
|
170
|
+
{loading ? (
|
|
171
|
+
<div className="group-selection-loading">
|
|
172
|
+
<Spin tip="Loading..." spinning={loading} />
|
|
173
|
+
</div>
|
|
174
|
+
) : null}
|
|
175
|
+
<div className="group-selection-list">
|
|
176
|
+
<SearchRenter {...props} setLoading={setLoading} ItemRenter={Renter} />
|
|
177
|
+
<Breadcrumb className="group-selection-breadcrumb">
|
|
178
|
+
{breadcrumb.map((item) => {
|
|
179
|
+
return (
|
|
180
|
+
<Breadcrumb.Item
|
|
181
|
+
className="group-selection-breadcrumb-item"
|
|
182
|
+
onClick={() => handleBreadcrumb(item)}
|
|
183
|
+
key={item[valueKey]}
|
|
184
|
+
>
|
|
185
|
+
{item[labelKey]}
|
|
186
|
+
</Breadcrumb.Item>
|
|
187
|
+
);
|
|
188
|
+
})}
|
|
189
|
+
</Breadcrumb>
|
|
190
|
+
<div className="group-selection-list-check">
|
|
191
|
+
<Checkbox onChange={handleCheckAll} checked={checkAll && !!selectList.length} /> 全选
|
|
192
|
+
</div>
|
|
193
|
+
<div className="group-selection-list-view">
|
|
194
|
+
{selectList.map((item, index) => {
|
|
195
|
+
return Renter(item, false);
|
|
196
|
+
})}
|
|
197
|
+
</div>
|
|
198
|
+
{hasPagination ? (
|
|
199
|
+
<div>
|
|
200
|
+
<Pagination
|
|
201
|
+
current={pageData.current?.pageNum}
|
|
202
|
+
total={total}
|
|
203
|
+
pageSize={pageData.current?.pageSize}
|
|
204
|
+
onChange={handleChangePage}
|
|
205
|
+
size="small"
|
|
206
|
+
/>
|
|
207
|
+
</div>
|
|
208
|
+
) : null}
|
|
209
|
+
</div>
|
|
210
|
+
<div className="group-selection-detail">
|
|
211
|
+
{allowClear ? (
|
|
212
|
+
<div className="group-selection-detail-title" onClick={handleAllowClear}>
|
|
213
|
+
清空
|
|
214
|
+
</div>
|
|
215
|
+
) : null}
|
|
216
|
+
|
|
217
|
+
<div className="group-selection-detail-list">
|
|
218
|
+
{selectedList.map((item, index) => {
|
|
219
|
+
return (
|
|
220
|
+
<div className="group-selection-detail-item" key={item[valueKey]}>
|
|
221
|
+
<img src={item[imgKey] ? item[imgKey] : item[isUserKey] ? defaultAvatar : department} />
|
|
222
|
+
<div className="label">{item[labelKey]}</div>
|
|
223
|
+
<CloseCircleFilled style={{ cursor: "pointer" }} onClick={() => handleCheckDelete(item)} />
|
|
224
|
+
</div>
|
|
225
|
+
);
|
|
226
|
+
})}
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
</ConfigProvider>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export default forwardRef(GroupSelection);
|