aldehyde 0.2.409 → 0.2.410

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.
Files changed (127) hide show
  1. package/lib/controls/enum-badge/index.d.ts.map +1 -1
  2. package/lib/controls/enum-badge/index.js +1 -1
  3. package/lib/controls/enum-badge/index.js.map +1 -1
  4. package/lib/controls/enum-tag/index.d.ts.map +1 -1
  5. package/lib/controls/enum-tag/index.js +3 -4
  6. package/lib/controls/enum-tag/index.js.map +1 -1
  7. package/lib/controls/html-editor/draft.d.ts +2 -1
  8. package/lib/controls/html-editor/draft.d.ts.map +1 -1
  9. package/lib/controls/html-editor/draft.js +3 -5
  10. package/lib/controls/html-editor/draft.js.map +1 -1
  11. package/lib/controls/html-editor/index.less +68 -0
  12. package/lib/detail/edit/popover-edit-card.js +1 -1
  13. package/lib/detail/edit/popover-edit-card.js.map +1 -1
  14. package/lib/detail/edit/popover-editor.d.ts.map +1 -1
  15. package/lib/detail/edit/popover-editor.js +1 -3
  16. package/lib/detail/edit/popover-editor.js.map +1 -1
  17. package/lib/index.d.ts +4 -3
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +4 -3
  20. package/lib/index.js.map +1 -1
  21. package/lib/layout/menu/l2menu-message-bar.d.ts +1 -0
  22. package/lib/layout/menu/l2menu-message-bar.d.ts.map +1 -1
  23. package/lib/layout/menu/l2menu-message-bar.js +3 -2
  24. package/lib/layout/menu/l2menu-message-bar.js.map +1 -1
  25. package/lib/layout/menu/message-bar.less +69 -0
  26. package/lib/layout2/page.d.ts +4 -0
  27. package/lib/layout2/page.d.ts.map +1 -1
  28. package/lib/layout2/page.js +4 -2
  29. package/lib/layout2/page.js.map +1 -1
  30. package/lib/layout2/type/layout-type.d.ts +2 -0
  31. package/lib/layout2/type/layout-type.d.ts.map +1 -1
  32. package/lib/layout4/css/main.less +1 -1
  33. package/lib/list/vertical-list/index.d.ts +2 -3
  34. package/lib/list/vertical-list/index.d.ts.map +1 -1
  35. package/lib/list/vertical-list/index.js +7 -39
  36. package/lib/list/vertical-list/index.js.map +1 -1
  37. package/lib/list/vertical-list/index.less +104 -15
  38. package/lib/list/vertical-list/item.d.ts +13 -0
  39. package/lib/list/vertical-list/item.d.ts.map +1 -0
  40. package/lib/list/vertical-list/item.js +88 -0
  41. package/lib/list/vertical-list/item.js.map +1 -0
  42. package/lib/module/ltmpl-table.d.ts +4 -1
  43. package/lib/module/ltmpl-table.d.ts.map +1 -1
  44. package/lib/module/ltmpl-table.js +3 -2
  45. package/lib/module/ltmpl-table.js.map +1 -1
  46. package/lib/sso-Login/index.d.ts +7 -0
  47. package/lib/sso-Login/index.d.ts.map +1 -0
  48. package/lib/sso-Login/index.js +51 -0
  49. package/lib/sso-Login/index.js.map +1 -0
  50. package/lib/table/act-table.d.ts +2 -0
  51. package/lib/table/act-table.d.ts.map +1 -1
  52. package/lib/table/act-table.js +3 -2
  53. package/lib/table/act-table.js.map +1 -1
  54. package/lib/table/query-table.d.ts +1 -0
  55. package/lib/table/query-table.d.ts.map +1 -1
  56. package/lib/table/query-table.js +7 -5
  57. package/lib/table/query-table.js.map +1 -1
  58. package/lib/tmpl/hcservice-v3.d.ts +4 -0
  59. package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
  60. package/lib/tmpl/hcservice-v3.js +12 -0
  61. package/lib/tmpl/hcservice-v3.js.map +1 -1
  62. package/lib/tmpl/interface.d.ts +8 -1
  63. package/lib/tmpl/interface.d.ts.map +1 -1
  64. package/lib/tmpl/interface.js.map +1 -1
  65. package/lib/welcome/HCWelcome.js +45 -20
  66. package/lib/welcome/HCWelcome.js.map +1 -1
  67. package/lib/welcome/components/menu-card.d.ts +10 -0
  68. package/lib/welcome/components/menu-card.d.ts.map +1 -0
  69. package/lib/welcome/components/menu-card.js +43 -0
  70. package/lib/welcome/components/menu-card.js.map +1 -0
  71. package/lib/welcome/components/menu-card.less +96 -0
  72. package/lib/welcome/components/page-card.d.ts +16 -0
  73. package/lib/welcome/components/page-card.d.ts.map +1 -0
  74. package/lib/welcome/components/page-card.js +82 -0
  75. package/lib/welcome/components/page-card.js.map +1 -0
  76. package/lib/welcome/components/page-card.less +50 -0
  77. package/lib/welcome/components/quick-entrance.d.ts +14 -0
  78. package/lib/welcome/components/quick-entrance.d.ts.map +1 -0
  79. package/lib/welcome/components/quick-entrance.js +66 -0
  80. package/lib/welcome/components/quick-entrance.js.map +1 -0
  81. package/lib/welcome/components/quick-entrance.less +121 -0
  82. package/lib/welcome/components/workbench.d.ts +14 -0
  83. package/lib/welcome/components/workbench.d.ts.map +1 -0
  84. package/lib/welcome/components/workbench.js +114 -0
  85. package/lib/welcome/components/workbench.js.map +1 -0
  86. package/lib/welcome/components/workbench.less +119 -0
  87. package/package.json +1 -1
  88. package/src/aldehyde/controls/enum-badge/index.tsx +2 -1
  89. package/src/aldehyde/controls/enum-tag/index.tsx +9 -12
  90. package/src/aldehyde/controls/html-editor/draft.tsx +27 -31
  91. package/src/aldehyde/controls/html-editor/index.less +68 -0
  92. package/src/aldehyde/detail/edit/popover-edit-card.tsx +3 -3
  93. package/src/aldehyde/detail/edit/popover-editor.tsx +20 -22
  94. package/src/aldehyde/index.tsx +6 -3
  95. package/src/aldehyde/layout/menu/l2menu-message-bar.tsx +4 -1
  96. package/src/aldehyde/layout/menu/message-bar.less +69 -0
  97. package/src/aldehyde/layout2/page.tsx +6 -3
  98. package/src/aldehyde/layout2/type/layout-type.ts +2 -0
  99. package/src/aldehyde/layout4/css/main.less +1 -1
  100. package/src/aldehyde/list/vertical-list/index.less +104 -15
  101. package/src/aldehyde/list/vertical-list/index.tsx +10 -70
  102. package/src/aldehyde/list/vertical-list/item.tsx +130 -0
  103. package/src/aldehyde/module/ltmpl-table.tsx +7 -2
  104. package/src/aldehyde/sso-Login/index.tsx +49 -0
  105. package/src/aldehyde/table/act-table.tsx +4 -1
  106. package/src/aldehyde/table/query-table.tsx +8 -7
  107. package/src/aldehyde/tmpl/hcservice-v3.tsx +12 -0
  108. package/src/aldehyde/tmpl/interface.tsx +6 -1
  109. package/src/aldehyde/welcome/HCWelcome.js +54 -28
  110. package/src/aldehyde/welcome/components/menu-card.less +96 -0
  111. package/src/aldehyde/welcome/components/menu-card.tsx +68 -0
  112. package/src/aldehyde/welcome/components/page-card.less +50 -0
  113. package/src/aldehyde/welcome/components/page-card.tsx +93 -0
  114. package/src/aldehyde/welcome/components/quick-entrance.less +121 -0
  115. package/src/aldehyde/welcome/components/quick-entrance.tsx +80 -0
  116. package/src/aldehyde/welcome/components/workbench.less +119 -0
  117. package/src/aldehyde/welcome/components/workbench.tsx +144 -0
  118. package/lib/welcome/quick-entrance.d.ts +0 -37
  119. package/lib/welcome/quick-entrance.d.ts.map +0 -1
  120. package/lib/welcome/quick-entrance.js +0 -93
  121. package/lib/welcome/quick-entrance.js.map +0 -1
  122. package/lib/welcome/workbench.d.ts +0 -37
  123. package/lib/welcome/workbench.d.ts.map +0 -1
  124. package/lib/welcome/workbench.js +0 -92
  125. package/lib/welcome/workbench.js.map +0 -1
  126. package/src/aldehyde/welcome/quick-entrance.tsx +0 -100
  127. package/src/aldehyde/welcome/workbench.tsx +0 -102
@@ -0,0 +1,130 @@
1
+ import React, { useEffect, useState, useMemo } from "react";
2
+ import { Row, Col, Space, Button, Descriptions } from "antd";
3
+ import { DownOutlined, UpOutlined } from '@ant-design/icons';
4
+ import { useLocale } from "../../locale/useLocale";
5
+ import ViewControl from "../../controls/view-control";
6
+ import { CardListConfig, FieldConfig } from "../../tmpl/interface";
7
+ import "./index.less";
8
+
9
+ type Props = {
10
+ listConfig?: CardListConfig;
11
+ current?: any;
12
+ renderOpt?: React.ReactNode;
13
+ serverKey?: string;
14
+ columnConfigs?: FieldConfig[];
15
+ };
16
+
17
+ const dataKeys = ["primaryColumn", "primaryColumnLabel", "secondColumn", "secondColumnLabel", "cardShowCols", "labelColumn", "mainPicture", "mainPictureLabel"];
18
+
19
+ const Index = (props: Props) => {
20
+ const { listConfig, current, renderOpt, serverKey, columnConfigs } = props;
21
+ const [detailOpen, setDetailOpen] = useState<boolean>(false);
22
+ const [listIds, setListIds] = useState<string[]>([]);
23
+ const { translate } = useLocale();
24
+
25
+ const initViewList = () => {
26
+ const formItemList = [];
27
+ if (columnConfigs.length > 0) {
28
+ columnConfigs.forEach((item, index) => {
29
+ if (!["10000", "20000", ...listIds].includes(item.id) && !["操作", "序号"].includes(item.title)) {
30
+ let fieldValue = current ? current[item.id] : undefined;
31
+ //fieldValue 没有值时不能为null 要为 undefined。antd input所限制
32
+ fieldValue = fieldValue ? fieldValue : item.defaultValue ? item.defaultValue : undefined;
33
+ const formItem = (
34
+ <Descriptions.Item
35
+ label={translate("${" + item.title + "}")}
36
+ key={index}
37
+ >
38
+ <ViewControl
39
+ serverKey={serverKey}
40
+ holderType={"table"}
41
+ value={fieldValue}
42
+ fieldConfig={item}
43
+ />
44
+ </Descriptions.Item>
45
+ );
46
+ formItemList.push(formItem);
47
+ }
48
+ });
49
+ }
50
+ return formItemList;
51
+ };
52
+
53
+ const handleData = (item, type: string) => {
54
+ const itemConfig = listConfig[type];
55
+ if (!itemConfig) {
56
+ return "";
57
+ }
58
+ if (type === "cardShowCols") {
59
+ return itemConfig.map(r => {
60
+ const value = item[r.id];
61
+ const element = <ViewControl serverKey={serverKey} holderType="table" value={value} fieldConfig={r} />;
62
+ const title = r.title;
63
+ return { element, value, title, id: r.id };
64
+ });
65
+ }
66
+ const value = item[itemConfig.id];
67
+ const element = <ViewControl serverKey={serverKey} holderType="table" value={value} fieldConfig={type === "mainPicture" ? { ...itemConfig, preview: false } : itemConfig} />;
68
+ const title = itemConfig.title;
69
+ return { element, value, title, id: itemConfig.id };
70
+ }
71
+
72
+ const temData = useMemo(() => {
73
+ const dataObj = dataKeys.reduce((total, next) => {
74
+ total[next] = handleData(current, next);
75
+ return total;
76
+ }, {});
77
+ const ids = Object.values(dataObj).flat().filter(Boolean).map((r: any) => r.id);
78
+ setListIds(ids);
79
+ return dataObj;
80
+ }, [current]);
81
+
82
+ return <div className="list-item">
83
+ <div className="list-item-head">
84
+ <div className="list-item-head-title">
85
+ {temData["primaryColumn"] ?
86
+ <div className="list-item-head-primary">
87
+ <div className="primary-column">{temData["primaryColumn"]?.element}</div>
88
+ <div className="primary-column-label">{temData["primaryColumnLabel"]?.element}</div>
89
+ </div>
90
+ : ""}
91
+ <div className="label-column">{temData["labelColumn"]?.element}</div>
92
+ </div>
93
+ <div className="list-item-head-title">
94
+ {temData["secondColumn"] ?
95
+ <div className="list-item-head-second">
96
+ <div className="second-column">{temData["secondColumn"].value ? temData["secondColumn"]?.element : "-"}</div>
97
+ <div className="second-column-label">{temData["secondColumnLabel"]?.element}</div>
98
+ </div>
99
+ : ""}
100
+ </div>
101
+ </div>
102
+ <div className="list-content">
103
+ <Row gutter={12}>
104
+ <Col span={15}>
105
+ {temData["cardShowCols"] ?
106
+ <Space size="large" wrap={true}>
107
+ {temData["cardShowCols"].map((col, index) =>
108
+ <div className="card-show-item" key={index}>
109
+ <div className="title">{col.title}:</div>
110
+ <div className="element">{(col.value || col.value === 0) ? col.element : "-"}</div>
111
+ </div>)}
112
+ </Space> :
113
+ ""}
114
+ </Col>
115
+ <Col span={9} style={{ textAlign: "right" }}>
116
+ {renderOpt}
117
+ <Button size="small" type="text" onClick={() => setDetailOpen(!detailOpen)}>{detailOpen ? <UpOutlined /> : <DownOutlined />}</Button>
118
+ </Col>
119
+ </Row>
120
+ {detailOpen ?
121
+ <div className="detail-content">
122
+ <Descriptions column={4}>
123
+ {initViewList()}
124
+ </Descriptions>
125
+ </div> : ""}
126
+ </div>
127
+ </div>;
128
+ };
129
+
130
+ export default Index;
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from "react";
2
- import { AddOrUpdate, LtmplConfigRes, ActTableMode, DoEditParam, ShowViewParam } from "../tmpl/interface";
2
+ import { AddOrUpdate, LtmplConfigRes, ActTableMode, DoEditParam, ShowViewParam, ActTableViewModel } from "../tmpl/interface";
3
3
  import Units from "../units";
4
4
  import ActTable from "../table/act-table";
5
5
  // import StatActTable from '../table/stat-act-table'
@@ -33,6 +33,8 @@ export interface LtmplTableProps {
33
33
  readOnly?: boolean;
34
34
  rowOperatable?: boolean;
35
35
  defaultCriteriaValue?: object;
36
+ defShowType?: ActTableViewModel;
37
+ showPagination?: boolean; // 是否显示分页
36
38
  }
37
39
 
38
40
  export interface LtmplTableState {
@@ -75,6 +77,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
75
77
  initCollapse: false,
76
78
  readOnly: false,
77
79
  rowOperatable: true,
80
+ showPagination: true,
78
81
  };
79
82
 
80
83
  async componentDidMount() {
@@ -252,7 +255,7 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
252
255
  doRAction, funcMode,
253
256
  tip, title, collapsible,
254
257
  initCollapse, doCustomEdit, doCustomCreate,
255
- serverKey, rowOperatable, readOnly,
258
+ serverKey, rowOperatable, readOnly, defShowType, showPagination
256
259
  } = this.props;
257
260
  const { translate } = this.context;
258
261
 
@@ -276,6 +279,8 @@ class LtmplTable extends React.PureComponent<LtmplTableProps, LtmplTableState> {
276
279
  customEditable={doCustomEdit ? true : false}
277
280
  customCreatable={doCustomCreate ? true : false}
278
281
  ltmplConfig={ltmplConfigRes.ltmplConfig}
282
+ defShowType={defShowType}
283
+ showPagination={showPagination}
279
284
  />
280
285
  {buttons.includes("detail") && showDtmplView ? (
281
286
  <ModalDtmplView
@@ -0,0 +1,49 @@
1
+ import React, { useState, useMemo, useEffect } from "react";
2
+ import { useLocation } from "react-router-dom";
3
+ import { Spin } from "antd";
4
+ import HCserviceV3 from "../tmpl/hcservice-v3";
5
+ import HCDataSource from "../tmpl/hc-data-source";
6
+ import ProgramConfig from "../units";
7
+
8
+ interface Props {
9
+ serverKey?: string;
10
+ }
11
+
12
+ const Index = (props: Props) => {
13
+ const { serverKey } = props;
14
+ const [loading, setLoading] = useState<boolean>(true);
15
+ const { search } = useLocation();
16
+ const theme = ProgramConfig.getAllThemes()?.[0] || "v2";
17
+
18
+ const params = useMemo(() => {
19
+ const temParams = new URLSearchParams(search);
20
+ const username = temParams.get("username");
21
+ const ssoToken = temParams.get("ssoToken");
22
+ const programCode = temParams.get("programCode");
23
+ return { username, ssoToken, programCode };
24
+ }, [search]);
25
+
26
+ const login = async () => {
27
+ setLoading(true);
28
+ const { username, ssoToken, programCode } = params;
29
+ const res = await HCserviceV3.ssoTokenLogin({ username, ssoToken }, programCode, serverKey);
30
+ if (res.status === "success") {
31
+ HCDataSource.clear();
32
+ window.location.hash = `/${theme}/home`;
33
+ ProgramConfig.setHydrocarbonToken(res.token);
34
+ } else if (res.status === "error") {
35
+ window.location.hash = ["v2", "v5"].includes(theme) ? "/login2" : "login3";
36
+ }
37
+ setLoading(false);
38
+ };
39
+
40
+ useEffect(() => {
41
+ if (params) {
42
+ login();
43
+ }
44
+ }, [params])
45
+
46
+ return <Spin spinning={loading} fullscreen />;
47
+ }
48
+
49
+ export default Index;
@@ -68,6 +68,7 @@ interface ActTableProps extends TmplBaseProps {
68
68
  operatable?: boolean;
69
69
  onSelectChange?: (val: { selectedRows: SelectedRow[], selectedDatas: DtmplData[] }) => void;
70
70
  defShowType?: ActTableViewModel; // 默认视图
71
+ showPagination?: boolean; // 是否显示分页
71
72
  }
72
73
 
73
74
  interface ActTableStat {
@@ -145,6 +146,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
145
146
  initCollapse: false,
146
147
  readOnly: false,
147
148
  operatable: true,
149
+ showPagination: true
148
150
  };
149
151
 
150
152
  // 获取标签选项
@@ -1328,7 +1330,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
1328
1330
  mainCode, sourceId, ltmplConfig, funcMode, operatable,
1329
1331
  title, collapsible,
1330
1332
  onChangePage, serverKey, criteriaData,
1331
- showView, doEdit, doRAction, customEditable, readOnly, tableType
1333
+ showView, doEdit, doRAction, customEditable, readOnly, tableType, showPagination
1332
1334
  } = this.props;
1333
1335
  const { translate } = this.context;
1334
1336
 
@@ -1421,6 +1423,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
1421
1423
  cardListConfig={{ primaryColumn, primaryColumnLabel, secondColumn, secondColumnLabel, mainPicture, mainPictureLabel, labelColumn, cardShowCols, rowCardCount, buttons, customViewPagePath, mainCode }}
1422
1424
  ltmplConfig={ltmplConfig}
1423
1425
  showView={showView}
1426
+ showPagination={showPagination}
1424
1427
  />);
1425
1428
 
1426
1429
  return (
@@ -65,7 +65,8 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
65
65
  rowTotalCols: 4,
66
66
  defaultShowTotalCols: 7,
67
67
  cardListConfig: {},
68
- ltmplConfig: {}
68
+ ltmplConfig: {},
69
+ showPagination: true,
69
70
  };
70
71
 
71
72
  defaultAggregateShowSize = 7;
@@ -439,7 +440,8 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
439
440
  serverKey, rowTotalCols,
440
441
  cardListConfig,
441
442
  ltmplConfig,
442
- showView
443
+ showView,
444
+ showPagination
443
445
  } = this.props;
444
446
  //debugger
445
447
  const { touchEnd, aggregateVO, loading, virtualEndPageNo, dataSource, aggregateShowSize, errorText } = this.state;
@@ -574,7 +576,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
574
576
 
575
577
  return (
576
578
  <>
577
- {aggregateVO && aggregateVO.aggregates && aggregateVO.aggregates.length > 0 ?
579
+ {aggregateVO?.aggregates?.length > 0 ?
578
580
  <Card variant="borderless" styles={{ body: { paddingLeft: 10, paddingTop: 4, paddingBottom: 4, paddingRight: 10 } }}>
579
581
  <Descriptions
580
582
  column={rowTotalCols} colon={false}
@@ -657,9 +659,8 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
657
659
  columnConfigs={columnConfigs}
658
660
  serverKey={serverKey}
659
661
  columns={columns}
660
- primaryColumn={cardListConfig.primaryColumn}
661
- primaryColumnLabel={cardListConfig.primaryColumnLabel}
662
662
  errorText={errorText}
663
+ listConfig={cardListConfig}
663
664
  />
664
665
  ) : (
665
666
  ""
@@ -680,13 +681,13 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
680
681
  {viewModels.includes("ganttChart") ?
681
682
  <Gantt showView={showView} onRefresh={() => this.props.doSearch({})} serverKey={serverKey} sourceId={this.props.sourceId} loading={loading} dataSource={dataSource} ltmplConfig={ltmplConfig} errorText={errorText} getChildrenData={this.getChildrenData} /> : ""}
682
683
  {viewModels.includes("calendar") ? <Calendar showView={showView} serverKey={serverKey} columns={current_cols} ltmplConfig={ltmplConfig} dataSource={dataSource} loading={loading} errorText={errorText} /> : ""}
683
- <Pagination key={queryKey ? queryKey.key : Units.getReactKey()}
684
+ {showPagination ? <Pagination key={queryKey ? queryKey.key : Units.getReactKey()}
684
685
  touchEnd={touchEnd}
685
686
  pageInfo={{ ...pageInfo, virtualEndPageNo }}
686
687
  pageTo={this.pageTo}
687
688
  queryTotal={this.queryTotal}
688
689
  total={aggregateVO?.count}
689
- />
690
+ /> : ""}
690
691
  </>
691
692
  );
692
693
  }
@@ -1321,4 +1321,16 @@ export default class HcserviceV3 {
1321
1321
  });
1322
1322
  return res;
1323
1323
  }
1324
+
1325
+ static async ssoTokenLogin(json: { username: string, ssoToken: string }, programCode?: string, serverKey?: string) {
1326
+ let res = await Super.super({
1327
+ url: "/v3/auth/sso/token",
1328
+ serverKey,
1329
+ header: { programCode },
1330
+ query: json,
1331
+ method: "GET",
1332
+ });
1333
+ return res;
1334
+ }
1335
+
1324
1336
  }
@@ -89,6 +89,7 @@ export interface QueryTableProps extends ReportTableProps {
89
89
  cardListConfig?: CardListConfig;
90
90
  ltmplConfig?: LtmplConfig;
91
91
  showView?: (showVievParam: ShowViewParam) => void;
92
+ showPagination?: boolean;
92
93
  }
93
94
 
94
95
  export interface AggregateVO {
@@ -242,11 +243,13 @@ export interface Level2Menu extends MenuBase {
242
243
  count?: number;
243
244
  disabled?: boolean;
244
245
  hiddenOnDisabled?: boolean;
245
- defaultCriteriaValue?: object;
246
+ defaultCriteriaValue?: { [key: string]: any };
246
247
  pageType: "列表" | "详情" | "编辑" | "添加" | "编辑或添加" | "树" | "导入" | "报表";
247
248
  programAuths?: ProgramAuth[];
248
249
  linkTarget?: HTMLAttributeAnchorTarget;
249
250
  icon?: string;
251
+ themeColor?: string;
252
+ fullScreen?: boolean;
250
253
  }
251
254
 
252
255
  export interface Level1Menu extends MenuBase {
@@ -843,4 +846,6 @@ export interface BlockType {
843
846
  items?: BlockType[];
844
847
  fullScreen?: boolean; // 是否全屏展示
845
848
  icon?: string;
849
+ themeColor?: string;
850
+ funcDescription?: string;
846
851
  }
@@ -1,12 +1,16 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import QuickEntrance from "./quick-entrance";
3
- import Workbench from "./workbench";
2
+ import { Row, Col } from "antd";
3
+ import { useParams } from "react-router-dom";
4
+ import QuickEntrance from "./components/quick-entrance";
5
+ import Workbench from "./components/workbench";
6
+ import MenuCard from "./components/menu-card";
7
+ import PageCard from "./components/page-card";
4
8
  import "./index.css";
5
9
  import Units from "../units";
6
10
  import withRouter from "../routable/withroute";
7
11
  import WelcomeBg from "./img/welcome.png";
8
12
  import welcomeBg2 from "./img/welcome2.png";
9
- import { useParams } from "react-router-dom";
13
+ import { getMenuConfig } from "../layout2/page";
10
14
 
11
15
  // interface HCWelcomeProps {}
12
16
 
@@ -277,6 +281,23 @@ import { useParams } from "react-router-dom";
277
281
  // }
278
282
  // }
279
283
 
284
+ // 处理菜单
285
+ const handleMenu = (arr) => {
286
+ const temMenus = arr.filter(r => !r.disabled);
287
+ return temMenus.map(item => {
288
+ const newItem = {
289
+ ...item,
290
+ value: item.id,
291
+ title: item.label
292
+ };
293
+ if (item.children && Array.isArray(item.children) && item.children.length > 0) {
294
+ newItem.children = handleMenu(item.children);
295
+ newItem.url = newItem.children[0].url; // 存在子菜单时,url 为第一个子菜单的 url
296
+ }
297
+ return newItem;
298
+ });
299
+ }
300
+
280
301
  // 处理图片地址
281
302
  const handleImgUrl = (basePath) => {
282
303
  if (basePath.startsWith("http")) {
@@ -295,6 +316,7 @@ const HCWelcome = (props) => {
295
316
  const { programCode } = useParams();
296
317
  if (programCode) Units.setProgramCode(programCode);
297
318
  const [orgHomeImg, setOrgHomeImg] = useState();
319
+ const [menus, setMenus] = useState([]);
298
320
 
299
321
  const initUserConfig = async () => {
300
322
  let userInfo = await Units.getCurrentUserInfo();
@@ -311,37 +333,41 @@ const HCWelcome = (props) => {
311
333
  }
312
334
  };
313
335
 
336
+ const getMenus = async () => {
337
+ const temData = await getMenuConfig(layoutRootPath || "v2");
338
+ const temMenus = handleMenu(temData?.menu || []);
339
+ setMenus(temMenus);
340
+ }
341
+
314
342
  useEffect(() => {
315
343
  initUserConfig();
344
+ getMenus();
316
345
  }, []);
317
346
 
318
347
  return (
319
348
  <>
320
- <div
321
- style={{
322
- width: "100%",
323
- display: "flex",
324
- flexDirection: "row",
325
- }}
326
- >
327
- <div
328
- style={{
329
- width: "50%",
330
- boxSizing: "border-box",
331
- padding: 10,
332
- }}
333
- >
334
- <Workbench></Workbench>
335
- </div>
336
- <div
337
- style={{
338
- width: "50%",
339
- boxSizing: "border-box",
340
- padding: 10,
341
- }}
342
- >
343
- <QuickEntrance></QuickEntrance>
344
- </div>
349
+ <div style={{ width: "100%", paddingTop: "12px" }} >
350
+ <Row gutter={[0]}>
351
+ <Col span={24}>
352
+ <Workbench layoutRootPath={layoutRootPath} menus={menus[0]?.children || []} />
353
+ </Col>
354
+ <Col span={24}>
355
+ <Row gutter={16}>
356
+ <Col span={16}>
357
+ <Row gutter={[0, 16]}>
358
+ <Col span={24}><QuickEntrance layoutRootPath={layoutRootPath} menus={menus[0]?.children || []} /></Col>
359
+ <Col span={24}><MenuCard menus={menus} /></Col>
360
+ </Row>
361
+ </Col>
362
+ <Col span={8}>
363
+ <Row gutter={[16, 16]}>
364
+ <Col span={24}><PageCard fastMenu="RightSidebar01" layoutRootPath={layoutRootPath} menus={menus} menuOrder={1} /></Col>
365
+ <Col span={24}><PageCard fastMenu="RightSidebar02" layoutRootPath={layoutRootPath} menus={menus} menuOrder={2} /></Col>
366
+ </Row>
367
+ </Col>
368
+ </Row>
369
+ </Col>
370
+ </Row>
345
371
  </div>
346
372
  <img src={orgHomeImg || homeImg || (!layoutRootPath || (["v2", "v5"].includes(layoutRootPath)) ? WelcomeBg : welcomeBg2)} alt="" width="100%" height="100%" style={{ borderRadius: "8px", margin: "0 10px", width: "calc(100% - 20px)" }} />
347
373
  </>
@@ -0,0 +1,96 @@
1
+ .menu-card {
2
+ width: 100%;
3
+
4
+ .item-card {
5
+ position: relative;
6
+ overflow: hidden;
7
+ border-radius: 0.75rem;
8
+ padding: 1.25rem;
9
+ transition-property: transform, box-shadow;
10
+ display: flex;
11
+ align-items: flex-start;
12
+ justify-content: space-between;
13
+ border: 1px solid;
14
+ cursor: pointer;
15
+
16
+ .ant-row {
17
+ width: 100%;
18
+ }
19
+
20
+ .icon-wrapper {
21
+ position: relative;
22
+ display: flex;
23
+ height: 3rem;
24
+ width: 3rem;
25
+ align-items: center;
26
+ justify-content: center;
27
+ transition-property: all;
28
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
29
+ transition-duration: 0.3s;
30
+ animation-duration: 0.3s;
31
+ border-radius: 0.75rem;
32
+ opacity: 1;
33
+ }
34
+
35
+ .item-title {
36
+ margin-bottom: 6px;
37
+ font-weight: 600;
38
+ font-size: 18px;
39
+ }
40
+
41
+ .tag {
42
+ padding: 4px 10px;
43
+ border-radius: 9999px;
44
+ font-size: 12px;
45
+ line-height: 16px;
46
+ }
47
+
48
+ .progress-bar {
49
+ overflow: hidden;
50
+ position: absolute;
51
+ right: 0;
52
+ bottom: 0;
53
+ left: 0;
54
+ border-bottom-right-radius: 0.75rem;
55
+ border-bottom-left-radius: 0.75rem;
56
+ height: 2px;
57
+
58
+ .bar {
59
+ height: 100%;
60
+ width: 100%;
61
+ transform-origin: left;
62
+ transform: scaleX(0);
63
+ transition-property: transform;
64
+ transition-duration: 500ms;
65
+ transition-timing-function: ease-out;
66
+ }
67
+ }
68
+
69
+ }
70
+
71
+ .item-card:hover {
72
+ transform: translateY(-1px);
73
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
74
+
75
+ .icon-wrapper {
76
+ transform: scale(1.1);
77
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
78
+ }
79
+
80
+ .item-title {
81
+ color: var(--ant-color-primary);
82
+ }
83
+
84
+ .progress-bar .bar {
85
+ transform: scaleX(1);
86
+ }
87
+ }
88
+
89
+ .icon-animated {
90
+ font-size: 24px;
91
+ transition-property: all;
92
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
93
+ transition-duration: 300ms;
94
+ }
95
+
96
+ }
@@ -0,0 +1,68 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import { theme, Row, Col, Space, Flex } from "antd";
3
+ import { RocketTwoTone } from "@ant-design/icons";
4
+ import { useNavigate } from "react-router-dom";
5
+ import "antd/dist/reset.css";
6
+ import { MenuType } from "../../layout2/type/layout-type";
7
+ import IconFont from "../../icon/aliIcon";
8
+ import "./menu-card.less";
9
+
10
+ const { useToken } = theme;
11
+
12
+ interface Props {
13
+ menus: MenuType[];
14
+ }
15
+
16
+ const Index = (props: Props) => {
17
+ const { menus } = props;
18
+ const navigate = useNavigate();
19
+ const [menu, setMenu] = useState<MenuType[]>([]);
20
+ const { token } = useToken();
21
+
22
+ useEffect(() => {
23
+ if (menus?.length) {
24
+ setMenu(menus.slice(0, 4));
25
+ }
26
+ }, [menus]);
27
+
28
+ const renderItem = (item: MenuType) => {
29
+ const renderIcon = item.icon ? <IconFont type={item.icon} /> : <RocketTwoTone />;
30
+ const iconColor = item.themeColor || token.colorPrimary;
31
+ const children = item.children?.filter(r => !r.disabled).slice(0, 3) || [];
32
+ const funcDescription = item.funcDescription || `${children.map(r => r.label).join("、")}等功能`;
33
+ return <div className="item-card" style={{ borderColor: `${token.colorBorder}CC`, backgroundColor: token.colorBgContainer }} onClick={() => navigate(`/${item.url}`)}>
34
+ <Space size={16} align="start" style={{ marginBottom: "16px" }}>
35
+ <div className="icon-wrapper" style={{ color: iconColor, background: `${iconColor}1A` }}>
36
+ <div className="icon-animated">{renderIcon}</div>
37
+ </div>
38
+ <div>
39
+ <h3 className="item-title">{item.label}</h3>
40
+ <p style={{ color: token.colorTextSecondary }}>
41
+ {funcDescription}
42
+ </p>
43
+ <Flex gap="small" align="center" wrap>
44
+ {children.map((cItem) => (
45
+ <span
46
+ onClick={(e) => {
47
+ e.stopPropagation();
48
+ navigate(`/${cItem.url}`);
49
+ }}
50
+ key={cItem.id} className="tag" style={{ color: iconColor, background: `${iconColor}1A` }}>
51
+ {cItem.label}
52
+ </span>
53
+ ))}
54
+ </Flex>
55
+ </div>
56
+ </Space>
57
+ <div className="progress-bar"><div className="bar" style={{ backgroundColor: iconColor }} /></div>
58
+ </div>;
59
+ }
60
+
61
+ return <div className="menu-card">
62
+ <Row gutter={[16, 16]}>
63
+ {menu.map((item) => <Col span={12}>{renderItem(item)}</Col>)}
64
+ </Row>
65
+ </div>;
66
+ }
67
+
68
+ export default Index;