aldehyde 0.2.420 → 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/search-menu.js +1 -1
- package/lib/layout2/components/search-menu.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 +27 -7
- 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/component/screen-fit/index.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js +2 -0
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.less +2 -1
- package/lib/lowcode-components/lowcode-view/index.d.ts +2 -1
- package/lib/lowcode-components/lowcode-view/index.d.ts.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.js +2 -2
- package/lib/lowcode-components/lowcode-view/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/routable/ltmpl-route.d.ts +2 -1
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +11 -5
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/routable/splitview-ltmpl-route.d.ts.map +1 -1
- package/lib/routable/splitview-ltmpl-route.js +11 -4
- package/lib/routable/splitview-ltmpl-route.js.map +1 -1
- package/lib/table/act-table.d.ts +4 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +37 -12
- 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 +29 -2
- package/lib/table/page-config-button.d.ts +15 -0
- package/lib/table/page-config-button.d.ts.map +1 -0
- package/lib/table/page-config-button.js +156 -0
- package/lib/table/page-config-button.js.map +1 -0
- 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 +9 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +154 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +21 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/units/index.d.ts +9 -4
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +49 -13
- package/lib/units/index.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/search-menu.tsx +1 -1
- package/src/aldehyde/layout2/components/user-button.tsx +45 -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/component/screen-fit/index.less +2 -1
- package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.tsx +3 -1
- package/src/aldehyde/lowcode-components/lowcode-view/index.less +7 -0
- package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +3 -1
- 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/routable/ltmpl-route.tsx +13 -5
- package/src/aldehyde/routable/splitview-ltmpl-route.tsx +12 -3
- package/src/aldehyde/table/act-table.tsx +44 -13
- package/src/aldehyde/table/column/column-builder.tsx +13 -20
- package/src/aldehyde/table/index.css +29 -2
- package/src/aldehyde/table/page-config-button.tsx +199 -0
- package/src/aldehyde/table/pagination.tsx +8 -7
- package/src/aldehyde/table/query-table.tsx +1 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +136 -0
- package/src/aldehyde/tmpl/interface.tsx +22 -0
- package/src/aldehyde/units/index.tsx +34 -3
- 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
|
@@ -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;
|
|
@@ -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
|
|
|
@@ -84,7 +85,7 @@ export interface ComponentStyle {
|
|
|
84
85
|
|
|
85
86
|
export interface ComponentProps {
|
|
86
87
|
style?: ComponentStyle;
|
|
87
|
-
base: { width: number, height: number }
|
|
88
|
+
base: { width: number, height: number };
|
|
88
89
|
data?: DataConfigProps;
|
|
89
90
|
isDesignMode?: boolean; // 是否编辑模式
|
|
90
91
|
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
@@ -104,6 +105,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
104
105
|
const [data, setData] = useState<number>(0);
|
|
105
106
|
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
106
107
|
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
108
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
107
109
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
108
110
|
const chart = useRef<any>(null);
|
|
109
111
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -160,7 +162,9 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
160
162
|
|
|
161
163
|
// 请求数据
|
|
162
164
|
const getData = async (params?: object) => {
|
|
165
|
+
setLoading(true);
|
|
163
166
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
167
|
+
setLoading(false);
|
|
164
168
|
const { config, value } = data || {};
|
|
165
169
|
const temData = value?.[0]?.value?.[0]?.v1 || 0;
|
|
166
170
|
setData(temData * 100);
|
|
@@ -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 HydrocarbonService from "../../tmpl/hcservice-v3";
|
|
5
6
|
import { DataConfigProps } from "../data";
|
|
6
7
|
|
|
@@ -133,7 +134,7 @@ export interface ComponentStyle {
|
|
|
133
134
|
|
|
134
135
|
export interface ComponentProps {
|
|
135
136
|
style?: ComponentStyle;
|
|
136
|
-
base: { width: number, height: number, type: string }
|
|
137
|
+
base: { width: number, height: number, type: string };
|
|
137
138
|
data?: DataConfigProps;
|
|
138
139
|
isDesignMode?: boolean; // 是否编辑模式
|
|
139
140
|
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
@@ -153,6 +154,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
153
154
|
const [data, setData] = useState([]);
|
|
154
155
|
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
155
156
|
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
157
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
156
158
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
157
159
|
const chart = useRef<any>(null);
|
|
158
160
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -212,7 +214,9 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
212
214
|
|
|
213
215
|
// 请求数据
|
|
214
216
|
const getData = async (params?: object) => {
|
|
217
|
+
setLoading(true);
|
|
215
218
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
219
|
+
setLoading(false);
|
|
216
220
|
const { config, value } = data || {};
|
|
217
221
|
const temData = handleData(value);
|
|
218
222
|
setData(temData);
|
|
@@ -407,7 +411,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
407
411
|
}
|
|
408
412
|
}, [size]);
|
|
409
413
|
|
|
410
|
-
|
|
414
|
+
const renderChartDom = () => <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
|
|
415
|
+
|
|
416
|
+
if (isDesignMode) {
|
|
417
|
+
return renderChartDom();
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
return <Spin spinning={loading}>{renderChartDom()}</Spin>;
|
|
411
421
|
});
|
|
412
422
|
|
|
413
423
|
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
|
|
|
@@ -101,7 +102,7 @@ export interface ComponentStyle {
|
|
|
101
102
|
|
|
102
103
|
export interface ComponentProps {
|
|
103
104
|
style?: ComponentStyle;
|
|
104
|
-
base: { width: number, height: number, type: string }
|
|
105
|
+
base: { width: number, height: number, type: string };
|
|
105
106
|
data?: DataConfigProps;
|
|
106
107
|
isDesignMode?: boolean; // 是否编辑模式
|
|
107
108
|
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
@@ -121,6 +122,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
121
122
|
const [data, setData] = useState<{ name: string, data: any }[]>([]);
|
|
122
123
|
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
123
124
|
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
125
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
124
126
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
125
127
|
const chart = useRef<any>(null);
|
|
126
128
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -177,7 +179,9 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
177
179
|
|
|
178
180
|
// 请求数据
|
|
179
181
|
const getData = async (params?: object) => {
|
|
182
|
+
setLoading(true);
|
|
180
183
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
184
|
+
setLoading(false);
|
|
181
185
|
const { config, value } = data || {};
|
|
182
186
|
const temData = handleData(value);
|
|
183
187
|
setData(temData);
|
|
@@ -261,7 +265,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
261
265
|
}
|
|
262
266
|
}, [size]);
|
|
263
267
|
|
|
264
|
-
|
|
268
|
+
const renderChartDom = () => <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
|
|
269
|
+
|
|
270
|
+
if (isDesignMode) {
|
|
271
|
+
return renderChartDom();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return <Spin spinning={loading}>{renderChartDom()}</Spin>;
|
|
265
275
|
});
|
|
266
276
|
|
|
267
277
|
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";
|
|
@@ -113,7 +114,7 @@ export interface ComponentStyle {
|
|
|
113
114
|
|
|
114
115
|
export interface ComponentProps {
|
|
115
116
|
style?: ComponentStyle;
|
|
116
|
-
base: { width: number, height: number }
|
|
117
|
+
base: { width: number, height: number };
|
|
117
118
|
data?: DataConfigProps;
|
|
118
119
|
isDesignMode?: boolean; // 是否编辑模式
|
|
119
120
|
initSearchParams?: { [key: string]: any }; // 全局初始化外部参数,例:传参包含设备id,则在查询时带上设备id
|
|
@@ -132,6 +133,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
132
133
|
const [data, setData] = useState<{ name: string, value: number[] }[]>([]);
|
|
133
134
|
const [searchParams, setSearchParams] = useState<{ [key: string]: any }>();
|
|
134
135
|
const [initSearchParams, setInitSearchParams] = useState<{ [key: string]: any }>();
|
|
136
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
135
137
|
const chartRef = useRef<HTMLDivElement>(null);
|
|
136
138
|
const chart = useRef<any>(null);
|
|
137
139
|
const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
|
|
@@ -183,7 +185,9 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
183
185
|
|
|
184
186
|
// 请求数据
|
|
185
187
|
const getData = async (params?: object) => {
|
|
188
|
+
setLoading(true);
|
|
186
189
|
const { data } = await HydrocarbonService.requestChartData(null, dataConfig?.sourceId, params) || {};
|
|
190
|
+
setLoading(false);
|
|
187
191
|
const { config, value } = data || {};
|
|
188
192
|
setData(handleData(value));
|
|
189
193
|
return config;
|
|
@@ -290,7 +294,13 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
|
|
|
290
294
|
}
|
|
291
295
|
}, [size]);
|
|
292
296
|
|
|
293
|
-
|
|
297
|
+
const renderChartDom = () => <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
|
|
298
|
+
|
|
299
|
+
if (isDesignMode) {
|
|
300
|
+
return renderChartDom();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return <Spin spinning={loading}>{renderChartDom()}</Spin>;
|
|
294
304
|
});
|
|
295
305
|
|
|
296
306
|
export default Index;
|