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.
Files changed (216) hide show
  1. package/lib/controls/date-picker/index.d.ts.map +1 -1
  2. package/lib/controls/date-picker/index.js +8 -15
  3. package/lib/controls/date-picker/index.js.map +1 -1
  4. package/lib/controls/file-view/index.d.ts.map +1 -1
  5. package/lib/controls/file-view/index.js +5 -3
  6. package/lib/controls/file-view/index.js.map +1 -1
  7. package/lib/detail/button/view-button.d.ts +1 -0
  8. package/lib/detail/button/view-button.d.ts.map +1 -1
  9. package/lib/detail/button/view-button.js +3 -3
  10. package/lib/detail/button/view-button.js.map +1 -1
  11. package/lib/hooks/use-tabs/index.d.ts.map +1 -1
  12. package/lib/hooks/use-tabs/index.js +3 -0
  13. package/lib/hooks/use-tabs/index.js.map +1 -1
  14. package/lib/layout2/components/search-menu.js +1 -1
  15. package/lib/layout2/components/search-menu.js.map +1 -1
  16. package/lib/layout2/components/user-button.d.ts +3 -0
  17. package/lib/layout2/components/user-button.d.ts.map +1 -1
  18. package/lib/layout2/components/user-button.js +27 -7
  19. package/lib/layout2/components/user-button.js.map +1 -1
  20. package/lib/layout2/header.d.ts +2 -0
  21. package/lib/layout2/header.d.ts.map +1 -1
  22. package/lib/layout2/header.js +3 -3
  23. package/lib/layout2/header.js.map +1 -1
  24. package/lib/layout2/page.d.ts.map +1 -1
  25. package/lib/layout2/page.js +7 -5
  26. package/lib/layout2/page.js.map +1 -1
  27. package/lib/layout2/sider.d.ts +2 -0
  28. package/lib/layout2/sider.d.ts.map +1 -1
  29. package/lib/layout2/sider.js +2 -2
  30. package/lib/layout2/sider.js.map +1 -1
  31. package/lib/layout3/header.d.ts +2 -0
  32. package/lib/layout3/header.d.ts.map +1 -1
  33. package/lib/layout3/header.js +4 -4
  34. package/lib/layout3/header.js.map +1 -1
  35. package/lib/layout3/page.d.ts.map +1 -1
  36. package/lib/layout3/page.js +6 -4
  37. package/lib/layout3/page.js.map +1 -1
  38. package/lib/layout3/sider.d.ts +2 -0
  39. package/lib/layout3/sider.d.ts.map +1 -1
  40. package/lib/layout3/sider.js +2 -2
  41. package/lib/layout3/sider.js.map +1 -1
  42. package/lib/layout4/header.d.ts +2 -0
  43. package/lib/layout4/header.d.ts.map +1 -1
  44. package/lib/layout4/header.js +4 -4
  45. package/lib/layout4/header.js.map +1 -1
  46. package/lib/layout4/page.d.ts.map +1 -1
  47. package/lib/layout4/page.js +7 -5
  48. package/lib/layout4/page.js.map +1 -1
  49. package/lib/layout4/sider.d.ts +2 -0
  50. package/lib/layout4/sider.d.ts.map +1 -1
  51. package/lib/layout4/sider.js +2 -2
  52. package/lib/layout4/sider.js.map +1 -1
  53. package/lib/layout5/header.d.ts +2 -0
  54. package/lib/layout5/header.d.ts.map +1 -1
  55. package/lib/layout5/header.js +2 -2
  56. package/lib/layout5/header.js.map +1 -1
  57. package/lib/layout5/page.d.ts.map +1 -1
  58. package/lib/layout5/page.js +7 -5
  59. package/lib/layout5/page.js.map +1 -1
  60. package/lib/layout5/sider.d.ts +2 -0
  61. package/lib/layout5/sider.d.ts.map +1 -1
  62. package/lib/layout5/sider.js +2 -2
  63. package/lib/layout5/sider.js.map +1 -1
  64. package/lib/list/card-list/card-list-item.js +1 -1
  65. package/lib/list/card-list/card-list-item.js.map +1 -1
  66. package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
  67. package/lib/lowcode-components/bar-chart/index.js +9 -1
  68. package/lib/lowcode-components/bar-chart/index.js.map +1 -1
  69. package/lib/lowcode-components/base-map/index.d.ts.map +1 -1
  70. package/lib/lowcode-components/base-map/index.js +9 -1
  71. package/lib/lowcode-components/base-map/index.js.map +1 -1
  72. package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -1
  73. package/lib/lowcode-components/capsule-bar-chart/index.js +9 -1
  74. package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -1
  75. package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -1
  76. package/lib/lowcode-components/circular-progress-chart/index.js +9 -1
  77. package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -1
  78. package/lib/lowcode-components/column-3d-chart/index.d.ts.map +1 -1
  79. package/lib/lowcode-components/column-3d-chart/index.js +9 -1
  80. package/lib/lowcode-components/column-3d-chart/index.js.map +1 -1
  81. package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
  82. package/lib/lowcode-components/column-chart/index.js +9 -1
  83. package/lib/lowcode-components/column-chart/index.js.map +1 -1
  84. package/lib/lowcode-components/effectScatter-map/index.d.ts.map +1 -1
  85. package/lib/lowcode-components/effectScatter-map/index.js +9 -1
  86. package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
  87. package/lib/lowcode-components/effectScatter-map-3d/index.d.ts.map +1 -1
  88. package/lib/lowcode-components/effectScatter-map-3d/index.js +9 -1
  89. package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -1
  90. package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
  91. package/lib/lowcode-components/gauge-chart/index.js +9 -1
  92. package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
  93. package/lib/lowcode-components/line-bar-chart/index.d.ts.map +1 -1
  94. package/lib/lowcode-components/line-bar-chart/index.js +9 -1
  95. package/lib/lowcode-components/line-bar-chart/index.js.map +1 -1
  96. package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
  97. package/lib/lowcode-components/line-chart/index.js +9 -1
  98. package/lib/lowcode-components/line-chart/index.js.map +1 -1
  99. package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
  100. package/lib/lowcode-components/liquid-chart/index.js +9 -1
  101. package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
  102. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.d.ts.map +1 -1
  103. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js +2 -0
  104. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js.map +1 -1
  105. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.less +2 -1
  106. package/lib/lowcode-components/lowcode-view/index.d.ts +2 -1
  107. package/lib/lowcode-components/lowcode-view/index.d.ts.map +1 -1
  108. package/lib/lowcode-components/lowcode-view/index.js +2 -2
  109. package/lib/lowcode-components/lowcode-view/index.js.map +1 -1
  110. package/lib/lowcode-components/lowcode-view/index.less +7 -0
  111. package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
  112. package/lib/lowcode-components/pie-chart/index.js +9 -1
  113. package/lib/lowcode-components/pie-chart/index.js.map +1 -1
  114. package/lib/lowcode-components/progress-chart/index.d.ts.map +1 -1
  115. package/lib/lowcode-components/progress-chart/index.js +9 -1
  116. package/lib/lowcode-components/progress-chart/index.js.map +1 -1
  117. package/lib/routable/ltmpl-route.d.ts +2 -1
  118. package/lib/routable/ltmpl-route.d.ts.map +1 -1
  119. package/lib/routable/ltmpl-route.js +11 -5
  120. package/lib/routable/ltmpl-route.js.map +1 -1
  121. package/lib/routable/splitview-ltmpl-route.d.ts.map +1 -1
  122. package/lib/routable/splitview-ltmpl-route.js +11 -4
  123. package/lib/routable/splitview-ltmpl-route.js.map +1 -1
  124. package/lib/table/act-table.d.ts +4 -0
  125. package/lib/table/act-table.d.ts.map +1 -1
  126. package/lib/table/act-table.js +37 -12
  127. package/lib/table/act-table.js.map +1 -1
  128. package/lib/table/column/column-builder.d.ts.map +1 -1
  129. package/lib/table/column/column-builder.js +6 -8
  130. package/lib/table/column/column-builder.js.map +1 -1
  131. package/lib/table/index.css +29 -2
  132. package/lib/table/page-config-button.d.ts +15 -0
  133. package/lib/table/page-config-button.d.ts.map +1 -0
  134. package/lib/table/page-config-button.js +156 -0
  135. package/lib/table/page-config-button.js.map +1 -0
  136. package/lib/table/pagination.d.ts +1 -0
  137. package/lib/table/pagination.d.ts.map +1 -1
  138. package/lib/table/pagination.js +2 -2
  139. package/lib/table/pagination.js.map +1 -1
  140. package/lib/table/query-table.d.ts.map +1 -1
  141. package/lib/table/query-table.js +1 -1
  142. package/lib/table/query-table.js.map +1 -1
  143. package/lib/table/relation-table.d.ts +1 -0
  144. package/lib/table/relation-table.d.ts.map +1 -1
  145. package/lib/tmpl/hcservice-v3.d.ts +9 -0
  146. package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
  147. package/lib/tmpl/hcservice-v3.js +154 -0
  148. package/lib/tmpl/hcservice-v3.js.map +1 -1
  149. package/lib/tmpl/interface.d.ts +21 -0
  150. package/lib/tmpl/interface.d.ts.map +1 -1
  151. package/lib/tmpl/interface.js.map +1 -1
  152. package/lib/units/index.d.ts +9 -4
  153. package/lib/units/index.d.ts.map +1 -1
  154. package/lib/units/index.js +49 -13
  155. package/lib/units/index.js.map +1 -1
  156. package/lib/welcome/HCWelcome.js +10 -0
  157. package/lib/welcome/HCWelcome.js.map +1 -1
  158. package/lib/welcome/components/menu-card.less +1 -0
  159. package/lib/welcome/components/user-menus.d.ts +16 -0
  160. package/lib/welcome/components/user-menus.d.ts.map +1 -0
  161. package/lib/welcome/components/user-menus.js +210 -0
  162. package/lib/welcome/components/user-menus.js.map +1 -0
  163. package/lib/welcome/components/user-menus.less +193 -0
  164. package/package.json +1 -1
  165. package/src/aldehyde/controls/date-picker/index.tsx +12 -4
  166. package/src/aldehyde/controls/file-view/index.tsx +5 -1
  167. package/src/aldehyde/detail/button/view-button.tsx +7 -6
  168. package/src/aldehyde/hooks/use-tabs/index.tsx +3 -0
  169. package/src/aldehyde/layout2/components/search-menu.tsx +1 -1
  170. package/src/aldehyde/layout2/components/user-button.tsx +45 -8
  171. package/src/aldehyde/layout2/header.tsx +5 -3
  172. package/src/aldehyde/layout2/page.tsx +8 -7
  173. package/src/aldehyde/layout2/sider.tsx +4 -3
  174. package/src/aldehyde/layout3/header.tsx +6 -4
  175. package/src/aldehyde/layout3/page.tsx +7 -4
  176. package/src/aldehyde/layout3/sider.tsx +4 -3
  177. package/src/aldehyde/layout4/header.tsx +6 -4
  178. package/src/aldehyde/layout4/page.tsx +8 -5
  179. package/src/aldehyde/layout4/sider.tsx +4 -3
  180. package/src/aldehyde/layout5/header.tsx +4 -2
  181. package/src/aldehyde/layout5/page.tsx +8 -5
  182. package/src/aldehyde/layout5/sider.tsx +4 -3
  183. package/src/aldehyde/list/card-list/card-list-item.tsx +1 -1
  184. package/src/aldehyde/lowcode-components/bar-chart/index.tsx +12 -2
  185. package/src/aldehyde/lowcode-components/base-map/index.tsx +12 -2
  186. package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +12 -2
  187. package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +12 -2
  188. package/src/aldehyde/lowcode-components/column-3d-chart/index.tsx +12 -2
  189. package/src/aldehyde/lowcode-components/column-chart/index.tsx +12 -2
  190. package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +12 -2
  191. package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +12 -2
  192. package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +12 -2
  193. package/src/aldehyde/lowcode-components/line-bar-chart/index.tsx +12 -2
  194. package/src/aldehyde/lowcode-components/line-chart/index.tsx +12 -2
  195. package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +12 -2
  196. package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.less +2 -1
  197. package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.tsx +3 -1
  198. package/src/aldehyde/lowcode-components/lowcode-view/index.less +7 -0
  199. package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +3 -1
  200. package/src/aldehyde/lowcode-components/pie-chart/index.tsx +12 -2
  201. package/src/aldehyde/lowcode-components/progress-chart/index.tsx +12 -2
  202. package/src/aldehyde/routable/ltmpl-route.tsx +13 -5
  203. package/src/aldehyde/routable/splitview-ltmpl-route.tsx +12 -3
  204. package/src/aldehyde/table/act-table.tsx +44 -13
  205. package/src/aldehyde/table/column/column-builder.tsx +13 -20
  206. package/src/aldehyde/table/index.css +29 -2
  207. package/src/aldehyde/table/page-config-button.tsx +199 -0
  208. package/src/aldehyde/table/pagination.tsx +8 -7
  209. package/src/aldehyde/table/query-table.tsx +1 -0
  210. package/src/aldehyde/tmpl/hcservice-v3.tsx +136 -0
  211. package/src/aldehyde/tmpl/interface.tsx +22 -0
  212. package/src/aldehyde/units/index.tsx +34 -3
  213. package/src/aldehyde/welcome/HCWelcome.js +10 -0
  214. package/src/aldehyde/welcome/components/menu-card.less +1 -0
  215. package/src/aldehyde/welcome/components/user-menus.less +193 -0
  216. package/src/aldehyde/welcome/components/user-menus.tsx +275 -0
@@ -427,31 +427,24 @@ export default {
427
427
 
428
428
  let actionButtons: any[] = [];
429
429
 
430
- if (buttons.includes("detail") &&
431
- showView &&
432
- ActionUtils.isShow(
433
- ltmplConfig.buttonViewAction?.preposes,
434
- [record],
435
- undefined
436
- )) {
437
- actionButtons.push(<ViewButton
438
- showView={showView}
439
- data={record}
440
- ltmplConfig={ltmplConfig}></ViewButton>);
441
- }
442
- if (buttons.includes("customDetail") &&
443
- showView &&
444
- ActionUtils.isShow(
445
- ltmplConfig.buttonViewAction?.preposes,
446
- [record],
447
- undefined
448
- )) {
430
+ const isShowDetail = buttons.includes("detail") && showView && ActionUtils.isShow(ltmplConfig.buttonViewAction?.preposes, [record], undefined);
431
+ const isShowCustomDetail = buttons.includes("customDetail") && showView && ActionUtils.isShow(ltmplConfig.buttonViewAction?.preposes, [record], undefined);
432
+
433
+ if (isShowCustomDetail) { // 自定义详情
449
434
  actionButtons.push(<Button
450
435
  size="small"
451
436
  type="primary"
452
437
  icon={<AlignLeftOutlined />}
453
438
  onClick={() => showView({ code: record.code, toCustomPage: true, })}
454
- ></Button>)
439
+ />)
440
+ }
441
+
442
+ if (isShowDetail) { // 默认详情
443
+ actionButtons.push(<ViewButton
444
+ showView={showView}
445
+ data={record}
446
+ ltmplConfig={ltmplConfig}
447
+ buttonType={isShowCustomDetail ? "default" : "primary"} />);
455
448
  }
456
449
 
457
450
  if (buttons.includes("dtmplEdit") && doEdit && !readOnly) {
@@ -127,8 +127,6 @@
127
127
  font-size: 28px;
128
128
  line-height: 32px;
129
129
  font-weight: 700;
130
- overflow: hidden;
131
- text-overflow: ellipsis;
132
130
  }
133
131
 
134
132
  .aggregate-card .value .unit {
@@ -182,4 +180,33 @@
182
180
  .aggregates {
183
181
  grid-template-columns: repeat(5, minmax(0, 1fr));
184
182
  }
183
+ }
184
+
185
+ /* 用户自定义配置按钮样式 */
186
+ .page-config-menu-item {
187
+ display: flex;
188
+ justify-content: space-between;
189
+ align-items: center;
190
+ width: 152px;
191
+ }
192
+
193
+ .page-config-menu-item .page-config-menu-item-title {
194
+ width: 80px;
195
+ text-overflow: ellipsis;
196
+ overflow: hidden;
197
+ white-space: nowrap;
198
+ text-align: left;
199
+ }
200
+
201
+ .page-config-menu-item .page-config-menu-item-icon {
202
+ display: none;
203
+ margin-left: 12px;
204
+ }
205
+
206
+ .page-config-menu-item:hover .page-config-menu-item-icon {
207
+ display: block;
208
+ }
209
+
210
+ .page-config-menu-item-edit .page-config-menu-item-icon {
211
+ display: block !important;
185
212
  }
@@ -0,0 +1,199 @@
1
+ import React, { useEffect, useRef, useState } from "react";
2
+ import { theme, Dropdown, Button, Tooltip, Divider, Popover, Form, Input, Popconfirm } from "antd";
3
+ import { SettingOutlined, PlusOutlined, SyncOutlined, UploadOutlined, DeleteOutlined, DownloadOutlined, EditOutlined } from "@ant-design/icons";
4
+ import { useLocale } from "../locale/useLocale";
5
+ import HcserviceV3 from "../tmpl/hcservice-v3";
6
+ import ProgramConfig from "../units";
7
+ import "./index.css";
8
+
9
+ /**
10
+ * 页面自定义配置
11
+ */
12
+
13
+ const { useToken } = theme;
14
+
15
+ interface Props {
16
+ menuCode: string;
17
+ handleResetUserPageConfig: () => void;
18
+ handleUpdateUserPageConfig?: (config: { [key: string]: any }) => void; // 更新用户页面配置本地缓存
19
+ userCriteriaData: { [key: string]: any }; // 搜索条件,自定义配置使用
20
+ }
21
+
22
+ const Index = (props: Props) => {
23
+ const { menuCode, handleResetUserPageConfig, handleUpdateUserPageConfig, userCriteriaData = {} } = props;
24
+ const [menus, setMenus] = useState<{ recordCode: string, name: string, content: string }[]>([]);
25
+ const [addOpen, setAddOpen] = useState<boolean>(false);
26
+ const [editOpen, setEditOpen] = useState<boolean>(false);
27
+ const [currentKey, setCurrentKey] = useState<string>();
28
+ const { translate } = useLocale();
29
+ const { token } = useToken();
30
+ const [form] = Form.useForm();
31
+
32
+ // 设置默认配置
33
+ const setPageConfigDefault = async () => {
34
+ const userPageConfig = await ProgramConfig.getUserPageConfig(menuCode);
35
+ if (!userPageConfig || !menuCode) {
36
+ return;
37
+ }
38
+ const content = JSON.stringify(userPageConfig);
39
+ await HcserviceV3.setPageConfigDefault("默认", menuCode, content);
40
+ setCurrentKey(undefined);
41
+ handleUpdateUserPageConfig(userPageConfig);
42
+ }
43
+
44
+ // 获取全局默认配置,更新缓存
45
+ const getPageConfigDefault = async () => {
46
+ const defUserPageConfig = await ProgramConfig.getPageConfigDefault();
47
+ handleUpdateUserPageConfig(defUserPageConfig[menuCode]);
48
+ }
49
+
50
+ // 更新当前页面配置
51
+ const onChangeUserPageConfig = (item) => {
52
+ const { content } = item;
53
+ if (!content) {
54
+ return;
55
+ }
56
+ const config = JSON.parse(content);
57
+ handleUpdateUserPageConfig(config);
58
+ }
59
+
60
+ const onClickOperation = (e, item) => {
61
+ e.stopPropagation();
62
+ setCurrentKey(item.key);
63
+ }
64
+
65
+ const renderMenuItem = (item) => {
66
+ const { key, name, recordCode } = item;
67
+ return {
68
+ key,
69
+ label: <div className={`page-config-menu-item ${currentKey === item.key ? "page-config-menu-item-edit" : ""}`} onClick={() => onChangeUserPageConfig(item)}>
70
+ <div className="page-config-menu-item-title">{name || translate("配置")}</div>
71
+ <Popconfirm
72
+ placement="rightBottom"
73
+ title={translate("${确定要[更新]此数据吗}?")}
74
+ onConfirm={(e) => {
75
+ e.stopPropagation();
76
+ key === "default" ? setPageConfigDefault() : setPageConfigCommon(item);
77
+ }}
78
+ okText={translate("${确定}")}
79
+ cancelText={translate("${取消}")}
80
+ okType={"danger"}
81
+ >
82
+ <Tooltip title={translate("${更新}")}><UploadOutlined onClick={(e) => onClickOperation(e, item)} className="page-config-menu-item-icon" style={{ color: token.colorPrimary }} /></Tooltip>
83
+ </Popconfirm>
84
+ {key === "default" ? <Popconfirm
85
+ placement="rightBottom"
86
+ title={translate("${确定要[拉取]默认配置吗}?")}
87
+ onConfirm={(e) => {
88
+ e.stopPropagation();
89
+ getPageConfigDefault();
90
+ }}
91
+ okText={translate("${确定}")}
92
+ cancelText={translate("${取消}")}
93
+ okType={"danger"}
94
+ >
95
+ <Tooltip title={translate("${拉取云端默认配置}")}><DownloadOutlined onClick={(e) => onClickOperation(e, item)} className="page-config-menu-item-icon" style={{ color: token.colorPrimary }} /></Tooltip>
96
+ </Popconfirm> : ""}
97
+ {key !== "default" ?
98
+ <>
99
+ <Popover placement="bottom" open={editOpen && currentKey === item.key} destroyOnHidden={true} onOpenChange={(val) => { setEditOpen(val); form.setFieldValue("name", val ? item.name : undefined); }} zIndex={9999} content={renderAddForm} trigger="click">
100
+ <Tooltip title={translate("${编辑}")}>
101
+ <EditOutlined onClick={(e) => onClickOperation(e, item)} className="page-config-menu-item-icon" style={{ color: token.colorPrimary }} />
102
+ </Tooltip>
103
+ </Popover>
104
+ <Popconfirm
105
+ placement="rightBottom"
106
+ title={translate("${确定要[删除]此数据吗}?")}
107
+ onConfirm={(e) => {
108
+ e.stopPropagation();
109
+ deletePageConfigCommon(recordCode);
110
+ }}
111
+ okText={translate("${确定}")}
112
+ cancelText={translate("${取消}")}
113
+ okType={"danger"}
114
+ >
115
+ <Tooltip title={translate("${删除}")}><DeleteOutlined onClick={(e) => onClickOperation(e, item)} className="page-config-menu-item-icon" style={{ color: token.colorError }} /></Tooltip>
116
+ </Popconfirm>
117
+ </> : ""}
118
+ </div >
119
+ };
120
+ };
121
+
122
+ // 设置自定义菜单配置
123
+ const setPageConfigCommon = async (val: { key: string, name: string }) => {
124
+ const userPageConfig = await ProgramConfig.getUserPageConfig(menuCode);
125
+ if (!userPageConfig || !menuCode) {
126
+ return;
127
+ }
128
+ let content = undefined;
129
+ // val.key存在-更新配置;val.key和currentKey都不存在-添加自定义配置;val.key不存在-更新name
130
+ if (val.key || !(val.key || currentKey)) {
131
+ userPageConfig["criteriaData"] = { ...userCriteriaData, serial_number: undefined };
132
+ content = JSON.stringify(userPageConfig);
133
+ handleUpdateUserPageConfig(userPageConfig);
134
+ } else {
135
+ content = menus.find(r => r.recordCode === currentKey)?.content;
136
+ }
137
+ await HcserviceV3.setPageConfigCommon(val.name, menuCode, content, val.key || currentKey);
138
+ getPageConfigCommon("addOrEdit");
139
+ setAddOpen(false);
140
+ setEditOpen(false);
141
+ setCurrentKey(undefined);
142
+ }
143
+
144
+ // 删除自定义菜单配置
145
+ const deletePageConfigCommon = async (configCode: string) => {
146
+ if (!configCode) {
147
+ return;
148
+ }
149
+ await HcserviceV3.deletePageConfigCommon(configCode);
150
+ getPageConfigCommon("delete");
151
+ setCurrentKey(undefined);
152
+ }
153
+
154
+ // 获取自定义菜单配置
155
+ const getPageConfigCommon = async (type: string) => {
156
+ const configs = await ProgramConfig.getPageConfigCommon(menuCode, type === "init" ? "default" : "refresh");
157
+ setMenus(configs || []);
158
+ }
159
+
160
+ useEffect(() => {
161
+ if (menuCode) {
162
+ getPageConfigCommon("init");
163
+ }
164
+ }, [menuCode]);
165
+
166
+ const contentStyle: React.CSSProperties = {
167
+ backgroundColor: token.colorBgElevated,
168
+ borderRadius: token.borderRadiusLG,
169
+ boxShadow: token.boxShadowSecondary,
170
+ };
171
+
172
+ const renderAddForm = <Form clearOnDestroy={true} form={form} layout="vertical" onFinish={setPageConfigCommon} onClick={(e) => e.stopPropagation()} >
173
+ <Form.Item name="name" label={translate("名称")} rules={[{ required: true }]}>
174
+ <Input placeholder={translate("名称")} />
175
+ </Form.Item>
176
+ <Form.Item style={{ margin: 0, textAlign: "right" }}><Button type="primary" htmlType="submit">{translate("${提交}")}</Button></Form.Item>
177
+ </Form>;
178
+
179
+ return <Dropdown trigger={["click"]} menu={{ items: [renderMenuItem({ key: "default", name: "默认" }), ...menus.map(r => renderMenuItem({ ...r, key: r.recordCode }))].filter(Boolean) }} popupRender={(menu) => (
180
+ <div style={contentStyle}>
181
+ {React.cloneElement(menu as any, { style: { boxShadow: 'none' } },)}
182
+ <Divider style={{ margin: 0 }} />
183
+ <div style={{ padding: "4px", display: "flex", justifyContent: "space-between", alignItems: "center" }}>
184
+ <Tooltip title={translate("${重置}")}>
185
+ <Button onClick={handleResetUserPageConfig} icon={<SyncOutlined />} />
186
+ </Tooltip>
187
+ <Popover placement="bottomLeft" destroyOnHidden={true} open={addOpen} onOpenChange={setAddOpen} getPopupContainer={(val) => val} zIndex={9999} content={renderAddForm} trigger="click">
188
+ <Tooltip title={translate("${添加我的菜单}")}><Button disabled={menus?.length > 4} icon={<PlusOutlined />} /></Tooltip>
189
+ </Popover>
190
+ </div>
191
+ </div>
192
+ )}>
193
+ <Tooltip title={translate("${我的配置}")}>
194
+ <Button><SettingOutlined /></Button>
195
+ </Tooltip>
196
+ </Dropdown>;
197
+ }
198
+
199
+ export default Index;
@@ -10,16 +10,17 @@ interface PaginationProps {
10
10
  pageInfo: PageInfo;
11
11
  total: number;
12
12
  touchEnd: boolean;
13
+ paginationPosition?: "left" | "middle" | "right";
13
14
  }
14
15
 
15
- interface PaginationStat {}
16
+ interface PaginationStat { }
16
17
 
17
18
  class Pagination extends React.PureComponent<PaginationProps, PaginationStat> {
18
19
  static contextType = LocaleContext;
19
20
  context: React.ContextType<typeof LocaleContext>;
20
21
 
21
22
  render() {
22
- const { queryTotal, pageInfo, total, pageTo, touchEnd } = this.props;
23
+ const { queryTotal, pageInfo, total, pageTo, touchEnd, paginationPosition } = this.props;
23
24
  const { translate } = this.context;
24
25
 
25
26
  if (!pageInfo) {
@@ -48,7 +49,7 @@ class Pagination extends React.PureComponent<PaginationProps, PaginationStat> {
48
49
  }
49
50
 
50
51
  return (
51
- <div className="Pagination">
52
+ <div className="Pagination" style={{ justifyContent: paginationPosition === "middle" ? "center" : (paginationPosition || "left") }}>
52
53
  <span
53
54
  className={sewTotal ? "sewTotal" : "seeTotal"}
54
55
  onClick={queryTotal}
@@ -59,11 +60,11 @@ class Pagination extends React.PureComponent<PaginationProps, PaginationStat> {
59
60
  style={{ display: "inline-block" }}
60
61
  showQuickJumper
61
62
  showSizeChanger
62
- pageSizeOptions={["5", "10", "20", "50", "100", "200","500"]} //
63
+ pageSizeOptions={["5", "10", "20", "50", "100", "200", "500"]} //
63
64
  defaultCurrent={1}
64
- current={parseInt(pageInfo.pageNo?pageInfo.pageNo.toString():"1")}
65
- pageSize={pageInfo.pageSize?pageInfo.pageSize:10}
66
- onChange={(page, pageSize) => {pageTo(page, pageSize)}}
65
+ current={parseInt(pageInfo.pageNo ? pageInfo.pageNo.toString() : "1")}
66
+ pageSize={pageInfo.pageSize ? pageInfo.pageSize : 10}
67
+ onChange={(page, pageSize) => { pageTo(page, pageSize) }}
67
68
  //onShowSizeChange={(current, size) => {debugger;pageTo(current, size)}}
68
69
  hideOnSinglePage={total === 0}
69
70
  total={virtualTotal}
@@ -632,6 +632,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
632
632
  pageTo={this.pageTo}
633
633
  queryTotal={this.queryTotal}
634
634
  total={aggregateVO?.count}
635
+ paginationPosition={ltmplConfig?.paginationPosition}
635
636
  /> : ""}
636
637
  </>
637
638
  );
@@ -1360,4 +1360,140 @@ export default class HcserviceV3 {
1360
1360
  return [];
1361
1361
  }
1362
1362
  }
1363
+
1364
+ // 设置页面默认配置
1365
+ static async setPageConfigDefault(name: string, menuCode: string, content: string) {
1366
+ let res = await Super.super({
1367
+ url: `/v3/devops/page-config/default`,
1368
+ method: "POST",
1369
+ data: { name, menuCode, content },
1370
+ });
1371
+ if (res?.status === "success") {
1372
+ message.success(translate("${保存成功}"), 1);
1373
+ return true;
1374
+ } else {
1375
+ message.error(translate("${保存失败}"), 3);
1376
+ return false;
1377
+ }
1378
+ }
1379
+
1380
+ // 获取页面默认配置
1381
+ static async getPageConfigDefault() {
1382
+ let res = await Super.super({
1383
+ url: `/v3/devops/page-config/default`,
1384
+ method: "GET",
1385
+ });
1386
+ if (res?.status === "success") {
1387
+ message.success(translate("${拉取成功}"), 1);
1388
+ return res.configs;
1389
+ } else {
1390
+ message.error(translate("${拉取失败}"), 3);
1391
+ return null;
1392
+ }
1393
+ }
1394
+
1395
+ static async deletePageConfigDefault(menuCode: string) {
1396
+ let res = await Super.super({
1397
+ url: `/v3/devops/page-config/default`,
1398
+ data: { menuCode },
1399
+ method: "DELETE",
1400
+ });
1401
+ if (res?.status === "success") {
1402
+ message.success(translate("${删除成功}"), 1);
1403
+ return true;
1404
+ } else {
1405
+ message.error(translate("${删除失败}"), 3);
1406
+ return false;
1407
+ }
1408
+ }
1409
+
1410
+ // 设置页面用户自定义配置
1411
+ static async setPageConfigCommon(name: string, menuCode: string, content: string, configCode?: string) {
1412
+ let res = await Super.super({
1413
+ url: `/v3/devops/page-config/common`,
1414
+ method: "POST",
1415
+ data: { name, menuCode, content, configCode },
1416
+ });
1417
+ if (res?.status === "success") {
1418
+ message.success(translate("${保存成功}"), 1);
1419
+ return true;
1420
+ } else {
1421
+ message.error(translate("${保存失败}"), 3);
1422
+ return false;
1423
+ }
1424
+ }
1425
+
1426
+ // 获取用户页面自定义配置
1427
+ static async getPageConfigCommon(menuCode?: string) {
1428
+ let res = await Super.super({
1429
+ url: `/v3/devops/page-config/common`,
1430
+ method: "GET",
1431
+ query: { menuCode }
1432
+ });
1433
+ if (res?.status === "success") {
1434
+ return res.configs;
1435
+ } else {
1436
+ return null;
1437
+ }
1438
+ }
1439
+
1440
+ static async deletePageConfigCommon(configCode: string) {
1441
+ let res = await Super.super({
1442
+ url: `/v3/devops/page-config/common`,
1443
+ data: { configCode },
1444
+ method: "DELETE",
1445
+ });
1446
+ if (res?.status === "success") {
1447
+ message.success(translate("${删除成功}"), 1);
1448
+ return true;
1449
+ } else {
1450
+ message.error(translate("${删除失败}"), 3);
1451
+ return false;
1452
+ }
1453
+ }
1454
+
1455
+ // 请求用户我的菜单
1456
+ static async getQuickMenu() {
1457
+ let res = await Super.super({
1458
+ url: `/v3/devops/menu-config/quick-menu`,
1459
+ method: "GET",
1460
+ });
1461
+ if (res?.status === "success") {
1462
+ return res.configs;
1463
+ } else {
1464
+ return null;
1465
+ }
1466
+ }
1467
+
1468
+ // 添加用户我的菜单
1469
+ static async postQuickMenu(menuCodes: string[]) {
1470
+ let res = await Super.super({
1471
+ url: `/v3/devops/menu-config/quick-menu`,
1472
+ method: "POST",
1473
+ data: { menuCodes },
1474
+ });
1475
+ if (res?.status === "success") {
1476
+ message.success(translate("${保存成功}"), 1);
1477
+ return true;
1478
+ } else {
1479
+ message.error(translate("${保存失败}"), 3);
1480
+ return false;
1481
+ }
1482
+ }
1483
+
1484
+ // 删除用户我的菜单
1485
+ static async deleteQuickMenu(menuCode: string) {
1486
+ let res = await Super.super({
1487
+ url: `/v3/devops/menu-config/quick-menu`,
1488
+ data: { menuCode },
1489
+ method: "DELETE",
1490
+ });
1491
+ if (res?.status === "success") {
1492
+ message.success(translate("${删除成功}"), 1);
1493
+ return true;
1494
+ } else {
1495
+ message.error(translate("${删除失败}"), 3);
1496
+ return false;
1497
+ }
1498
+ }
1363
1499
  }
@@ -455,6 +455,7 @@ export interface FieldConfig extends FieldBase {
455
455
  exceptCodes?: string[];
456
456
  relDeduplication?: boolean;
457
457
  preview?: boolean; // 图片组件预览配置
458
+ isFallback?: boolean, // 图片组件是否显示容错
458
459
  dateControlShortcutKeys?: string[]; // 时间范围预设配置
459
460
  placeholder?: string; // 占位符
460
461
  appendCriteria?: CriteriaConfig; // 列查询条件配置
@@ -635,6 +636,7 @@ export interface LtmplConfig extends SelectConfig {
635
636
  strongDeleteConfirmText?: string; // 强确认删除文本
636
637
  splitTabShowType?: "tab" | "tag" | "radio"; // Tab拆解条件
637
638
  showSplitTabDataCount?: boolean; // tab拆解条件是否显示统计数据
639
+ paginationPosition?: "left" | "middle" | "right"; // 分页组件位置
638
640
  }
639
641
 
640
642
  export interface EnumItem {
@@ -857,4 +859,24 @@ export interface BlockType {
857
859
  icon?: string;
858
860
  themeColor?: string;
859
861
  funcDescription?: string;
862
+ }
863
+
864
+ export interface ThemeConfig {
865
+ id: string;
866
+ allowUserConfig?: boolean;
867
+ allowUsermenu?: boolean;
868
+ defaultStyleTheme?: string;
869
+ hideLeftMenuTheme?: string;
870
+ loginMainPicture?: string;
871
+ loginPagePasswordResetable?: boolean;
872
+ loginPageRegisterable?: boolean;
873
+ loginPageSubTitle?: string;
874
+ loginPageTitle?: string;
875
+ programIcon?: string;
876
+ programName?: string;
877
+ recordCode?: string;
878
+ showLeftMenuIcon?: boolean;
879
+ showTopMenuIcon?: boolean;
880
+ styleTheme?: string;
881
+ themeColor?: string;
860
882
  }
@@ -7,6 +7,7 @@ import {
7
7
  EnumItem,
8
8
  LtmplConfig,
9
9
  SelectConfig,
10
+ ThemeConfig
10
11
  } from "../tmpl/interface";
11
12
  import dayjs from "dayjs";
12
13
  import TmplConfigAnalysis from "../tmpl/tmpl-config-analysis";
@@ -45,7 +46,9 @@ const CUSTOM_COMPONENT_MAP = {};
45
46
  // 主题url vx替换正则
46
47
  const regexTheme = /(?<=#\/)vx/g;
47
48
 
48
- let themeConfig = undefined; // 系统配置主题等
49
+ let themeConfig: ThemeConfig = undefined; // 系统配置主题等
50
+
51
+ const pageConfigCommons = {}; // 用户页面自定义配置
49
52
 
50
53
  // let siderCollapsed:boolean = true;
51
54
 
@@ -1141,6 +1144,9 @@ export default {
1141
1144
  return new Date().getTime().toString();
1142
1145
  },
1143
1146
  async getUserInfo(programCode?: string, token?: string) {
1147
+ if (currentUser) {
1148
+ return currentUser;
1149
+ }
1144
1150
  let user = await HcserviceV3.getUser(programCode, token);
1145
1151
  if (user?.orgGtmplSourceId && !["null"].includes(user.orgGtmplSourceId)) {
1146
1152
  const { ltmplConfig } = await HcserviceV3.requestLtmplConfig(null, user.orgGtmplSourceId) || {};
@@ -1201,6 +1207,13 @@ export default {
1201
1207
  getThemeConfigInfo() {
1202
1208
  return themeConfig;
1203
1209
  },
1210
+ coverUserPageConfig(setting: { [key: string]: any }) { // 页面配置覆盖
1211
+ const currentUser = this.getCurrentUserInfo();
1212
+ if (!setting || !currentUser) return;
1213
+ const programCode = this.programCode();
1214
+ const localKey = `${currentUser.id}-${programCode}-userPageConfig`;
1215
+ localStorage.setItem(localKey, JSON.stringify(setting));
1216
+ },
1204
1217
  setUserPageConfig(key: string, setting: { [key: string]: any }) { // 页面配置(视图、列、分页等)存本地
1205
1218
  const currentUser = this.getCurrentUserInfo();
1206
1219
  if (!key || !setting || !currentUser) return;
@@ -1217,8 +1230,8 @@ export default {
1217
1230
  localStorage.setItem(localKey, JSON.stringify(config));
1218
1231
  return config[key];
1219
1232
  },
1220
- getUserPageConfig(key: string) { // 获取当前页面配置本地缓存
1221
- const currentUser = this.getCurrentUserInfo();
1233
+ async getUserPageConfig(key: string) { // 获取当前页面配置本地缓存
1234
+ const currentUser = await this.getUserInfo();
1222
1235
  if (!key || !currentUser) return;
1223
1236
  const programCode = this.programCode();
1224
1237
  const localKey = `${currentUser.id}-${programCode}-userPageConfig`;
@@ -1243,5 +1256,23 @@ export default {
1243
1256
  } catch {
1244
1257
  return;
1245
1258
  }
1259
+ },
1260
+ async getPageConfigCommon(menuCode: string, type?: "default" | "refresh") {
1261
+ // type == refresh 请求新数据,不使用缓存
1262
+ if ((!type || type === "default") && pageConfigCommons[menuCode]) {
1263
+ return pageConfigCommons[menuCode];
1264
+ }
1265
+ const configs = await HcserviceV3.getPageConfigCommon(menuCode);
1266
+ pageConfigCommons[menuCode] = configs;
1267
+ return configs;
1268
+ },
1269
+ async getPageConfigDefault() { // 拉取用户默认配置
1270
+ const configs = await HcserviceV3.getPageConfigDefault();
1271
+ const defUserPageConfig = configs.reduce((total, cur) => {
1272
+ total[cur.menuCode] = cur.content ? JSON.parse(cur.content) : undefined;
1273
+ return total;
1274
+ }, {});
1275
+ this.coverUserPageConfig(defUserPageConfig); // 覆盖本地缓存
1276
+ return configs;
1246
1277
  }
1247
1278
  };
@@ -5,6 +5,7 @@ import QuickEntrance from "./components/quick-entrance";
5
5
  import Workbench from "./components/workbench";
6
6
  import MenuCard from "./components/menu-card";
7
7
  import PageCard from "./components/page-card";
8
+ import UserMenus from "./components/user-menus";
8
9
  import "./index.css";
9
10
  import Units from "../units";
10
11
  import withRouter from "../routable/withroute";
@@ -331,6 +332,7 @@ const HCWelcome = (props) => {
331
332
  const [orgHomeImg, setOrgHomeImg] = useState();
332
333
  const [menus, setMenus] = useState([]);
333
334
  const [leafMenus, setLeafMenus] = useState([]);
335
+ const [themeConfig, setThemeConfig] = useState();
334
336
 
335
337
  const initUserConfig = async () => {
336
338
  let userInfo = await Units.getCurrentUserInfo();
@@ -347,6 +349,11 @@ const HCWelcome = (props) => {
347
349
  }
348
350
  };
349
351
 
352
+ const getThemeConfig = async () => {
353
+ const config = await Units.getThemeConfig();
354
+ setThemeConfig(config);
355
+ }
356
+
350
357
  const getMenus = async () => {
351
358
  const temData = await getMenuConfig(layoutRootPath || "v2");
352
359
  const temMenus = handleMenu(temData?.menu || []);
@@ -358,6 +365,7 @@ const HCWelcome = (props) => {
358
365
  useEffect(() => {
359
366
  initUserConfig();
360
367
  getMenus();
368
+ getThemeConfig();
361
369
  }, []);
362
370
 
363
371
  return (
@@ -371,6 +379,8 @@ const HCWelcome = (props) => {
371
379
  <Row gutter={16}>
372
380
  <Col span={16}>
373
381
  <Row gutter={[0, 16]}>
382
+ {(themeConfig?.allowUserConfig || themeConfig?.allowUsermenu) ?
383
+ <Col span={24}><UserMenus menus={menus} leafMenus={leafMenus} themeConfig={themeConfig} /></Col> : ""}
374
384
  <Col span={24}><QuickEntrance layoutRootPath={layoutRootPath} menus={menus[0]?.children || []} /></Col>
375
385
  <Col span={24}><MenuCard menus={menus} /></Col>
376
386
  </Row>
@@ -12,6 +12,7 @@
12
12
  justify-content: space-between;
13
13
  border: 1px solid;
14
14
  cursor: pointer;
15
+ height: 100%;
15
16
 
16
17
  .ant-row {
17
18
  width: 100%;