@titaui/pc 1.9.86 → 1.9.90
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/.eslintrc.js +1 -1
- package/lib/components/change-okr-modal/Item.js +120 -90
- package/lib/components/menus/export-modules/demo-menus/index.js +125 -0
- package/lib/components/menus/export-modules/demo-menus/menu-highlight.js +74 -0
- package/lib/components/menus/export-modules/demo-menus/menus.js +147 -0
- package/lib/components/menus/index.js +15 -6
- package/lib/components/nav-top/constant.js +26 -2
- package/lib/components/nav-top/index.js +32 -30
- package/lib/components/nav-top/request.apis.js +5 -5
- package/lib/components/nav-top/utils.js +20 -3
- package/lib/components/okr-period-selector/select-cycle.js +7 -0
- package/lib/index.js +14 -6
- package/lib/pages/demo-free/index.js +27 -0
- package/lib/pages/new-okr-list/init-cycle-setting.js +4 -2
- package/lib/pages/new-okr-list/request-api.js +32 -57
- package/package.json +1 -1
- package/src/components/change-okr-modal/Item.tsx +84 -45
- package/src/components/menus/export-modules/demo-menus/index.tsx +80 -0
- package/src/components/menus/export-modules/demo-menus/menu-highlight.ts +53 -0
- package/src/components/menus/export-modules/demo-menus/menus.tsx +136 -0
- package/src/components/menus/index.tsx +9 -5
- package/src/components/nav-top/constant.ts +24 -0
- package/src/components/nav-top/index.tsx +10 -9
- package/src/components/nav-top/request.apis.ts +5 -5
- package/src/components/nav-top/utils.ts +15 -2
- package/src/components/okr-period-selector/select-cycle.tsx +5 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +2 -1
- package/src/pages/demo-free/index.tsx +15 -0
- package/src/pages/new-okr-list/init-cycle-setting.tsx +10 -7
- package/src/pages/new-okr-list/request-api.ts +11 -11
|
@@ -26,9 +26,41 @@ const colorMap = {
|
|
|
26
26
|
4: "12,192,201",
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
const formatKeywordsFunc = (str: string, key: string) => {
|
|
30
|
+
const reg = new RegExp(`(${key})`, "g");
|
|
31
|
+
const newstr = str.replace(reg, `<span style="color: #2879ff;">${key}</span>`);
|
|
32
|
+
return newstr;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const unFormatKeywordsFunc = (str: string, key: string) => {
|
|
36
|
+
const regExpKey = `<span style="color: #2879ff;">${key}</span>`;
|
|
37
|
+
const reg = new RegExp(`(${regExpKey})`, "g");
|
|
38
|
+
const newstr = str.replace(reg, key);
|
|
39
|
+
return newstr;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const htmlToText = (text) => {
|
|
43
|
+
const div = document.createElement("div");
|
|
44
|
+
div.innerHTML = text;
|
|
45
|
+
const newtext = div.innerText || div.textContent;
|
|
46
|
+
return newtext;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const dealOkrData = (data: OkrData, keyWords: string) => {
|
|
50
|
+
const newData = data;
|
|
51
|
+
if (keyWords) {
|
|
52
|
+
newData.workName = formatKeywordsFunc(data.workName, keyWords);
|
|
53
|
+
newData.Krs = newData.Krs.map((item) => ({
|
|
54
|
+
...item,
|
|
55
|
+
mileStoneName: formatKeywordsFunc(item.mileStoneName, keyWords),
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
29
60
|
export default class Item extends PureComponent<Props, State> {
|
|
30
61
|
// @ts-ignore
|
|
31
62
|
isObjectiveRelevanceKr: boolean = window.BSGlobal.OkrAdvancedSetting.KRSetting.ObjectiveRelevanceKr;
|
|
63
|
+
// const {data,keywords} = props
|
|
32
64
|
|
|
33
65
|
constructor(props: Props) {
|
|
34
66
|
super(props);
|
|
@@ -45,19 +77,19 @@ export default class Item extends PureComponent<Props, State> {
|
|
|
45
77
|
this.isExtend();
|
|
46
78
|
}
|
|
47
79
|
|
|
48
|
-
onSelect = (e: any,
|
|
80
|
+
onSelect = (e: any, pdata: any) => {
|
|
49
81
|
e.stopPropagation();
|
|
50
82
|
e.nativeEvent.stopImmediatePropagation();
|
|
51
|
-
const { keywords } = this.props;
|
|
52
|
-
const unFormatData = { ...
|
|
83
|
+
const { keywords, onSelect, data } = this.props;
|
|
84
|
+
const unFormatData = { ...pdata };
|
|
53
85
|
if (keywords) {
|
|
54
86
|
if (unFormatData.workName) {
|
|
55
|
-
unFormatData.workName =
|
|
87
|
+
unFormatData.workName = unFormatKeywordsFunc(unFormatData.workName, keywords);
|
|
56
88
|
} else {
|
|
57
|
-
unFormatData.mileStoneName =
|
|
89
|
+
unFormatData.mileStoneName = unFormatKeywordsFunc(unFormatData.mileStoneName, keywords);
|
|
58
90
|
}
|
|
59
91
|
}
|
|
60
|
-
|
|
92
|
+
onSelect({ selectData: unFormatData, okrInfo: data });
|
|
61
93
|
};
|
|
62
94
|
|
|
63
95
|
// 判断是否展开KR
|
|
@@ -72,13 +104,6 @@ export default class Item extends PureComponent<Props, State> {
|
|
|
72
104
|
}
|
|
73
105
|
};
|
|
74
106
|
|
|
75
|
-
htmlToText = (text) => {
|
|
76
|
-
const div = document.createElement("div");
|
|
77
|
-
div.innerHTML = text;
|
|
78
|
-
const newtext = div.innerText || div.textContent;
|
|
79
|
-
return newtext;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
107
|
getCycleText = () => {
|
|
83
108
|
const { data } = this.props;
|
|
84
109
|
const hzNum = [
|
|
@@ -97,35 +122,48 @@ export default class Item extends PureComponent<Props, State> {
|
|
|
97
122
|
}
|
|
98
123
|
};
|
|
99
124
|
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
item.
|
|
125
|
+
renderItemKr = () => {
|
|
126
|
+
const {
|
|
127
|
+
data, active, isShowKr, keywords,
|
|
128
|
+
} = this.props;
|
|
129
|
+
const okrData: any = dealOkrData(data, keywords);
|
|
130
|
+
if (okrData.Krs.length > 0) {
|
|
131
|
+
return okrData.Krs.map((item: any, index: number) => {
|
|
132
|
+
if (this.isObjectiveRelevanceKr) {
|
|
133
|
+
return (
|
|
134
|
+
<ItemTop key={item.mileStoneId}>
|
|
135
|
+
<Radio onClick={(e: any) => this.onSelect(e, data.Krs[index])} active={active && item.mileStoneId === (active.workId || active.mileStoneId)} />
|
|
136
|
+
<WorkNameWrapper isShowKr={isShowKr}>
|
|
137
|
+
<Tooltip placement="top" overlay={htmlToText(item.mileStoneName)}>
|
|
138
|
+
<OkrName isKr isShowKr={isShowKr} dangerouslySetInnerHTML={{ __html: `KR${index + 1}:${item.mileStoneName}` }} />
|
|
139
|
+
</Tooltip>
|
|
140
|
+
</WorkNameWrapper>
|
|
141
|
+
</ItemTop>
|
|
142
|
+
);
|
|
143
|
+
} if (active && item.mileStoneId === (active.workId || active.mileStoneId)) {
|
|
144
|
+
return (
|
|
145
|
+
<ItemTop key={item.mileStoneId}>
|
|
146
|
+
<Radio onClick={(e: any) => this.onSelect(e, data.Krs[index])} active={active && item.mileStoneId === (active.workId || active.mileStoneId)} />
|
|
147
|
+
<WorkNameWrapper isShowKr={isShowKr}>
|
|
148
|
+
<Tooltip placement="top" overlay={htmlToText(item.mileStoneName)}>
|
|
149
|
+
<OkrName isKr isShowKr={isShowKr} dangerouslySetInnerHTML={{ __html: `KR${index + 1}:${item.mileStoneName}` }} />
|
|
150
|
+
</Tooltip>
|
|
151
|
+
</WorkNameWrapper>
|
|
152
|
+
</ItemTop>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
return "";
|
|
119
156
|
});
|
|
120
157
|
}
|
|
121
|
-
return
|
|
158
|
+
return <span />;
|
|
122
159
|
};
|
|
123
160
|
|
|
124
|
-
okrData: any = this.dealOkrData(this.props.data, this.props.keywords);
|
|
125
|
-
|
|
126
161
|
render() {
|
|
127
|
-
const {
|
|
162
|
+
const {
|
|
163
|
+
data, active, isShowKr, keywords,
|
|
164
|
+
} = this.props;
|
|
128
165
|
const { isExpand } = this.state;
|
|
166
|
+
const okrData: any = dealOkrData(data, keywords);
|
|
129
167
|
return (
|
|
130
168
|
<ItemWrapper>
|
|
131
169
|
<ItemObjectiveContainer onClick={() => this.setState({ isExpand: !isExpand })}>
|
|
@@ -133,11 +171,11 @@ export default class Item extends PureComponent<Props, State> {
|
|
|
133
171
|
<Radio onClick={(e: any) => this.onSelect(e, data)} active={active && data.workId === active.workId} />
|
|
134
172
|
<Tag color={colorMap[data.cycleType] || colorMap[4]}>{this.getCycleText()}</Tag>
|
|
135
173
|
<WorkNameWrapper isShowKr={isShowKr}>
|
|
136
|
-
<Tooltip placement="top" overlay={
|
|
137
|
-
<OkrName isKr={false} isShowKr={isShowKr} dangerouslySetInnerHTML={{ __html:
|
|
174
|
+
<Tooltip placement="top" overlay={htmlToText(okrData.workName)}>
|
|
175
|
+
<OkrName isKr={false} isShowKr={isShowKr} dangerouslySetInnerHTML={{ __html: okrData.workName }} />
|
|
138
176
|
</Tooltip>
|
|
139
177
|
</WorkNameWrapper>
|
|
140
|
-
{this.isObjectiveRelevanceKr && isShowKr && data.Krs.length > 0 && <span className={`${
|
|
178
|
+
{this.isObjectiveRelevanceKr && isShowKr && data.Krs.length > 0 && <span className={`${isExpand ? "tu-icon-arrow-up" : "tu-icon-arrow-down"}`} />}
|
|
141
179
|
</ItemTop>
|
|
142
180
|
<ItemBottom>
|
|
143
181
|
{
|
|
@@ -162,14 +200,14 @@ export default class Item extends PureComponent<Props, State> {
|
|
|
162
200
|
</ItemBottom>
|
|
163
201
|
</ItemObjectiveContainer>
|
|
164
202
|
{
|
|
165
|
-
isShowKr && (this.isObjectiveRelevanceKr || (!this.isObjectiveRelevanceKr &&
|
|
203
|
+
isShowKr && (this.isObjectiveRelevanceKr || (!this.isObjectiveRelevanceKr && okrData.hasSub)) && (
|
|
166
204
|
<ItemKrContainer className={`${isExpand ? "slideIn" : "slideOut"}`}>
|
|
167
|
-
{
|
|
168
|
-
|
|
205
|
+
{/* {
|
|
206
|
+
okrData.Krs.length > 0 && okrData.Krs.map((item: any, index: number) => (this.isObjectiveRelevanceKr ? (
|
|
169
207
|
<ItemTop key={item.mileStoneId}>
|
|
170
208
|
<Radio onClick={(e: any) => this.onSelect(e, data.Krs[index])} active={active && item.mileStoneId === (active.workId || active.mileStoneId)} />
|
|
171
209
|
<WorkNameWrapper isShowKr={isShowKr}>
|
|
172
|
-
<Tooltip placement="top" overlay={
|
|
210
|
+
<Tooltip placement="top" overlay={htmlToText(item.mileStoneName)}>
|
|
173
211
|
<OkrName isKr isShowKr={isShowKr} dangerouslySetInnerHTML={{ __html: `KR${index + 1}:${item.mileStoneName}` }} />
|
|
174
212
|
</Tooltip>
|
|
175
213
|
</WorkNameWrapper>
|
|
@@ -178,13 +216,14 @@ export default class Item extends PureComponent<Props, State> {
|
|
|
178
216
|
<ItemTop key={item.mileStoneId}>
|
|
179
217
|
<Radio onClick={(e: any) => this.onSelect(e, data.Krs[index])} active={active && item.mileStoneId === (active.workId || active.mileStoneId)} />
|
|
180
218
|
<WorkNameWrapper isShowKr={isShowKr}>
|
|
181
|
-
<Tooltip placement="top" overlay={
|
|
219
|
+
<Tooltip placement="top" overlay={htmlToText(item.mileStoneName)}>
|
|
182
220
|
<OkrName isKr isShowKr={isShowKr} dangerouslySetInnerHTML={{ __html: `KR${index + 1}:${item.mileStoneName}` }} />
|
|
183
221
|
</Tooltip>
|
|
184
222
|
</WorkNameWrapper>
|
|
185
223
|
</ItemTop>
|
|
186
224
|
) : ""))
|
|
187
|
-
}
|
|
225
|
+
} */}
|
|
226
|
+
{this.renderItemKr()}
|
|
188
227
|
</ItemKrContainer>
|
|
189
228
|
)
|
|
190
229
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { withRouter } from "react-router";
|
|
4
|
+
// import { ResizeObserver } from '@juggle/resize-observer';
|
|
5
|
+
// import ResizeObserver from "resize-observer-polyfill";
|
|
6
|
+
import FlipCard, { flipRefIns } from "../../components/flip-menu-card";
|
|
7
|
+
import MenuTree from "../../components/menu-tree";
|
|
8
|
+
import Scrollbar from "../../../scrollbar";
|
|
9
|
+
import DemoMenuData, { DemoMenusInt, defaultRefObject } from "./menus";
|
|
10
|
+
import MenuHighlight from "./menu-highlight";
|
|
11
|
+
import preCls from "../../precls";
|
|
12
|
+
import { isEn } from "../../../../utils/getLocale";
|
|
13
|
+
|
|
14
|
+
interface DemoMenusProps {
|
|
15
|
+
onSelect: (node: any) => void;
|
|
16
|
+
history: any;
|
|
17
|
+
}
|
|
18
|
+
const DemoMenus: React.FC<DemoMenusProps> = (props) => {
|
|
19
|
+
const { onSelect = () => { }, history } = props;
|
|
20
|
+
|
|
21
|
+
const menuRef = useRef<any>();
|
|
22
|
+
const okrMenusData = useRef<DemoMenusInt>(defaultRefObject);
|
|
23
|
+
const [selectedMenuKeys, setSelectedMenuKeys] = useState<string[]>([]);
|
|
24
|
+
const [expandedKeys, setExpandedKeys] = useState(["demofree"]);
|
|
25
|
+
const [menus] = useState(() => {
|
|
26
|
+
okrMenusData.current = new DemoMenuData();
|
|
27
|
+
return okrMenusData.current.getMenus();
|
|
28
|
+
});
|
|
29
|
+
const flipRef = useRef<flipRefIns>({
|
|
30
|
+
next: () => { },
|
|
31
|
+
goback: () => { },
|
|
32
|
+
});
|
|
33
|
+
const collapseMenu = (isHide) => {
|
|
34
|
+
if (isHide) {
|
|
35
|
+
menuRef.current.style.width = "0px";
|
|
36
|
+
} else {
|
|
37
|
+
menuRef.current.style.width = "";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const onExpandHandler = (expandKeys) => {
|
|
41
|
+
setExpandedKeys(expandKeys);
|
|
42
|
+
};
|
|
43
|
+
// 判断路由高亮菜单
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const menuHighlight = new MenuHighlight(history);
|
|
46
|
+
menuHighlight.highlight((menu) => setSelectedMenuKeys([menu]));
|
|
47
|
+
}, [
|
|
48
|
+
history.location.pathname,
|
|
49
|
+
history.location.search,
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
const onSelectHandler = (selectedKyes, { node }) => {
|
|
53
|
+
onSelect(node);
|
|
54
|
+
// 处理菜单选中
|
|
55
|
+
if (!selectedKyes.length) return;
|
|
56
|
+
setSelectedMenuKeys(selectedKyes);
|
|
57
|
+
};
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
ref={menuRef}
|
|
61
|
+
className={classNames(preCls, `${preCls}-appraisal-menus`)}
|
|
62
|
+
>
|
|
63
|
+
<FlipCard collapseMenu={collapseMenu} ref={flipRef} defaultWidth={isEn ? 210 : 180}>
|
|
64
|
+
<div className={classNames(`${preCls}-appraisal-menus-tree`)}>
|
|
65
|
+
<Scrollbar>
|
|
66
|
+
<MenuTree
|
|
67
|
+
data={menus}
|
|
68
|
+
selectedKeys={selectedMenuKeys}
|
|
69
|
+
expandedKeys={expandedKeys}
|
|
70
|
+
onExpand={onExpandHandler}
|
|
71
|
+
onSelect={onSelectHandler}
|
|
72
|
+
/>
|
|
73
|
+
</Scrollbar>
|
|
74
|
+
</div>
|
|
75
|
+
<div />
|
|
76
|
+
</FlipCard>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
export default withRouter(DemoMenus);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PAGE_UNASSIGNED_DEMOFREE,
|
|
3
|
+
PAGE_ASSIGNED_DEMOFREE,
|
|
4
|
+
PAGE_RESERVED_DEMOFREE,
|
|
5
|
+
PAGE_DONE_DEMOFREE,
|
|
6
|
+
PAGE_IGNORED_DEMOFREE,
|
|
7
|
+
} from "./menus";
|
|
8
|
+
|
|
9
|
+
export default class {
|
|
10
|
+
private history: any = null;
|
|
11
|
+
|
|
12
|
+
constructor(history: any) {
|
|
13
|
+
this.history = history;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
highlight(cb) {
|
|
17
|
+
if (this.isUnAssigned()) cb(PAGE_UNASSIGNED_DEMOFREE);
|
|
18
|
+
else if (this.isAssigned()) cb(PAGE_ASSIGNED_DEMOFREE);
|
|
19
|
+
else if (this.isReserved()) cb(PAGE_RESERVED_DEMOFREE);
|
|
20
|
+
else if (this.isDone()) cb(PAGE_DONE_DEMOFREE);
|
|
21
|
+
else if (this.isIgnore()) cb(PAGE_IGNORED_DEMOFREE);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
isUnAssigned() {
|
|
25
|
+
const { pathname, search } = this.history.location;
|
|
26
|
+
return pathname.match(/demofree/)
|
|
27
|
+
&& (!search || search.match(/selected[\s]*?=[\s]*?unassigned/));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
isAssigned() {
|
|
31
|
+
const { pathname, search } = this.history.location;
|
|
32
|
+
return pathname.match(/demofree/)
|
|
33
|
+
&& search.match(/selected[\s]*?=[\s]*?assigned/);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
isReserved() {
|
|
37
|
+
const { pathname, search } = this.history.location;
|
|
38
|
+
return pathname.match(/demofree/)
|
|
39
|
+
&& search.match(/selected[\s]*?=[\s]*?reserved/);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
isDone() {
|
|
43
|
+
const { pathname, search } = this.history.location;
|
|
44
|
+
return pathname.match(/demofree/)
|
|
45
|
+
&& search.match(/selected[\s]*?=[\s]*?done/);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
isIgnore() {
|
|
49
|
+
const { pathname, search } = this.history.location;
|
|
50
|
+
return pathname.match(/demofree/)
|
|
51
|
+
&& search.match(/selected[\s]*?=[\s]*?ignore/);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { PARENT_MENU_NODE, SUB_MENU_ITEM_NOE } from "../../components/menu-tree/tree-node/index";
|
|
2
|
+
|
|
3
|
+
interface TreeNode {
|
|
4
|
+
key: string;
|
|
5
|
+
title: string;
|
|
6
|
+
nodeType: string;
|
|
7
|
+
isLeaf: boolean;
|
|
8
|
+
data: any;
|
|
9
|
+
children?: TreeNode[];
|
|
10
|
+
}
|
|
11
|
+
export const defaultRefObject = {
|
|
12
|
+
menus: [],
|
|
13
|
+
getMenus: () => { },
|
|
14
|
+
};
|
|
15
|
+
export interface DemoMenusInt {
|
|
16
|
+
menus: any[];
|
|
17
|
+
getMenus: Function;
|
|
18
|
+
}
|
|
19
|
+
export const PAGE_UNASSIGNED_DEMOFREE = "unassigned";
|
|
20
|
+
export const PAGE_ASSIGNED_DEMOFREE = "assigned";
|
|
21
|
+
export const PAGE_RESERVED_DEMOFREE = "reserved";
|
|
22
|
+
export const PAGE_DONE_DEMOFREE = "done";
|
|
23
|
+
export const PAGE_IGNORED_DEMOFREE = "ignore";
|
|
24
|
+
export default class DemoMenuData {
|
|
25
|
+
public menus;
|
|
26
|
+
|
|
27
|
+
public isManager;
|
|
28
|
+
|
|
29
|
+
constructor() {
|
|
30
|
+
this.isManager = localStorage.getItem("DEMO_USER_IS_MANAGER") === "1";
|
|
31
|
+
this.menus = [
|
|
32
|
+
{
|
|
33
|
+
icon: "kaohe",
|
|
34
|
+
label: "任务状态",
|
|
35
|
+
key: "demofree",
|
|
36
|
+
href: this.isManager ? "#/demofree/list?selected=unassigned" : "#/demofree/list?selected=assigned",
|
|
37
|
+
isShow: true,
|
|
38
|
+
children: [{
|
|
39
|
+
icon: "",
|
|
40
|
+
label: "未分配",
|
|
41
|
+
key: "unassigned",
|
|
42
|
+
href: "#/demofree/list?selected=unassigned",
|
|
43
|
+
isShow: this.isManager,
|
|
44
|
+
}, {
|
|
45
|
+
icon: "",
|
|
46
|
+
label: "已分配",
|
|
47
|
+
key: "assigned",
|
|
48
|
+
href: "#/demofree/list?selected=assigned",
|
|
49
|
+
isShow: true,
|
|
50
|
+
}, {
|
|
51
|
+
icon: "",
|
|
52
|
+
label: "已预约",
|
|
53
|
+
key: "reserved",
|
|
54
|
+
href: "#/demofree/list?selected=reserved",
|
|
55
|
+
isShow: true,
|
|
56
|
+
}, {
|
|
57
|
+
icon: "",
|
|
58
|
+
label: "已完成",
|
|
59
|
+
key: "done",
|
|
60
|
+
href: "#/demofree/list?selected=done",
|
|
61
|
+
isShow: true,
|
|
62
|
+
}, {
|
|
63
|
+
icon: "",
|
|
64
|
+
label: "已忽略",
|
|
65
|
+
key: "ignore",
|
|
66
|
+
href: "#/demofree/list?selected=ignore",
|
|
67
|
+
isShow: this.isManager,
|
|
68
|
+
}],
|
|
69
|
+
},
|
|
70
|
+
// {
|
|
71
|
+
// icon: "KH-help",
|
|
72
|
+
// label: "客户续费情况",
|
|
73
|
+
// key: "custom",
|
|
74
|
+
// href: "#/custom",
|
|
75
|
+
// isShow: true,
|
|
76
|
+
// type: MENU_ITEM_NOE,
|
|
77
|
+
// children:[{
|
|
78
|
+
// icon: "",
|
|
79
|
+
// label: "未处理",
|
|
80
|
+
// key: "ignore",
|
|
81
|
+
// href: "#/demofree/custom?selected=未处理",
|
|
82
|
+
// isShow: true,
|
|
83
|
+
// },{
|
|
84
|
+
// icon: "",
|
|
85
|
+
// label: "待定",
|
|
86
|
+
// key: "ignore",
|
|
87
|
+
// href: "#/demofree/custom?selected=待定",
|
|
88
|
+
// isShow: true,
|
|
89
|
+
// },{
|
|
90
|
+
// icon: "",
|
|
91
|
+
// label: "已续费",
|
|
92
|
+
// key: "ignore",
|
|
93
|
+
// href: "#/demofree/custom?selected=已续费",
|
|
94
|
+
// isShow: true,
|
|
95
|
+
// },{
|
|
96
|
+
// icon: "",
|
|
97
|
+
// label: "未续费",
|
|
98
|
+
// key: "ignore",
|
|
99
|
+
// href: "#/demofree/custom?selected=未续费",
|
|
100
|
+
// isShow: true,
|
|
101
|
+
// }]
|
|
102
|
+
// },
|
|
103
|
+
];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
getMenus() {
|
|
107
|
+
const menus = this.formateToTreeNodeData(this.menus);
|
|
108
|
+
return menus;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
formateToTreeNodeData(menus) {
|
|
112
|
+
const treeNodes: TreeNode[] = [];
|
|
113
|
+
|
|
114
|
+
for (let i = 0; i < menus.length; i += 1) {
|
|
115
|
+
const menu = menus[i];
|
|
116
|
+
const hasChildren = !!((menu.children && menu.children.length));
|
|
117
|
+
const isLeaf = menu.isLeaf !== undefined ? menu.isLeaf : !hasChildren;
|
|
118
|
+
|
|
119
|
+
let nodeType = menu.type;
|
|
120
|
+
if (!nodeType) nodeType = !isLeaf ? PARENT_MENU_NODE : SUB_MENU_ITEM_NOE;
|
|
121
|
+
|
|
122
|
+
if (menu.isShow) {
|
|
123
|
+
treeNodes.push({
|
|
124
|
+
key: `${menu.key}`,
|
|
125
|
+
title: menu.label,
|
|
126
|
+
data: menu,
|
|
127
|
+
isLeaf,
|
|
128
|
+
children: this.formateToTreeNodeData(menu.children || []),
|
|
129
|
+
nodeType,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return treeNodes;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -4,19 +4,22 @@ import OkrMenus from "./export-modules/okr-menus";
|
|
|
4
4
|
import AppraisalMenus from "./export-modules/appraisal-menus";
|
|
5
5
|
import ManageMenus from "./export-modules/manage-menus";
|
|
6
6
|
import "./index.scss";
|
|
7
|
+
import DemoMenus from "./export-modules/demo-menus";
|
|
7
8
|
|
|
8
9
|
const preCls = "titaui-menus";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
const Menus = (props: any) => {
|
|
11
12
|
const { type, ...restProps } = props;
|
|
12
13
|
|
|
13
14
|
const renderMenuByType = () => {
|
|
14
|
-
if (type
|
|
15
|
+
if (type === "okr") {
|
|
15
16
|
return <OkrMenus {...restProps} />;
|
|
16
|
-
} if (type
|
|
17
|
+
} if (type === "appraisal") {
|
|
17
18
|
return <AppraisalMenus {...restProps} />;
|
|
18
|
-
} if (type
|
|
19
|
+
} if (type === "manage") {
|
|
19
20
|
return <ManageMenus {...restProps} />;
|
|
21
|
+
} if (type === "demofree") {
|
|
22
|
+
return <DemoMenus {...restProps} />;
|
|
20
23
|
}
|
|
21
24
|
return undefined;
|
|
22
25
|
};
|
|
@@ -26,4 +29,5 @@ export default function (props) {
|
|
|
26
29
|
{renderMenuByType()}
|
|
27
30
|
</div>
|
|
28
31
|
);
|
|
29
|
-
}
|
|
32
|
+
};
|
|
33
|
+
export default Menus;
|
|
@@ -18,3 +18,27 @@ export const getVersionTextMap = () => ({
|
|
|
18
18
|
[Versions.Professional]: getLocale("Sw_OKREdit"),
|
|
19
19
|
[Versions.Flagship]: getLocale("Sw_Flagship"),
|
|
20
20
|
});
|
|
21
|
+
|
|
22
|
+
export const DEMO_FREE_MENU_CONFIG = {
|
|
23
|
+
DataSource: null,
|
|
24
|
+
appCode: null,
|
|
25
|
+
appId: 119,
|
|
26
|
+
children: [],
|
|
27
|
+
code: "",
|
|
28
|
+
color: "#F28D49",
|
|
29
|
+
defaultExpand: false,
|
|
30
|
+
domain: "",
|
|
31
|
+
groupId: 0,
|
|
32
|
+
href: "#demofree/list?selected=assigned",
|
|
33
|
+
iconName: "",
|
|
34
|
+
id: 99998,
|
|
35
|
+
labelName: null,
|
|
36
|
+
menuPoint: null,
|
|
37
|
+
orderId: 2000,
|
|
38
|
+
originUrl: null,
|
|
39
|
+
signUrl: "",
|
|
40
|
+
status: 0,
|
|
41
|
+
tenantId: 0,
|
|
42
|
+
title: "demofree",
|
|
43
|
+
type: "hash",
|
|
44
|
+
};
|
|
@@ -25,12 +25,10 @@ const NavTop: FC = () => {
|
|
|
25
25
|
const versionInfo = getBSGlobal("tenantAuthentication");
|
|
26
26
|
const [activeMenuId, setActiveMenuId] = useState(-1);
|
|
27
27
|
const ua = navigator.userAgent.toLowerCase();
|
|
28
|
-
const showWxInvite = getTenantInfo().mainCorpId && ua.indexOf("micromessenger")
|
|
28
|
+
const showWxInvite = getTenantInfo().mainCorpId && ua.indexOf("micromessenger") !== -1;
|
|
29
29
|
const openWxInvite = useCallback(() => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
&& WeixinJSBridge.invoke(
|
|
30
|
+
if (window.WeixinJSBridge !== undefined) {
|
|
31
|
+
window.WeixinJSBridge.invoke(
|
|
34
32
|
"selectPrivilegedContact",
|
|
35
33
|
{
|
|
36
34
|
fromDepartmentId: -1, // 必填,表示打开的通讯录从指定的部门开始展示,-1表示自己所在部门开始, 0表示从最上层开始
|
|
@@ -40,7 +38,7 @@ const NavTop: FC = () => {
|
|
|
40
38
|
// "selectedTickets"["ticket1","ticket2"] // 非必填,已选ticket列表。single模式忽略该参数
|
|
41
39
|
},
|
|
42
40
|
(res) => {
|
|
43
|
-
if (res.err_msg
|
|
41
|
+
if (res.err_msg === "selectPrivilegedContact:ok") {
|
|
44
42
|
// var selectedUserList = res.result.userList; // 已选的成员列表
|
|
45
43
|
// for (var i = 0; i < selectedUserList.length; i++) {
|
|
46
44
|
// var openUserId = selectedUserList[i].openUserId; //成员openUserId
|
|
@@ -52,7 +50,7 @@ const NavTop: FC = () => {
|
|
|
52
50
|
.then(() => {
|
|
53
51
|
Toast.Success("邀请成功");
|
|
54
52
|
})
|
|
55
|
-
.catch((
|
|
53
|
+
.catch(() => {
|
|
56
54
|
Toast.Error("邀请失败");
|
|
57
55
|
});
|
|
58
56
|
} else {
|
|
@@ -60,10 +58,11 @@ const NavTop: FC = () => {
|
|
|
60
58
|
}
|
|
61
59
|
},
|
|
62
60
|
);
|
|
61
|
+
}
|
|
63
62
|
}, []);
|
|
64
63
|
|
|
65
64
|
const handleHashChange = () => {
|
|
66
|
-
const hash = location.hash.split("?")[0] || "";
|
|
65
|
+
const hash = window.location.hash.split("?")[0] || "";
|
|
67
66
|
if (hash) {
|
|
68
67
|
const activeMenu = menu.find((item) => hash.includes(item.href.split("#")?.[1]?.split("?")[0]));
|
|
69
68
|
if (hash.includes("homepage")) {
|
|
@@ -94,6 +93,7 @@ const NavTop: FC = () => {
|
|
|
94
93
|
href={hasOKRApp ? "#homepage" : ""}
|
|
95
94
|
>
|
|
96
95
|
<img
|
|
96
|
+
alt="logo"
|
|
97
97
|
src={Logo}
|
|
98
98
|
className={classNames(`${preCls}__left-logo`, {
|
|
99
99
|
[`${preCls}__left-logo--hover`]: hasOKRApp,
|
|
@@ -102,11 +102,12 @@ const NavTop: FC = () => {
|
|
|
102
102
|
{hasOKRApp && (
|
|
103
103
|
<span
|
|
104
104
|
className={classNames(`${preCls}__left-home`, {
|
|
105
|
-
[`${preCls}__left-home--active`]: activeMenuId
|
|
105
|
+
[`${preCls}__left-home--active`]: activeMenuId === 99999,
|
|
106
106
|
[`${preCls}__left-home--hover`]: hasOKRApp,
|
|
107
107
|
})}
|
|
108
108
|
>
|
|
109
109
|
<img
|
|
110
|
+
alt="home-img"
|
|
110
111
|
src={Home}
|
|
111
112
|
className={classNames(`${preCls}__left-home-img`)}
|
|
112
113
|
/>
|
|
@@ -2,13 +2,13 @@ import axios from "axios";
|
|
|
2
2
|
import { rget, rdelete } from "../../utils/request";
|
|
3
3
|
|
|
4
4
|
// @ts-ignore
|
|
5
|
-
const tenantId = (BSGlobal && BSGlobal.tenantInfo.Id) || 0;
|
|
5
|
+
const tenantId = (window.BSGlobal && window.BSGlobal.tenantInfo.Id) || 0;
|
|
6
6
|
// @ts-ignore
|
|
7
|
-
const userId = (BSGlobal && BSGlobal.loginUserInfo.Id) || 0;
|
|
7
|
+
const userId = (window.BSGlobal && window.BSGlobal.loginUserInfo.Id) || 0;
|
|
8
8
|
|
|
9
9
|
const requestDomain = () => {
|
|
10
10
|
if (!window.location.hostname.match(/dev/)) return "";
|
|
11
|
-
return `${location.protocol}//www.tita.gift`;
|
|
11
|
+
return `${window.location.protocol}//www.tita.gift`;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export const getTodos = (pageNum) => rget("v1")(
|
|
@@ -43,8 +43,8 @@ export const getMessages = () => {
|
|
|
43
43
|
)
|
|
44
44
|
.then((resp: any) => {
|
|
45
45
|
if (resp.code === 401) {
|
|
46
|
-
location.href = "/Account/Logout";
|
|
47
|
-
return;
|
|
46
|
+
window.location.href = "/Account/Logout";
|
|
47
|
+
return undefined;
|
|
48
48
|
}
|
|
49
49
|
return resp.data;
|
|
50
50
|
})
|
|
@@ -4,7 +4,7 @@ import defaultLogo from "./images/logo-white.png";
|
|
|
4
4
|
|
|
5
5
|
export const getMenus = () => {
|
|
6
6
|
// @ts-ignore
|
|
7
|
-
const navs: INavType[] = BSGlobal.newNavigation;
|
|
7
|
+
const navs: INavType[] = window.BSGlobal.newNavigation;
|
|
8
8
|
navs.sort((pre, next) => pre.orderId - next.orderId);
|
|
9
9
|
return navs;
|
|
10
10
|
};
|
|
@@ -12,5 +12,18 @@ export const getMenus = () => {
|
|
|
12
12
|
export const getLogo = () => {
|
|
13
13
|
// 232637ab8a674427a1d6489329035d86_n 是老logo的路径,没法判断是否用户自定义过,所以只能这么硬核
|
|
14
14
|
const tenantInfo = getTenantInfo();
|
|
15
|
-
return tenantInfo.isNewIndex && /232637ab8a674427a1d6489329035d86_n/g.test(tenantInfo.Logo) || !tenantInfo.Logo ? defaultLogo : tenantInfo.Logo;
|
|
15
|
+
return ((tenantInfo.isNewIndex && /232637ab8a674427a1d6489329035d86_n/g.test(tenantInfo.Logo)) || !tenantInfo.Logo) ? defaultLogo : tenantInfo.Logo;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const transMetasToTableData = (dataSource = []) => {
|
|
19
|
+
const listData: any = [];
|
|
20
|
+
dataSource.forEach((dataItem: any) => {
|
|
21
|
+
const data = {};
|
|
22
|
+
dataItem.forEach((field) => {
|
|
23
|
+
const { name, value } = field;
|
|
24
|
+
data[name] = value;
|
|
25
|
+
});
|
|
26
|
+
listData.push(data);
|
|
27
|
+
});
|
|
28
|
+
return listData;
|
|
16
29
|
};
|
|
@@ -66,6 +66,11 @@ export function CreateCycle({
|
|
|
66
66
|
const [cycleSetting, setCycleSetting] = useState<any>();
|
|
67
67
|
|
|
68
68
|
useEffect(() => {
|
|
69
|
+
const settings = localStorage.getItem("OKR_CYCLE_SETTING");
|
|
70
|
+
if (settings) {
|
|
71
|
+
setCycleSetting(JSON.parse(settings));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
69
74
|
const url = getApiUrl("okr/cycleSetting");
|
|
70
75
|
taker(url, "GET").then((res) => {
|
|
71
76
|
if (res.Code == 1) {
|