@titaui/pc 1.7.17 → 1.7.21
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/lib/components/create-okr-modal/index.js +6 -6
- package/lib/components/menus/components/menu-tree/index.css +4 -0
- package/lib/components/nav-top/components/user-own-menu/utils.js +1 -1
- package/lib/components/okr-detail/e-list/images/e-list-empty.png +0 -0
- package/lib/components/okr-detail/e-list/index.css +19 -1
- package/lib/components/okr-detail/e-list/index.js +32 -8
- package/lib/components/okr-detail/e-list/util.js +49 -22
- package/lib/components/select-tags/index.css +53 -39
- package/lib/components/select-tags/index.js +7 -9
- package/lib/components/upvote/index.js +19 -14
- package/lib/index.js +8 -0
- package/lib/utils/bs-global.js +0 -7
- package/package.json +1 -1
- package/src/components/create-okr-modal/index.tsx +6 -6
- package/src/components/menus/components/menu-tree/index.scss +3 -0
- package/src/components/menus/export-modules/manage-menus/index.tsx +1 -1
- package/src/components/nav-top/components/user-own-menu/utils.ts +1 -1
- package/src/components/okr-detail/e-list/images/e-list-empty.png +0 -0
- package/src/components/okr-detail/e-list/index.js +121 -70
- package/src/components/okr-detail/e-list/index.scss +17 -2
- package/src/components/okr-detail/e-list/util.ts +44 -18
- package/src/components/select-tags/index.scss +128 -99
- package/src/components/select-tags/index.tsx +31 -31
- package/src/components/upvote/index.tsx +12 -9
- package/src/index.js +2 -1
- package/src/utils/bs-global.js +0 -10
|
@@ -67,7 +67,7 @@ interface Props {
|
|
|
67
67
|
userInfo?: UserInfoObj;
|
|
68
68
|
onSuccess?: Function;
|
|
69
69
|
onClose?: Function;
|
|
70
|
-
|
|
70
|
+
isHiddenCreatedCard?: boolean;
|
|
71
71
|
handleCreatedClose?:Function;
|
|
72
72
|
visible?: boolean;
|
|
73
73
|
}
|
|
@@ -80,7 +80,7 @@ const initOCheckResult = OCheckTarget.map((item) => {
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
function CreateOkrModal(
|
|
83
|
-
{ initCycle, userInfo, onSuccess,
|
|
83
|
+
{ initCycle, userInfo, onSuccess, isHiddenCreatedCard = false, handleCreatedClose = () => {}, visible = false,onClose = () => {}}: Props,
|
|
84
84
|
ref: Ref<CreateOkrRefObject>
|
|
85
85
|
) {
|
|
86
86
|
const [isVisible, setVisible] = useState(visible);
|
|
@@ -199,7 +199,7 @@ function CreateOkrModal(
|
|
|
199
199
|
setCreatedSuccessInfo(data);
|
|
200
200
|
if (
|
|
201
201
|
!localStorage.getItem(`dontShowValue${userId}`) &&
|
|
202
|
-
!
|
|
202
|
+
!isHiddenCreatedCard &&
|
|
203
203
|
!isApplyTpl
|
|
204
204
|
) {
|
|
205
205
|
setShowCreatedSuccessInfo(true);
|
|
@@ -278,7 +278,7 @@ function CreateOkrModal(
|
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
280
|
hideCreateOkrModal();
|
|
281
|
-
if (onSuccess || !
|
|
281
|
+
if (onSuccess || !isHiddenCreatedCard) {
|
|
282
282
|
// 带上超过创建okr人数的计算值
|
|
283
283
|
const krNum = krDatas.length;
|
|
284
284
|
let krTotalLength = 0;
|
|
@@ -692,7 +692,7 @@ function CreateOkrModal(
|
|
|
692
692
|
</Wrapper>
|
|
693
693
|
</Modal>
|
|
694
694
|
</div>
|
|
695
|
-
{!isApplyTpl && !
|
|
695
|
+
{!isApplyTpl && !isHiddenCreatedCard && showCreatedSuccessInfo ? (
|
|
696
696
|
<CreateSuccessCmpWrapper>
|
|
697
697
|
<CreateSuccessCmp
|
|
698
698
|
tipIndex={tipIndex}
|
|
@@ -705,7 +705,7 @@ function CreateOkrModal(
|
|
|
705
705
|
</CreateSuccessCmpWrapper>
|
|
706
706
|
) : null}
|
|
707
707
|
{/* 如果 isVisible 是 hidden,则因为无法获取到样式截取不到图片导致下载下来白图*/}
|
|
708
|
-
{!isApplyTpl && !
|
|
708
|
+
{!isApplyTpl && !isHiddenCreatedCard && showCreatedSuccessInfo ? (
|
|
709
709
|
<div className="download-dom--hidden">
|
|
710
710
|
<CreateSuccessCmp
|
|
711
711
|
tipIndex={tipIndex}
|
|
Binary file
|
|
@@ -1,104 +1,155 @@
|
|
|
1
|
-
import React, { useState, useEffect } from
|
|
2
|
-
import SearchForm from
|
|
3
|
-
import OkrTree from
|
|
4
|
-
import { getKrsByCondition } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import SearchForm from "./search-form";
|
|
3
|
+
import OkrTree from "../components/okr-tree";
|
|
4
|
+
import { getKrsByCondition } from "../request-apis";
|
|
5
|
+
import {
|
|
6
|
+
formatEListDataToSelectTree,
|
|
7
|
+
formatCondition,
|
|
8
|
+
getIfInitCondition,
|
|
9
|
+
} from "./util";
|
|
10
|
+
import { EListContext } from "../context";
|
|
11
|
+
import PaddingLayout from "../components/padding-layout";
|
|
12
|
+
import Loading from "../loading";
|
|
13
|
+
import { getUserInfo } from "../../../utils/bs-global";
|
|
14
|
+
import ConditionRender from "../../condition-render";
|
|
15
|
+
import EmptyPng from './images/e-list-empty.png';
|
|
16
|
+
import "./index.scss";
|
|
11
17
|
|
|
12
|
-
const preCls =
|
|
18
|
+
const preCls = "okr-detail-e";
|
|
13
19
|
|
|
14
|
-
export default props => {
|
|
20
|
+
export default (props) => {
|
|
15
21
|
const { okrId } = props;
|
|
16
22
|
|
|
17
23
|
const loginUser = getUserInfo().Id;
|
|
18
24
|
const hasCondition = localStorage.getItem(`hasRememberCondition${loginUser}`);
|
|
19
25
|
|
|
20
|
-
const [krList, setKrList] = useState([])
|
|
21
|
-
const [checkedStatus, setCheckedStatus] = useState(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
const [krList, setKrList] = useState([]);
|
|
27
|
+
const [checkedStatus, setCheckedStatus] = useState(
|
|
28
|
+
hasCondition
|
|
29
|
+
? JSON.parse(localStorage.getItem(`okrDrawerECheckedStatus${loginUser}`))
|
|
30
|
+
: []
|
|
31
|
+
);
|
|
32
|
+
const [selectUsers, setSelectUsers] = useState(
|
|
33
|
+
hasCondition
|
|
34
|
+
? JSON.parse(localStorage.getItem(`okrDrawerESelectUsers${loginUser}`))
|
|
35
|
+
: []
|
|
36
|
+
);
|
|
37
|
+
const [selectName, setSelectName] = useState(
|
|
38
|
+
hasCondition
|
|
39
|
+
? localStorage.getItem(`okrDrawerESelectName${loginUser}`)
|
|
40
|
+
: "orderBySystem"
|
|
41
|
+
);
|
|
42
|
+
const [noteOrder, setNoteOrder] = useState(
|
|
43
|
+
hasCondition
|
|
44
|
+
? localStorage.getItem(`okrDrawerENoteOrder${loginUser}`)
|
|
45
|
+
: null
|
|
46
|
+
);
|
|
25
47
|
const [searchKey, setSearchKey] = useState();
|
|
26
48
|
const [oEList, setOEList] = useState([]);
|
|
27
49
|
const [expandedKrEs, setExpandedKrEs] = useState([]);
|
|
28
50
|
const [expandedOEs, setExpandedOEs] = useState([]);
|
|
29
51
|
const [loading, setLoading] = useState(true);
|
|
52
|
+
const [totalDataNum, setTotalDataNum] = useState(0);
|
|
30
53
|
|
|
31
54
|
const getKrEsData = () => {
|
|
32
55
|
setLoading(true);
|
|
33
56
|
getKrsByCondition({
|
|
34
57
|
okrId,
|
|
35
|
-
|
|
58
|
+
"condition": formatCondition({
|
|
36
59
|
okrId,
|
|
37
60
|
noteOrder,
|
|
38
61
|
selectName,
|
|
39
62
|
checkedStatus,
|
|
40
63
|
users: selectUsers,
|
|
41
|
-
|
|
42
|
-
})
|
|
43
|
-
}).then(krs => {
|
|
44
|
-
const formatKrs = formatEListDataToSelectTree(
|
|
45
|
-
|
|
46
|
-
|
|
64
|
+
"keyWord": searchKey,
|
|
65
|
+
}),
|
|
66
|
+
}).then((krs) => {
|
|
67
|
+
const formatKrs = formatEListDataToSelectTree(
|
|
68
|
+
krs,
|
|
69
|
+
okrId,
|
|
70
|
+
getIfInitCondition(selectName, checkedStatus, selectUsers, searchKey)
|
|
71
|
+
);
|
|
72
|
+
const expandedKrEs = (formatKrs.krsEList || []).map((it) => it.key);
|
|
73
|
+
const expandedOEs = (formatKrs.oEList[0] || []).map((it) => it.key);
|
|
47
74
|
setExpandedKrEs(expandedKrEs);
|
|
48
75
|
setExpandedOEs(expandedOEs);
|
|
49
76
|
setKrList(formatKrs.krsEList);
|
|
50
77
|
setOEList(formatKrs.oEList);
|
|
51
78
|
setLoading(false);
|
|
52
|
-
})
|
|
53
|
-
}
|
|
79
|
+
});
|
|
80
|
+
};
|
|
54
81
|
|
|
55
82
|
useEffect(() => {
|
|
56
83
|
getKrEsData();
|
|
57
84
|
}, [noteOrder, searchKey, selectName, checkedStatus, selectUsers]);
|
|
58
85
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const oElistLength = oEList[0] && oEList[0].length || 0;
|
|
88
|
+
setTotalDataNum(krList.length + oElistLength);
|
|
89
|
+
}, [krList, oEList]);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<EListContext.Provider
|
|
93
|
+
value={{
|
|
94
|
+
"refreshEList": getKrEsData,
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
<div className={preCls}>
|
|
98
|
+
<PaddingLayout>
|
|
99
|
+
<SearchForm
|
|
100
|
+
checkedStatus={checkedStatus}
|
|
101
|
+
setCheckedStatus={setCheckedStatus}
|
|
102
|
+
selectName={selectName}
|
|
103
|
+
setSelectName={setSelectName}
|
|
104
|
+
noteOrder={noteOrder}
|
|
105
|
+
setNoteOrder={setNoteOrder}
|
|
106
|
+
setSearchKey={setSearchKey}
|
|
107
|
+
selectUsers={selectUsers}
|
|
108
|
+
setSelectUsers={setSelectUsers}
|
|
109
|
+
okrId={okrId}
|
|
110
|
+
/>
|
|
111
|
+
</PaddingLayout>
|
|
79
112
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
113
|
+
{!loading ? (
|
|
114
|
+
<React.Fragment>
|
|
115
|
+
<ConditionRender condition={totalDataNum !== 0}>
|
|
116
|
+
{krList.map((kr, index) => {
|
|
117
|
+
return (
|
|
118
|
+
<React.Fragment>
|
|
119
|
+
<PaddingLayout padding={`0 32px 0 18px`}>
|
|
120
|
+
<OkrTree data={[kr]} defaultExpandedKeys={expandedKrEs} />
|
|
121
|
+
</PaddingLayout>
|
|
122
|
+
{
|
|
123
|
+
// kr左后一个节点 && 没有 OE 时,不显示横线
|
|
124
|
+
!(index + 1 == krList.length && oEList.length == 0) && (
|
|
125
|
+
<div className="e__divider"></div>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
</React.Fragment>
|
|
129
|
+
);
|
|
130
|
+
})}
|
|
94
131
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
132
|
+
{oEList.map((kr) => {
|
|
133
|
+
return (
|
|
134
|
+
<PaddingLayout padding={`0 32px 0 18px`}>
|
|
135
|
+
<OkrTree data={kr} defaultExpandedKeys={expandedOEs} />
|
|
136
|
+
</PaddingLayout>
|
|
137
|
+
);
|
|
138
|
+
})}
|
|
139
|
+
</ConditionRender>
|
|
140
|
+
<ConditionRender condition={totalDataNum === 0}>
|
|
141
|
+
<div className={`${preCls}__empty`}>
|
|
142
|
+
<img className={`${preCls}__empty-img`} src={EmptyPng}/>
|
|
143
|
+
<span className={`${preCls}__empty-text`}>
|
|
144
|
+
没有搜索到符合条件的E-执行
|
|
145
|
+
</span>
|
|
146
|
+
</div>
|
|
147
|
+
</ConditionRender>
|
|
148
|
+
</React.Fragment>
|
|
149
|
+
) : (
|
|
150
|
+
<Loading type="panel" />
|
|
151
|
+
)}
|
|
152
|
+
</div>
|
|
153
|
+
</EListContext.Provider>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
padding-bottom: 60px;
|
|
3
3
|
.e__divider {
|
|
4
4
|
height: 8px;
|
|
5
|
-
background: #
|
|
5
|
+
background: #f0f2f5;
|
|
6
6
|
margin: 10px 32px;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
&__empty {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
align-items: center;
|
|
12
|
+
padding-top: 117px;
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
&-img {
|
|
15
|
+
width: 128px;
|
|
16
|
+
}
|
|
17
|
+
&-text {
|
|
18
|
+
color: #3f4755;
|
|
19
|
+
line-height: 22px;
|
|
20
|
+
margin-top: 20px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -51,33 +51,52 @@ export const getETreeNode = (tasks, isFirstLevel, createUserId,krUser) => {
|
|
|
51
51
|
})
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export const formatTreeDataToNode = (tree) => {
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
export const formatTreeDataToNode = (tree, isInitCondition) => {
|
|
55
|
+
if(isInitCondition) {
|
|
56
|
+
return tree.map((item, index) => {
|
|
57
|
+
return {
|
|
58
|
+
'key': item.mileStoneId,
|
|
59
|
+
'index': index,
|
|
60
|
+
'title': item.mileStoneId !== 0 ? item.mileStoneName : '目标下的其他执行',
|
|
61
|
+
'nodeType': 'e-kr',
|
|
62
|
+
'isLeaf': false,
|
|
63
|
+
'children': getETreeNode(item.tasks, true, item.createUserId,item.user),
|
|
64
|
+
'data': { ...item },
|
|
65
|
+
'isOTask': item.mileStoneId === 0
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
} else {
|
|
69
|
+
const result: any = [];
|
|
70
|
+
tree.forEach((item, index) => {
|
|
71
|
+
if (item.tasks && item.tasks.length > 0) {
|
|
72
|
+
result.push({
|
|
73
|
+
'key': item.mileStoneId,
|
|
74
|
+
'index': index,
|
|
75
|
+
'title': item.mileStoneId !== 0 ? item.mileStoneName : '目标下的其他执行',
|
|
76
|
+
'nodeType': 'e-kr',
|
|
77
|
+
'isLeaf': false,
|
|
78
|
+
'children': getETreeNode(item.tasks, true, item.createUserId,item.user),
|
|
79
|
+
'data': { ...item },
|
|
80
|
+
'isOTask': item.mileStoneId === 0
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
67
86
|
}
|
|
68
87
|
|
|
69
|
-
export const formatEListDataToSelectTree = (data, workId) => {
|
|
88
|
+
export const formatEListDataToSelectTree = (data, workId, isInitCondition) => {
|
|
70
89
|
const tree = data.map(item => {
|
|
71
90
|
return {
|
|
72
91
|
...item,
|
|
73
92
|
'tasks': toTree(item.tasks)
|
|
74
93
|
}
|
|
75
94
|
})
|
|
76
|
-
const formatKrsTreeDataToNode = formatTreeDataToNode(tree.filter(d => d.mileStoneId !== 0));
|
|
77
|
-
const formatOTreeDataToNode = formatTreeDataToNode(tree.filter(d => d.mileStoneId === 0));
|
|
95
|
+
const formatKrsTreeDataToNode = formatTreeDataToNode(tree.filter(d => d.mileStoneId !== 0), isInitCondition);
|
|
96
|
+
const formatOTreeDataToNode = formatTreeDataToNode(tree.filter(d => d.mileStoneId === 0), isInitCondition);
|
|
78
97
|
const result = {
|
|
79
98
|
'krsEList': formatKrsTreeDataToNode,
|
|
80
|
-
'oEList': formatOTreeDataToNode.length
|
|
99
|
+
'oEList': isInitCondition && formatOTreeDataToNode.length === 0 ? [[{
|
|
81
100
|
'key': 0,
|
|
82
101
|
'index': 0,
|
|
83
102
|
'title': '目标下的其他执行',
|
|
@@ -99,7 +118,7 @@ export const formatEListDataToSelectTree = (data, workId) => {
|
|
|
99
118
|
mileStoneId: 0
|
|
100
119
|
},
|
|
101
120
|
'isOTask': true
|
|
102
|
-
}]]
|
|
121
|
+
}]] : [formatOTreeDataToNode]
|
|
103
122
|
}
|
|
104
123
|
return result;
|
|
105
124
|
}
|
|
@@ -142,4 +161,11 @@ export const formatCondition = ({okrId, noteOrder, selectName, checkedStatus, us
|
|
|
142
161
|
}))
|
|
143
162
|
}
|
|
144
163
|
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const getIfInitCondition = (selectName, checkedStatus, users, keyWord) => {
|
|
167
|
+
if (keyWord || selectName !== 'orderBySystem' || checkedStatus.length !== 0 || users.length !== 0) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
145
171
|
}
|