aldehyde 0.2.421 → 0.2.422
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/controls/date-picker/index.d.ts.map +1 -1
- package/lib/controls/date-picker/index.js +8 -15
- package/lib/controls/date-picker/index.js.map +1 -1
- package/lib/controls/file-view/index.d.ts.map +1 -1
- package/lib/controls/file-view/index.js +5 -3
- package/lib/controls/file-view/index.js.map +1 -1
- package/lib/detail/button/view-button.d.ts +1 -0
- package/lib/detail/button/view-button.d.ts.map +1 -1
- package/lib/detail/button/view-button.js +3 -3
- package/lib/detail/button/view-button.js.map +1 -1
- package/lib/hooks/use-tabs/index.d.ts.map +1 -1
- package/lib/hooks/use-tabs/index.js +3 -0
- package/lib/hooks/use-tabs/index.js.map +1 -1
- package/lib/layout2/components/user-button.d.ts +3 -0
- package/lib/layout2/components/user-button.d.ts.map +1 -1
- package/lib/layout2/components/user-button.js +17 -8
- package/lib/layout2/components/user-button.js.map +1 -1
- package/lib/layout2/header.d.ts +2 -0
- package/lib/layout2/header.d.ts.map +1 -1
- package/lib/layout2/header.js +3 -3
- package/lib/layout2/header.js.map +1 -1
- package/lib/layout2/page.d.ts.map +1 -1
- package/lib/layout2/page.js +7 -5
- package/lib/layout2/page.js.map +1 -1
- package/lib/layout2/sider.d.ts +2 -0
- package/lib/layout2/sider.d.ts.map +1 -1
- package/lib/layout2/sider.js +2 -2
- package/lib/layout2/sider.js.map +1 -1
- package/lib/layout3/header.d.ts +2 -0
- package/lib/layout3/header.d.ts.map +1 -1
- package/lib/layout3/header.js +4 -4
- package/lib/layout3/header.js.map +1 -1
- package/lib/layout3/page.d.ts.map +1 -1
- package/lib/layout3/page.js +6 -4
- package/lib/layout3/page.js.map +1 -1
- package/lib/layout3/sider.d.ts +2 -0
- package/lib/layout3/sider.d.ts.map +1 -1
- package/lib/layout3/sider.js +2 -2
- package/lib/layout3/sider.js.map +1 -1
- package/lib/layout4/header.d.ts +2 -0
- package/lib/layout4/header.d.ts.map +1 -1
- package/lib/layout4/header.js +4 -4
- package/lib/layout4/header.js.map +1 -1
- package/lib/layout4/page.d.ts.map +1 -1
- package/lib/layout4/page.js +7 -5
- package/lib/layout4/page.js.map +1 -1
- package/lib/layout4/sider.d.ts +2 -0
- package/lib/layout4/sider.d.ts.map +1 -1
- package/lib/layout4/sider.js +2 -2
- package/lib/layout4/sider.js.map +1 -1
- package/lib/layout5/header.d.ts +2 -0
- package/lib/layout5/header.d.ts.map +1 -1
- package/lib/layout5/header.js +2 -2
- package/lib/layout5/header.js.map +1 -1
- package/lib/layout5/page.d.ts.map +1 -1
- package/lib/layout5/page.js +7 -5
- package/lib/layout5/page.js.map +1 -1
- package/lib/layout5/sider.d.ts +2 -0
- package/lib/layout5/sider.d.ts.map +1 -1
- package/lib/layout5/sider.js +2 -2
- package/lib/layout5/sider.js.map +1 -1
- package/lib/list/card-list/card-list-item.js +1 -1
- package/lib/list/card-list/card-list-item.js.map +1 -1
- package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/bar-chart/index.js +9 -1
- package/lib/lowcode-components/bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/base-map/index.d.ts.map +1 -1
- package/lib/lowcode-components/base-map/index.js +9 -1
- package/lib/lowcode-components/base-map/index.js.map +1 -1
- package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/capsule-bar-chart/index.js +9 -1
- package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/circular-progress-chart/index.js +9 -1
- package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -1
- package/lib/lowcode-components/column-3d-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/column-3d-chart/index.js +9 -1
- package/lib/lowcode-components/column-3d-chart/index.js.map +1 -1
- package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/column-chart/index.js +9 -1
- package/lib/lowcode-components/column-chart/index.js.map +1 -1
- package/lib/lowcode-components/effectScatter-map/index.d.ts.map +1 -1
- package/lib/lowcode-components/effectScatter-map/index.js +9 -1
- package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.d.ts.map +1 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.js +9 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -1
- package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/gauge-chart/index.js +9 -1
- package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-bar-chart/index.js +9 -1
- package/lib/lowcode-components/line-bar-chart/index.js.map +1 -1
- package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/line-chart/index.js +9 -1
- package/lib/lowcode-components/line-chart/index.js.map +1 -1
- package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/liquid-chart/index.js +9 -1
- package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.less +7 -0
- package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/pie-chart/index.js +9 -1
- package/lib/lowcode-components/pie-chart/index.js.map +1 -1
- package/lib/lowcode-components/progress-chart/index.d.ts.map +1 -1
- package/lib/lowcode-components/progress-chart/index.js +9 -1
- package/lib/lowcode-components/progress-chart/index.js.map +1 -1
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +4 -2
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +6 -8
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/index.css +0 -2
- package/lib/table/pagination.d.ts +1 -0
- package/lib/table/pagination.d.ts.map +1 -1
- package/lib/table/pagination.js +2 -2
- package/lib/table/pagination.js.map +1 -1
- package/lib/table/query-table.d.ts.map +1 -1
- package/lib/table/query-table.js +1 -1
- package/lib/table/query-table.js.map +1 -1
- package/lib/table/relation-table.d.ts +1 -0
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +4 -1
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +51 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +2 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/welcome/HCWelcome.js +10 -0
- package/lib/welcome/HCWelcome.js.map +1 -1
- package/lib/welcome/components/menu-card.less +1 -0
- package/lib/welcome/components/user-menus.d.ts +16 -0
- package/lib/welcome/components/user-menus.d.ts.map +1 -0
- package/lib/welcome/components/user-menus.js +210 -0
- package/lib/welcome/components/user-menus.js.map +1 -0
- package/lib/welcome/components/user-menus.less +193 -0
- package/package.json +1 -1
- package/src/aldehyde/controls/date-picker/index.tsx +12 -4
- package/src/aldehyde/controls/file-view/index.tsx +5 -1
- package/src/aldehyde/detail/button/view-button.tsx +7 -6
- package/src/aldehyde/hooks/use-tabs/index.tsx +3 -0
- package/src/aldehyde/layout2/components/user-button.tsx +19 -8
- package/src/aldehyde/layout2/header.tsx +5 -3
- package/src/aldehyde/layout2/page.tsx +8 -7
- package/src/aldehyde/layout2/sider.tsx +4 -3
- package/src/aldehyde/layout3/header.tsx +6 -4
- package/src/aldehyde/layout3/page.tsx +7 -4
- package/src/aldehyde/layout3/sider.tsx +4 -3
- package/src/aldehyde/layout4/header.tsx +6 -4
- package/src/aldehyde/layout4/page.tsx +8 -5
- package/src/aldehyde/layout4/sider.tsx +4 -3
- package/src/aldehyde/layout5/header.tsx +4 -2
- package/src/aldehyde/layout5/page.tsx +8 -5
- package/src/aldehyde/layout5/sider.tsx +4 -3
- package/src/aldehyde/list/card-list/card-list-item.tsx +1 -1
- package/src/aldehyde/lowcode-components/bar-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/base-map/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/column-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/lowcode-view/index.less +7 -0
- package/src/aldehyde/lowcode-components/pie-chart/index.tsx +12 -2
- package/src/aldehyde/lowcode-components/progress-chart/index.tsx +12 -2
- package/src/aldehyde/table/act-table.tsx +10 -3
- package/src/aldehyde/table/column/column-builder.tsx +13 -20
- package/src/aldehyde/table/index.css +0 -2
- package/src/aldehyde/table/pagination.tsx +8 -7
- package/src/aldehyde/table/query-table.tsx +1 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +45 -1
- package/src/aldehyde/tmpl/interface.tsx +2 -0
- package/src/aldehyde/welcome/HCWelcome.js +10 -0
- package/src/aldehyde/welcome/components/menu-card.less +1 -0
- package/src/aldehyde/welcome/components/user-menus.less +193 -0
- package/src/aldehyde/welcome/components/user-menus.tsx +275 -0
|
@@ -25,6 +25,7 @@ import { useLayoutContext } from "./layout-context";
|
|
|
25
25
|
import IconFont from "./components/icon-font";
|
|
26
26
|
import SearchMenu from "./components/search-menu";
|
|
27
27
|
import ScreenfullButton from "./components/screenfull-button";
|
|
28
|
+
import { ThemeConfig } from "../tmpl/interface";
|
|
28
29
|
|
|
29
30
|
const toolbarStyle: CSSProperties = {
|
|
30
31
|
width: "100%",
|
|
@@ -41,6 +42,7 @@ type HeaderPropsType = {
|
|
|
41
42
|
menuList: MenuType[];
|
|
42
43
|
style?: any;
|
|
43
44
|
logoImg: string;
|
|
45
|
+
themeConfig?: ThemeConfig;
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
@@ -48,7 +50,7 @@ type MenuItem = Required<MenuProps>["items"][number];
|
|
|
48
50
|
|
|
49
51
|
const { useToken } = theme;
|
|
50
52
|
|
|
51
|
-
const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, style, logoImg }) => {
|
|
53
|
+
const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, style, logoImg, themeConfig }) => {
|
|
52
54
|
const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
|
|
53
55
|
|
|
54
56
|
// token
|
|
@@ -65,7 +67,7 @@ const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, style, logoIm
|
|
|
65
67
|
menuList,
|
|
66
68
|
(menuItem, floor) => {
|
|
67
69
|
const { disabled, label, children, icon } = menuItem;
|
|
68
|
-
const renderIcon = icon ? <IconFont type={icon} /> : "";
|
|
70
|
+
const renderIcon = (themeConfig?.showTopMenuIcon && icon) ? <IconFont type={icon} /> : "";
|
|
69
71
|
if (disabled)
|
|
70
72
|
return (
|
|
71
73
|
<div
|
|
@@ -260,7 +262,7 @@ const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, style, logoIm
|
|
|
260
262
|
type="link"
|
|
261
263
|
style={toolbarStyle}
|
|
262
264
|
/> */}
|
|
263
|
-
<UserButton style={{ padding: 0, marginRight: "15px", color: "#ffffff" }} />
|
|
265
|
+
<UserButton themeConfig={themeConfig} layoutRootPath="v2" style={{ padding: 0, marginRight: "15px", color: "#ffffff" }} />
|
|
264
266
|
</Space>
|
|
265
267
|
</div>
|
|
266
268
|
</div>
|
|
@@ -9,7 +9,7 @@ import Sider from "./sider";
|
|
|
9
9
|
import Main from "./main";
|
|
10
10
|
import HcserviceV3 from "../tmpl/hcservice-v3";
|
|
11
11
|
import { MenuType } from "./type/layout-type";
|
|
12
|
-
import { BlockType, MenuConfigAPIType } from "../tmpl/interface";
|
|
12
|
+
import { BlockType, MenuConfigAPIType, ThemeConfig } from "../tmpl/interface";
|
|
13
13
|
import { useVarCssColor } from "../hooks/useVarCssColor";
|
|
14
14
|
import { generate } from "@ant-design/colors";
|
|
15
15
|
import { LayoutProvider, useLayoutContext } from "./layout-context";
|
|
@@ -204,16 +204,17 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
204
204
|
|
|
205
205
|
const [systemName, setSystemName] = useState("");
|
|
206
206
|
const [systemLogo, setSystemLogo] = useState("");
|
|
207
|
-
|
|
208
207
|
const [menu, SetMenu] = useState<MenuType[]>([]);
|
|
208
|
+
const [themeConfig, setThemeConfig] = useState<ThemeConfig>();
|
|
209
209
|
|
|
210
210
|
const getThemeConfigAndMenuConfig = async () => {
|
|
211
|
-
const
|
|
211
|
+
const tConfig = await Units.getThemeConfig();
|
|
212
212
|
const menuConfig = await getMenuConfig();
|
|
213
|
-
setSystemName(
|
|
214
|
-
setSystemLogo(
|
|
213
|
+
setSystemName(tConfig?.programName || menuConfig?.systemName);
|
|
214
|
+
setSystemLogo(tConfig?.programIcon || homePng);
|
|
215
215
|
SetMenu(menuConfig?.menu);
|
|
216
216
|
updateMenuItemIdToFirstFloorIdxMap(menuConfig?.menu);
|
|
217
|
+
setThemeConfig(tConfig);
|
|
217
218
|
};
|
|
218
219
|
|
|
219
220
|
|
|
@@ -243,9 +244,9 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
243
244
|
algorithm: compactTheme ? [theme.compactAlgorithm] : [],
|
|
244
245
|
}}>
|
|
245
246
|
<Layout style={{ height: "100%" }} className={compactTheme ? "layout-compactTheme" : undefined}>
|
|
246
|
-
<Header logoImg={logo || systemLogo} systemName={systemName ? systemName : Units.programName_NavLeft()} menuList={menu}></Header>
|
|
247
|
+
<Header themeConfig={themeConfig} logoImg={logo || systemLogo} systemName={systemName ? systemName : Units.programName_NavLeft()} menuList={menu}></Header>
|
|
247
248
|
<Layout>
|
|
248
|
-
<Sider menuList={menu} collapsed={getSiderCollapsed()}></Sider>
|
|
249
|
+
<Sider themeConfig={themeConfig} menuList={menu} collapsed={getSiderCollapsed()}></Sider>
|
|
249
250
|
<Main>{props.children}</Main>
|
|
250
251
|
</Layout>
|
|
251
252
|
</Layout>
|
|
@@ -12,7 +12,7 @@ import { useLocale } from "../locale/useLocale";
|
|
|
12
12
|
import { generate } from "@ant-design/colors";
|
|
13
13
|
import { useLayoutContext } from "./layout-context";
|
|
14
14
|
import IconFont from "./components/icon-font";
|
|
15
|
-
import { UserInfo } from "../tmpl/interface";
|
|
15
|
+
import { UserInfo, ThemeConfig } from "../tmpl/interface";
|
|
16
16
|
import Units from "../units";
|
|
17
17
|
import "./css/sider.less";
|
|
18
18
|
|
|
@@ -20,6 +20,7 @@ type SiderPropsType = {
|
|
|
20
20
|
menuList: MenuType[];
|
|
21
21
|
// style?: typeof Layout.Sider.defaultProps.style;
|
|
22
22
|
collapsed: boolean;
|
|
23
|
+
themeConfig?: ThemeConfig;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
@@ -54,7 +55,7 @@ const getSecoundFloorMenuList = (
|
|
|
54
55
|
|
|
55
56
|
const { useToken } = theme;
|
|
56
57
|
|
|
57
|
-
const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed }) => {
|
|
58
|
+
const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed, themeConfig }) => {
|
|
58
59
|
const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
|
|
59
60
|
const [orgName, setOrgName] = useState<string>(""); // 组织名称
|
|
60
61
|
|
|
@@ -91,7 +92,7 @@ const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed }) => {
|
|
|
91
92
|
) => {
|
|
92
93
|
return handlePropsMenuToAntdMenu(secoundFloorMenu, (menuItem, floor) => {
|
|
93
94
|
const { disabled, label, children, icon } = menuItem;
|
|
94
|
-
const renderIcon = icon ? <IconFont type={icon} /> : "";
|
|
95
|
+
const renderIcon = (themeConfig?.showLeftMenuIcon && icon) ? <IconFont type={icon} /> : "";
|
|
95
96
|
|
|
96
97
|
if (disabled)
|
|
97
98
|
return (
|
|
@@ -17,6 +17,7 @@ import headerBgImg from "./imgs/header-bg.png";
|
|
|
17
17
|
import homeBgImg from "./imgs/home-bg.png";
|
|
18
18
|
import Time from "./components/time";
|
|
19
19
|
import IconFont from "../layout2/components/icon-font";
|
|
20
|
+
import { ThemeConfig } from "../tmpl/interface";
|
|
20
21
|
import "./css/header.less";
|
|
21
22
|
|
|
22
23
|
const toolbarStyle: CSSProperties = {
|
|
@@ -57,11 +58,12 @@ type HeaderPropsType = {
|
|
|
57
58
|
systemName: string;
|
|
58
59
|
menuList: MenuType[];
|
|
59
60
|
style?: any;
|
|
61
|
+
themeConfig?: ThemeConfig;
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
63
65
|
|
|
64
|
-
const Header: React.FC<HeaderPropsType> = ({ systemName, menuList }) => {
|
|
66
|
+
const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, themeConfig }) => {
|
|
65
67
|
const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
|
|
66
68
|
const { translate, getLocale } = useLocale();
|
|
67
69
|
const [menu, setMenu] = useState<MenuItem[]>([]);
|
|
@@ -73,7 +75,7 @@ const Header: React.FC<HeaderPropsType> = ({ systemName, menuList }) => {
|
|
|
73
75
|
|
|
74
76
|
const renderMenuItem = (menuItem) => {
|
|
75
77
|
const { label, id, disabled, icon } = menuItem;
|
|
76
|
-
const renderIcon = icon ? <IconFont type={icon} /> : "";
|
|
78
|
+
const renderIcon = (themeConfig?.showTopMenuIcon && icon) ? <IconFont type={icon} /> : "";
|
|
77
79
|
return <div className={`menu-item ${disabled ? "menu-disabled" : ""}`}><div className={selParentId === id ? "menu-item-border-sel" : "menu-item-border"}><Space size={"small"}>{renderIcon}{translate("${" + label + "}")}</Space></div></div>;
|
|
78
80
|
}
|
|
79
81
|
|
|
@@ -82,7 +84,7 @@ const Header: React.FC<HeaderPropsType> = ({ systemName, menuList }) => {
|
|
|
82
84
|
if (disabled) {
|
|
83
85
|
return renderMenuItem(menuItem);
|
|
84
86
|
}
|
|
85
|
-
const renderIcon = icon ? <IconFont type={icon} /> : "";
|
|
87
|
+
const renderIcon = (themeConfig?.showTopMenuIcon && icon) ? <IconFont type={icon} /> : "";
|
|
86
88
|
const { path, target } = getLeftMostRouteInfo(menuItem);
|
|
87
89
|
if (floor === 0) {
|
|
88
90
|
return path === null ? (
|
|
@@ -155,7 +157,7 @@ const Header: React.FC<HeaderPropsType> = ({ systemName, menuList }) => {
|
|
|
155
157
|
type="link"
|
|
156
158
|
style={toolbarStyle}
|
|
157
159
|
/> */}
|
|
158
|
-
<div className="header-user"><UserButton logoutUrl="/login3" style={{ padding: 0, color: "#fff" }} /></div>
|
|
160
|
+
<div className="header-user"><UserButton themeConfig={themeConfig} layoutRootPath="v3" logoutUrl="/login3" style={{ padding: 0, color: "#fff" }} /></div>
|
|
159
161
|
</Space>
|
|
160
162
|
</div>
|
|
161
163
|
</div>
|
|
@@ -13,6 +13,7 @@ import Units from '../units';
|
|
|
13
13
|
import { useLocale } from "../locale/useLocale";
|
|
14
14
|
import { KeepAliveTab } from "../hooks/use-tabs";
|
|
15
15
|
import { getMenuConfig } from "../layout2/page";
|
|
16
|
+
import { ThemeConfig } from "../tmpl/interface";
|
|
16
17
|
import "./css/main.less";
|
|
17
18
|
|
|
18
19
|
const { useToken } = theme;
|
|
@@ -24,6 +25,7 @@ type PagePropsType = {
|
|
|
24
25
|
const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
25
26
|
const [systemName, setSystemName] = useState("");
|
|
26
27
|
const [menu, setMenu] = useState<MenuType[]>([]);
|
|
28
|
+
const [themeConfig, setThemeConfig] = useState<ThemeConfig>();
|
|
27
29
|
const pageRef = useRef<HTMLDivElement>(undefined); // page ref
|
|
28
30
|
//清空缓存
|
|
29
31
|
const [keepAliveTabs, setKeepAliveTabs] = useSessionStorageState<KeepAliveTab[]>('keepAliveTabs', { defaultValue: [] });
|
|
@@ -32,11 +34,12 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
32
34
|
const { token: { colorPrimary } } = useToken();
|
|
33
35
|
|
|
34
36
|
const getThemeConfigAndMenuConfig = async () => {
|
|
35
|
-
const
|
|
37
|
+
const tConfig = await Units.getThemeConfig();
|
|
36
38
|
const menuConfig = await getMenuConfig("v3");
|
|
37
|
-
setSystemName(
|
|
39
|
+
setSystemName(tConfig?.programName || menuConfig?.systemName);
|
|
38
40
|
setMenu(menuConfig?.menu);
|
|
39
41
|
updateMenuItemIdToFirstFloorIdxMap(menuConfig?.menu);
|
|
42
|
+
setThemeConfig(tConfig);
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
useEffect(() => {
|
|
@@ -69,9 +72,9 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
69
72
|
card={{ className: "v3-antd-card" }}
|
|
70
73
|
>
|
|
71
74
|
<Layout style={{ height: "100%" }} className={compactTheme ? "layout-compactTheme" : undefined}>
|
|
72
|
-
<Header systemName={systemName ? systemName : Units.programName_NavLeft()} menuList={menu}></Header>
|
|
75
|
+
<Header themeConfig={themeConfig} systemName={systemName ? systemName : Units.programName_NavLeft()} menuList={menu}></Header>
|
|
73
76
|
<Layout>
|
|
74
|
-
<Sider menuList={menu} collapsed={getSiderCollapsed()}></Sider>
|
|
77
|
+
<Sider themeConfig={themeConfig} menuList={menu} collapsed={getSiderCollapsed()}></Sider>
|
|
75
78
|
<Main>{props.children}</Main>
|
|
76
79
|
</Layout>
|
|
77
80
|
</Layout>
|
|
@@ -10,13 +10,14 @@ import { useLayoutContext } from "../layout2/layout-context";
|
|
|
10
10
|
import { MenuType } from "../layout2/type/layout-type";
|
|
11
11
|
import { useLocale } from "../locale/useLocale";
|
|
12
12
|
import IconFont from "../layout2/components/icon-font";
|
|
13
|
-
import { UserInfo } from "../tmpl/interface";
|
|
13
|
+
import { UserInfo, ThemeConfig } from "../tmpl/interface";
|
|
14
14
|
import Units from "../units";
|
|
15
15
|
import "./css/sider.less"
|
|
16
16
|
|
|
17
17
|
type SiderPropsType = {
|
|
18
18
|
menuList: MenuType[];
|
|
19
19
|
collapsed: boolean;
|
|
20
|
+
themeConfig?: ThemeConfig;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
@@ -42,7 +43,7 @@ const getSecoundFloorMenuList = (
|
|
|
42
43
|
return secoundFloorMenuList;
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed }) => {
|
|
46
|
+
const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed, themeConfig }) => {
|
|
46
47
|
const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
|
|
47
48
|
const { translate, getLocale } = useLocale();
|
|
48
49
|
const secoundFloorMenuList = useRef<SecoundFloorMenuList>([]);
|
|
@@ -75,7 +76,7 @@ const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed }) => {
|
|
|
75
76
|
const getMenuWithSecoundFloor = (secoundFloorMenu: SecoundFloorMenuList[number]) => {
|
|
76
77
|
return handlePropsMenuToAntdMenu(secoundFloorMenu, (menuItem) => {
|
|
77
78
|
const { disabled, label, children, icon } = menuItem;
|
|
78
|
-
const renderIcon = icon ? <IconFont type={icon} /> : "";
|
|
79
|
+
const renderIcon = (themeConfig?.showLeftMenuIcon && icon) ? <IconFont type={icon} /> : "";
|
|
79
80
|
if (disabled)
|
|
80
81
|
return (
|
|
81
82
|
<div
|
|
@@ -16,6 +16,7 @@ import headerBgImg from "./imgs/header-bg.png";
|
|
|
16
16
|
import menuItemBgImg from "./imgs/menu-item-bg.png";
|
|
17
17
|
import userImg from "./imgs/user.png";
|
|
18
18
|
import IconFont from "../layout2/components/icon-font";
|
|
19
|
+
import { ThemeConfig } from "../tmpl/interface";
|
|
19
20
|
import "./css/header.less";
|
|
20
21
|
|
|
21
22
|
// 查找当前选中菜单的顶层菜单id
|
|
@@ -49,11 +50,12 @@ type HeaderPropsType = {
|
|
|
49
50
|
menuList: MenuType[];
|
|
50
51
|
style?: any;
|
|
51
52
|
logoImg?: string;
|
|
53
|
+
themeConfig?: ThemeConfig;
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
55
57
|
|
|
56
|
-
const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, logoImg }) => {
|
|
58
|
+
const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, logoImg, themeConfig }) => {
|
|
57
59
|
const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
|
|
58
60
|
const { translate, getLocale } = useLocale();
|
|
59
61
|
const [menu, setMenu] = useState<MenuItem[]>([]);
|
|
@@ -77,7 +79,7 @@ const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, logoImg }) =>
|
|
|
77
79
|
|
|
78
80
|
const renderMenuItem = (menuItem) => {
|
|
79
81
|
const { label, id, disabled, icon } = menuItem;
|
|
80
|
-
const renderIcon = icon ? <IconFont type={icon} className="menu-icon" /> : "";
|
|
82
|
+
const renderIcon = (themeConfig?.showTopMenuIcon && icon) ? <IconFont type={icon} className="menu-icon" /> : "";
|
|
81
83
|
return <div className={`menu-item ${disabled ? "menu-disabled" : ""} ${selParentId === id ? "menu-item-selected" : ""}`} style={{ backgroundImage: selParentId === id ? `url(${menuItemBgImg})` : undefined }}><Space size={"small"}>{renderIcon}{translate("${" + label + "}")}</Space></div>;
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -86,7 +88,7 @@ const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, logoImg }) =>
|
|
|
86
88
|
if (disabled) {
|
|
87
89
|
return renderMenuItem(menuItem);
|
|
88
90
|
}
|
|
89
|
-
const renderIcon = icon ? <IconFont type={icon} /> : "";
|
|
91
|
+
const renderIcon = (themeConfig?.showTopMenuIcon && icon) ? <IconFont type={icon} /> : "";
|
|
90
92
|
const { path, target } = getLeftMostRouteInfo(menuItem);
|
|
91
93
|
if (floor === 0) {
|
|
92
94
|
return path === null ? (
|
|
@@ -171,7 +173,7 @@ const Header: React.FC<HeaderPropsType> = ({ systemName, menuList, logoImg }) =>
|
|
|
171
173
|
style={toolbarStyle}
|
|
172
174
|
/> */}
|
|
173
175
|
<div className="header-user">
|
|
174
|
-
<UserButton logoutUrl="/login4" style={{ padding: 0, color: "#fff" }} customRender={<img src={userImg} alt="" className="userButton" />} />
|
|
176
|
+
<UserButton themeConfig={themeConfig} layoutRootPath="v4" logoutUrl="/login4" style={{ padding: 0, color: "#fff" }} customRender={<img src={userImg} alt="" className="userButton" />} />
|
|
175
177
|
</div>
|
|
176
178
|
</Space>
|
|
177
179
|
</div>
|
|
@@ -14,6 +14,7 @@ import { useLocale } from "../locale/useLocale";
|
|
|
14
14
|
import { KeepAliveTab } from "../hooks/use-tabs";
|
|
15
15
|
import { getMenuConfig } from "../layout2/page";
|
|
16
16
|
import homePng from "./imgs/home.png";
|
|
17
|
+
import { ThemeConfig } from "../tmpl/interface";
|
|
17
18
|
import "./css/main.less";
|
|
18
19
|
|
|
19
20
|
const { useToken } = theme;
|
|
@@ -27,6 +28,7 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
27
28
|
const { logo } = props;
|
|
28
29
|
const [systemName, setSystemName] = useState("");
|
|
29
30
|
const [systemLogo, setSystemLogo] = useState("");
|
|
31
|
+
const [themeConfig, setThemeConfig] = useState<ThemeConfig>();
|
|
30
32
|
const [menu, setMenu] = useState<MenuType[]>([]);
|
|
31
33
|
const pageRef = useRef<HTMLDivElement>(undefined); // page ref
|
|
32
34
|
//清空缓存
|
|
@@ -36,12 +38,13 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
36
38
|
const { token: { colorPrimary } } = useToken();
|
|
37
39
|
|
|
38
40
|
const getThemeConfigAndMenuConfig = async () => {
|
|
39
|
-
const
|
|
41
|
+
const tConfig = await Units.getThemeConfig();
|
|
40
42
|
const menuConfig = await getMenuConfig("v4");
|
|
41
|
-
setSystemName(
|
|
42
|
-
setSystemLogo(
|
|
43
|
+
setSystemName(tConfig?.programName || menuConfig?.systemName);
|
|
44
|
+
setSystemLogo(tConfig?.programIcon || homePng);
|
|
43
45
|
setMenu(menuConfig?.menu);
|
|
44
46
|
updateMenuItemIdToFirstFloorIdxMap(menuConfig?.menu);
|
|
47
|
+
setThemeConfig(tConfig);
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
useEffect(() => {
|
|
@@ -84,9 +87,9 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
84
87
|
card={{ className: "v4-antd-card" }}
|
|
85
88
|
>
|
|
86
89
|
<Layout style={{ height: "100%" }} className={compactTheme ? "layout-compactTheme" : undefined}>
|
|
87
|
-
<Header logoImg={logo || systemLogo} systemName={systemName ? systemName : Units.programName_NavLeft()} menuList={menu}></Header>
|
|
90
|
+
<Header themeConfig={themeConfig} logoImg={logo || systemLogo} systemName={systemName ? systemName : Units.programName_NavLeft()} menuList={menu}></Header>
|
|
88
91
|
<Layout>
|
|
89
|
-
<Sider menuList={menu} collapsed={getSiderCollapsed()}></Sider>
|
|
92
|
+
<Sider themeConfig={themeConfig} menuList={menu} collapsed={getSiderCollapsed()}></Sider>
|
|
90
93
|
<Main>{props.children}</Main>
|
|
91
94
|
</Layout>
|
|
92
95
|
</Layout>
|
|
@@ -10,13 +10,14 @@ import { useLayoutContext } from "../layout2/layout-context";
|
|
|
10
10
|
import { MenuType } from "../layout2/type/layout-type";
|
|
11
11
|
import { useLocale } from "../locale/useLocale";
|
|
12
12
|
import IconFont from "../layout2/components/icon-font";
|
|
13
|
-
import { UserInfo } from "../tmpl/interface";
|
|
13
|
+
import { UserInfo, ThemeConfig } from "../tmpl/interface";
|
|
14
14
|
import Units from "../units";
|
|
15
15
|
import "./css/sider.less"
|
|
16
16
|
|
|
17
17
|
type SiderPropsType = {
|
|
18
18
|
menuList: MenuType[];
|
|
19
19
|
collapsed: boolean;
|
|
20
|
+
themeConfig?: ThemeConfig;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
@@ -44,7 +45,7 @@ const getSecoundFloorMenuList = (
|
|
|
44
45
|
|
|
45
46
|
const { useToken } = theme;
|
|
46
47
|
|
|
47
|
-
const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed }) => {
|
|
48
|
+
const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed, themeConfig }) => {
|
|
48
49
|
const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
|
|
49
50
|
const { translate, getLocale } = useLocale();
|
|
50
51
|
const secoundFloorMenuList = useRef<SecoundFloorMenuList>([]);
|
|
@@ -78,7 +79,7 @@ const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed }) => {
|
|
|
78
79
|
const getMenuWithSecoundFloor = (secoundFloorMenu: SecoundFloorMenuList[number]) => {
|
|
79
80
|
return handlePropsMenuToAntdMenu(secoundFloorMenu, (menuItem) => {
|
|
80
81
|
const { disabled, label, children, icon } = menuItem;
|
|
81
|
-
const renderIcon = icon ? <IconFont type={icon} /> : "";
|
|
82
|
+
const renderIcon = (themeConfig?.showLeftMenuIcon && icon) ? <IconFont type={icon} /> : "";
|
|
82
83
|
if (disabled)
|
|
83
84
|
return (
|
|
84
85
|
<div
|
|
@@ -13,6 +13,7 @@ import { MenuType } from "../layout2/type/layout-type";
|
|
|
13
13
|
import { useLocale } from "../locale/useLocale";
|
|
14
14
|
import { getLeftMostRouteInfo, handlePropsMenuToAntdMenu } from "../layout2/util/menu-util";
|
|
15
15
|
import IconFont from "../layout2/components/icon-font";
|
|
16
|
+
import { ThemeConfig } from "../tmpl/interface";
|
|
16
17
|
import "./css/header.less";
|
|
17
18
|
|
|
18
19
|
const { useToken } = theme;
|
|
@@ -43,10 +44,11 @@ const findPathToRoot = (menus, targetId) => {
|
|
|
43
44
|
|
|
44
45
|
type HeaderPropsType = {
|
|
45
46
|
menuList: MenuType[];
|
|
47
|
+
themeConfig?: ThemeConfig;
|
|
46
48
|
};
|
|
47
49
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
48
50
|
|
|
49
|
-
const Header: React.FC<HeaderPropsType> = ({ menuList }) => {
|
|
51
|
+
const Header: React.FC<HeaderPropsType> = ({ menuList, themeConfig }) => {
|
|
50
52
|
const { token: { colorPrimary } } = useToken();
|
|
51
53
|
const { translate, getLocale } = useLocale();
|
|
52
54
|
const { changeSiderCollapsed, getSiderCollapsed } = useLocale();
|
|
@@ -189,7 +191,7 @@ const Header: React.FC<HeaderPropsType> = ({ menuList }) => {
|
|
|
189
191
|
type="link"
|
|
190
192
|
style={toolbarStyle}
|
|
191
193
|
/> */}
|
|
192
|
-
<UserButton logoutUrl="/login2" style={{ padding: 0, color: "#000" }} />
|
|
194
|
+
<UserButton themeConfig={themeConfig} layoutRootPath="v5" logoutUrl="/login2" style={{ padding: 0, color: "#000" }} />
|
|
193
195
|
</Space>
|
|
194
196
|
</Layout.Header>
|
|
195
197
|
);
|
|
@@ -13,6 +13,7 @@ import Units from '../units';
|
|
|
13
13
|
import { useLocale } from "../locale/useLocale";
|
|
14
14
|
import { KeepAliveTab } from "../hooks/use-tabs";
|
|
15
15
|
import { getMenuConfig } from "../layout2/page";
|
|
16
|
+
import { ThemeConfig } from "../tmpl/interface";
|
|
16
17
|
import homePng from "./imgs/home.png";
|
|
17
18
|
|
|
18
19
|
const { useToken } = theme;
|
|
@@ -26,6 +27,7 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
26
27
|
const { logo } = props;
|
|
27
28
|
const [systemName, setSystemName] = useState("");
|
|
28
29
|
const [systemLogo, setSystemLogo] = useState("");
|
|
30
|
+
const [themeConfig, setThemeConfig] = useState<ThemeConfig>();
|
|
29
31
|
const [menu, setMenu] = useState<MenuType[]>([]);
|
|
30
32
|
const pageRef = useRef<HTMLDivElement>(undefined); // page ref
|
|
31
33
|
//清空缓存
|
|
@@ -35,12 +37,13 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
35
37
|
const { token: { colorPrimary } } = useToken();
|
|
36
38
|
|
|
37
39
|
const getThemeConfigAndMenuConfig = async () => {
|
|
38
|
-
const
|
|
40
|
+
const tConfig = await Units.getThemeConfig();
|
|
39
41
|
const menuConfig = await getMenuConfig("v5");
|
|
40
|
-
setSystemName(
|
|
41
|
-
setSystemLogo(
|
|
42
|
+
setSystemName(tConfig?.programName || menuConfig?.systemName);
|
|
43
|
+
setSystemLogo(tConfig?.programIcon || homePng);
|
|
42
44
|
setMenu(menuConfig?.menu);
|
|
43
45
|
updateMenuItemIdToFirstFloorIdxMap(menuConfig?.menu);
|
|
46
|
+
setThemeConfig(tConfig);
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
useEffect(() => {
|
|
@@ -65,9 +68,9 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
65
68
|
algorithm: compactTheme ? [theme.compactAlgorithm] : [],
|
|
66
69
|
}}>
|
|
67
70
|
<Layout style={{ height: "100%" }} className={compactTheme ? "layout-compactTheme" : undefined}>
|
|
68
|
-
<Sider logoImg={logo || systemLogo} menuList={menu} collapsed={getSiderCollapsed()} systemName={systemName ? systemName : Units.programName_NavLeft()} />
|
|
71
|
+
<Sider themeConfig={themeConfig} logoImg={logo || systemLogo} menuList={menu} collapsed={getSiderCollapsed()} systemName={systemName ? systemName : Units.programName_NavLeft()} />
|
|
69
72
|
<Layout>
|
|
70
|
-
<Header menuList={menu} />
|
|
73
|
+
<Header themeConfig={themeConfig} menuList={menu} />
|
|
71
74
|
<Main>{props.children}</Main>
|
|
72
75
|
</Layout>
|
|
73
76
|
</Layout>
|
|
@@ -11,7 +11,7 @@ import { useLayoutContext } from "../layout2/layout-context";
|
|
|
11
11
|
import { MenuType } from "../layout2/type/layout-type";
|
|
12
12
|
import { useLocale } from "../locale/useLocale";
|
|
13
13
|
import IconFont from "../layout2/components/icon-font";
|
|
14
|
-
import { UserInfo } from "../tmpl/interface";
|
|
14
|
+
import { UserInfo, ThemeConfig } from "../tmpl/interface";
|
|
15
15
|
import Units from "../units";
|
|
16
16
|
import "./css/sider.less";
|
|
17
17
|
|
|
@@ -20,6 +20,7 @@ type SiderPropsType = {
|
|
|
20
20
|
collapsed: boolean;
|
|
21
21
|
systemName: string;
|
|
22
22
|
logoImg?: string;
|
|
23
|
+
themeConfig?: ThemeConfig;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
type MenuItem = Required<MenuProps>["items"][number];
|
|
@@ -47,7 +48,7 @@ const getSecoundFloorMenuList = (
|
|
|
47
48
|
|
|
48
49
|
const { useToken } = theme;
|
|
49
50
|
|
|
50
|
-
const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed, systemName, logoImg }) => {
|
|
51
|
+
const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed, systemName, logoImg, themeConfig }) => {
|
|
51
52
|
const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
|
|
52
53
|
const { translate, getLocale } = useLocale();
|
|
53
54
|
const secoundFloorMenuList = useRef<SecoundFloorMenuList>([]);
|
|
@@ -82,7 +83,7 @@ const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed, systemName, logo
|
|
|
82
83
|
const getMenuWithSecoundFloor = (secoundFloorMenu: SecoundFloorMenuList[number]) => {
|
|
83
84
|
return handlePropsMenuToAntdMenu(secoundFloorMenu, (menuItem) => {
|
|
84
85
|
const { disabled, label, children, icon } = menuItem;
|
|
85
|
-
const renderIcon = icon ? <IconFont type={icon} /> : "";
|
|
86
|
+
const renderIcon = (themeConfig?.showLeftMenuIcon && icon) ? <IconFont type={icon} /> : "";
|
|
86
87
|
if (disabled)
|
|
87
88
|
return (
|
|
88
89
|
<div
|
|
@@ -37,7 +37,7 @@ const Index = (props: Props) => {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
const value = item[itemConfig.id];
|
|
40
|
-
const element = <ViewControl serverKey={serverKey} holderType="table" value={value} fieldConfig={type === "mainPicture" ? { ...itemConfig, preview: false } : itemConfig} />;
|
|
40
|
+
const element = <ViewControl serverKey={serverKey} holderType="table" value={value} fieldConfig={type === "mainPicture" ? { ...itemConfig, isFallback: true, preview: false } : itemConfig} />;
|
|
41
41
|
const title = itemConfig.title;
|
|
42
42
|
return { element, value, title };
|
|
43
43
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as echarts from 'echarts';
|
|
2
2
|
import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import _ from 'lodash';
|
|
4
|
+
import { Spin } from "antd";
|
|
4
5
|
import HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
5
6
|
import { DataConfigProps } from "../data";
|
|
6
7
|
|
|
@@ -79,7 +80,7 @@ export interface ComponentStyle {
|
|
|
79
80
|
|
|
80
81
|
export interface ComponentProps {
|
|
81
82
|
style?: ComponentStyle;
|
|
82
|
-
base: { width: number, height: number }
|
|
83
|
+
base: { width: number, height: number };
|
|
83
84
|
data?: DataConfigProps;
|
|
84
85
|
isDesignMode?: boolean; // 是否编辑模式
|
|
85
86
|
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
@@ -99,6 +100,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
99
100
|
const [data, setData] = useState<{ name: string, data: any }[]>([]);
|
|
100
101
|
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
101
102
|
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
103
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
102
104
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
103
105
|
const chart = useRef<any>(null);
|
|
104
106
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -155,7 +157,9 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
155
157
|
|
|
156
158
|
// 请求数据
|
|
157
159
|
const getData = async (params?: object) => {
|
|
160
|
+
setLoading(true);
|
|
158
161
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
162
|
+
setLoading(false);
|
|
159
163
|
const { config, value } = data || {};
|
|
160
164
|
const temData = handleData(value);
|
|
161
165
|
setData(temData);
|
|
@@ -238,7 +242,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
238
242
|
}
|
|
239
243
|
}, [size]);
|
|
240
244
|
|
|
241
|
-
|
|
245
|
+
const renderChartDom = () => <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
|
|
246
|
+
|
|
247
|
+
if (isDesignMode) {
|
|
248
|
+
return renderChartDom();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return <Spin spinning={loading}>{renderChartDom()}</Spin>;
|
|
242
252
|
});
|
|
243
253
|
|
|
244
254
|
export default Index;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as echarts from 'echarts';
|
|
2
2
|
import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import _ from 'lodash';
|
|
4
|
+
import { Spin } from "antd";
|
|
4
5
|
import ProgramConfig from "../../units";
|
|
5
6
|
import chinaJson from "../assets/china.json";
|
|
6
7
|
import HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
@@ -87,7 +88,7 @@ export interface ComponentStyle {
|
|
|
87
88
|
|
|
88
89
|
export interface ComponentProps {
|
|
89
90
|
style?: ComponentStyle;
|
|
90
|
-
base: { width: number, height: number }
|
|
91
|
+
base: { width: number, height: number };
|
|
91
92
|
data?: DataConfigProps;
|
|
92
93
|
isDesignMode?: boolean; // 是否编辑模式
|
|
93
94
|
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
@@ -106,6 +107,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
106
107
|
const [data, setData] = useState<{ name: string, value: number[] }[]>([]);
|
|
107
108
|
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
108
109
|
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
110
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
109
111
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
110
112
|
const chart = useRef<any>(null);
|
|
111
113
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -157,7 +159,9 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
157
159
|
|
|
158
160
|
// 请求数据
|
|
159
161
|
const getData = async (params?: object) => {
|
|
162
|
+
setLoading(true);
|
|
160
163
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
164
|
+
setLoading(false);
|
|
161
165
|
const { config, value } = data || {};
|
|
162
166
|
setData(handleData(value));
|
|
163
167
|
return config;
|
|
@@ -267,7 +271,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
267
271
|
}
|
|
268
272
|
}, [size]);
|
|
269
273
|
|
|
270
|
-
|
|
274
|
+
const renderChartDom = () => <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
|
|
275
|
+
|
|
276
|
+
if (isDesignMode) {
|
|
277
|
+
return renderChartDom();
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return <Spin spinning={loading}>{renderChartDom()}</Spin>;
|
|
271
281
|
});
|
|
272
282
|
|
|
273
283
|
export default Index;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as echarts from 'echarts';
|
|
2
2
|
import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import _ from 'lodash';
|
|
4
|
+
import { Spin } from "antd";
|
|
4
5
|
import HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
5
6
|
import { DataConfigProps } from "../data";
|
|
6
7
|
|
|
@@ -97,7 +98,7 @@ export interface ComponentStyle {
|
|
|
97
98
|
|
|
98
99
|
export interface ComponentProps {
|
|
99
100
|
style?: ComponentStyle;
|
|
100
|
-
base: { width: number, height: number }
|
|
101
|
+
base: { width: number, height: number };
|
|
101
102
|
data?: DataConfigProps;
|
|
102
103
|
isDesignMode?: boolean; // 是否编辑模式
|
|
103
104
|
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
@@ -117,6 +118,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
117
118
|
const [data, setData] = useState<{ name: string, data: any }[]>([]);
|
|
118
119
|
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
119
120
|
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
121
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
120
122
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
121
123
|
const chart = useRef<any>(null);
|
|
122
124
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -173,7 +175,9 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
173
175
|
|
|
174
176
|
// 请求数据
|
|
175
177
|
const getData = async (params?: object) => {
|
|
178
|
+
setLoading(true);
|
|
176
179
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
180
|
+
setLoading(false);
|
|
177
181
|
const { config, value } = data || {};
|
|
178
182
|
const temData = handleData(value);
|
|
179
183
|
setData(temData);
|
|
@@ -260,7 +264,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
260
264
|
}
|
|
261
265
|
}, [size]);
|
|
262
266
|
|
|
263
|
-
|
|
267
|
+
const renderChartDom = () => <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
|
|
268
|
+
|
|
269
|
+
if (isDesignMode) {
|
|
270
|
+
return renderChartDom();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return <Spin spinning={loading}>{renderChartDom()}</Spin>;
|
|
264
274
|
});
|
|
265
275
|
|
|
266
276
|
export default Index;
|