aldehyde 0.2.419 → 0.2.421
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/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.map +1 -1
- package/lib/layout2/components/user-button.js +17 -6
- package/lib/layout2/components/user-button.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/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 +33 -10
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/index.css +29 -0
- 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/query-table.js +1 -1
- package/lib/table/query-table.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +6 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +103 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +19 -0
- package/lib/tmpl/interface.d.ts.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/package.json +1 -1
- package/src/aldehyde/layout2/components/search-menu.tsx +1 -1
- package/src/aldehyde/layout2/components/user-button.tsx +33 -7
- 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.tsx +3 -1
- 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 +34 -10
- package/src/aldehyde/table/index.css +29 -0
- package/src/aldehyde/table/page-config-button.tsx +199 -0
- package/src/aldehyde/table/query-table.tsx +1 -1
- package/src/aldehyde/tmpl/hcservice-v3.tsx +92 -0
- package/src/aldehyde/tmpl/interface.tsx +20 -0
- package/src/aldehyde/units/index.tsx +34 -3
|
@@ -182,4 +182,33 @@
|
|
|
182
182
|
.aggregates {
|
|
183
183
|
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
184
184
|
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* 用户自定义配置按钮样式 */
|
|
188
|
+
.page-config-menu-item {
|
|
189
|
+
display: flex;
|
|
190
|
+
justify-content: space-between;
|
|
191
|
+
align-items: center;
|
|
192
|
+
width: 152px;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.page-config-menu-item .page-config-menu-item-title {
|
|
196
|
+
width: 80px;
|
|
197
|
+
text-overflow: ellipsis;
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
white-space: nowrap;
|
|
200
|
+
text-align: left;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.page-config-menu-item .page-config-menu-item-icon {
|
|
204
|
+
display: none;
|
|
205
|
+
margin-left: 12px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.page-config-menu-item:hover .page-config-menu-item-icon {
|
|
209
|
+
display: block;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.page-config-menu-item-edit .page-config-menu-item-icon {
|
|
213
|
+
display: block !important;
|
|
185
214
|
}
|
|
@@ -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;
|
|
@@ -248,7 +248,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
|
|
|
248
248
|
} else {
|
|
249
249
|
aggregateVO = await HcserviceV3.requestQueryAggregates(serverKey, queryKey.key);
|
|
250
250
|
}
|
|
251
|
-
onChangeAggregateVO(aggregateVO)
|
|
251
|
+
onChangeAggregateVO && onChangeAggregateVO(aggregateVO);
|
|
252
252
|
this.setState({ aggregateVO });
|
|
253
253
|
}
|
|
254
254
|
};
|
|
@@ -1360,4 +1360,96 @@ 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
|
+
|
|
1363
1455
|
}
|
|
@@ -857,4 +857,24 @@ export interface BlockType {
|
|
|
857
857
|
icon?: string;
|
|
858
858
|
themeColor?: string;
|
|
859
859
|
funcDescription?: string;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
export interface ThemeConfig {
|
|
863
|
+
id: string;
|
|
864
|
+
allowUserConfig?: boolean;
|
|
865
|
+
allowUsermenu?: boolean;
|
|
866
|
+
defaultStyleTheme?: string;
|
|
867
|
+
hideLeftMenuTheme?: string;
|
|
868
|
+
loginMainPicture?: string;
|
|
869
|
+
loginPagePasswordResetable?: boolean;
|
|
870
|
+
loginPageRegisterable?: boolean;
|
|
871
|
+
loginPageSubTitle?: string;
|
|
872
|
+
loginPageTitle?: string;
|
|
873
|
+
programIcon?: string;
|
|
874
|
+
programName?: string;
|
|
875
|
+
recordCode?: string;
|
|
876
|
+
showLeftMenuIcon?: boolean;
|
|
877
|
+
showTopMenuIcon?: boolean;
|
|
878
|
+
styleTheme?: string;
|
|
879
|
+
themeColor?: string;
|
|
860
880
|
}
|
|
@@ -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.
|
|
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
|
};
|