@gct-paas/design 6.0.0-dev.3 → 6.0.0-dev.30
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/dist/loader.esm.min.js +2 -2
- package/es/hooks/design-view/components/useUserOccupy.mjs +2 -1
- package/es/hooks/design-view/design-state.d.ts +5 -0
- package/es/hooks/design-view/designer/useDesignHistory.mjs +13 -4
- package/es/hooks/design-view/designer/useDesignSave.mjs +46 -18
- package/es/hooks/design-view/global/useGlobal.d.ts +3 -3
- package/es/hooks/design-view/global/useGlobal.mjs +24 -9
- package/es/hooks/design-view/layout/useToolkit.mjs +14 -11
- package/es/hooks/design-view/page/usePage.d.ts +4 -4
- package/es/hooks/design-view/page/usePage.mjs +42 -38
- package/es/hooks/design-view/useDesigner.d.ts +1 -1
- package/es/hooks/design-view/useDesigner.mjs +0 -11
- package/es/hooks/design-view/widget/useWidget.mjs +2 -2
- package/es/locale/sys.d.ts +1 -0
- package/es/locale/sys.mjs +2 -1
- package/es/schema/common-config/common-field-editor-config.mjs +5 -5
- package/es/schema/common-config/display-editor-config.mjs +2 -2
- package/es/schema/modal/modal.mjs +3 -4
- package/es/setup-app.mjs +6 -0
- package/package.json +11 -11
|
@@ -138,8 +138,9 @@ function _useUserOccupy() {
|
|
|
138
138
|
async function lock() {
|
|
139
139
|
if (occupyInfo.value.occupyId) return;
|
|
140
140
|
if (lockInfo.value.id) return;
|
|
141
|
+
const sthText = i18nKeyMap[params.type] || "sys.page";
|
|
141
142
|
Modal.confirm({
|
|
142
|
-
title: t("sys.sureToLockSth", { sth: t(
|
|
143
|
+
title: t("sys.sureToLockSth", { sth: t(sthText) }),
|
|
143
144
|
icon: createVNode(ExclamationCircleOutlined),
|
|
144
145
|
okText: t("sys.ok"),
|
|
145
146
|
cancelText: t("sys.cancel"),
|
|
@@ -1171,6 +1171,7 @@ export declare const pageJson: {
|
|
|
1171
1171
|
unitType?: "px" | "%" | undefined;
|
|
1172
1172
|
pageWidth?: number | undefined;
|
|
1173
1173
|
independentDetailPage?: boolean | undefined;
|
|
1174
|
+
detailPageCustom?: boolean | undefined;
|
|
1174
1175
|
};
|
|
1175
1176
|
pageVars: {
|
|
1176
1177
|
id: string;
|
|
@@ -2622,6 +2623,8 @@ export declare const pageDesignHistoryList: import('vue').Ref<{
|
|
|
2622
2623
|
createUserId?: string | undefined;
|
|
2623
2624
|
createUserName?: string | undefined;
|
|
2624
2625
|
designerJson?: string | undefined;
|
|
2626
|
+
detailDesignerJson?: string | undefined;
|
|
2627
|
+
detailRuntimeJson?: string | undefined;
|
|
2625
2628
|
id?: string | undefined;
|
|
2626
2629
|
modifyTime?: string | undefined;
|
|
2627
2630
|
modifyUserId?: string | undefined;
|
|
@@ -2636,6 +2639,8 @@ export declare const pageDesignHistoryList: import('vue').Ref<{
|
|
|
2636
2639
|
createUserId?: string | undefined;
|
|
2637
2640
|
createUserName?: string | undefined;
|
|
2638
2641
|
designerJson?: string | undefined;
|
|
2642
|
+
detailDesignerJson?: string | undefined;
|
|
2643
|
+
detailRuntimeJson?: string | undefined;
|
|
2639
2644
|
id?: string | undefined;
|
|
2640
2645
|
modifyTime?: string | undefined;
|
|
2641
2646
|
modifyUserId?: string | undefined;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { loading, noMore, pageDesignHistoryList, pageJson, pageNo } from "../design-state.mjs";
|
|
2
2
|
import { useDesignPreview } from "./useDesignPreview.mjs";
|
|
3
3
|
import { useDesignSave } from "./useDesignSave.mjs";
|
|
4
|
-
import "@gct-paas/core";
|
|
4
|
+
import { ContextSceneEnum } from "@gct-paas/core";
|
|
5
5
|
//#region src/hooks/design-view/designer/useDesignHistory.ts
|
|
6
|
+
/**
|
|
7
|
+
* 历史版本管理 Hook
|
|
8
|
+
*
|
|
9
|
+
* 管理设计器的历史版本列表的加载、预览、恢复和删除等操作。
|
|
10
|
+
*/
|
|
6
11
|
function useDesignHistory() {
|
|
7
12
|
/**
|
|
8
13
|
* 获取历史版本列表(分页加载,支持滚动加载更多)
|
|
@@ -11,11 +16,14 @@ function useDesignHistory() {
|
|
|
11
16
|
if (loading.value || noMore.value) return;
|
|
12
17
|
loading.value = true;
|
|
13
18
|
try {
|
|
14
|
-
const
|
|
19
|
+
const config = {
|
|
15
20
|
relationId: _gct.store.context.pid,
|
|
16
21
|
pageNo: pageNo.value ?? 1,
|
|
17
22
|
pageSize: 50
|
|
18
|
-
}
|
|
23
|
+
};
|
|
24
|
+
if (_gct.store.context.scene === ContextSceneEnum.DETAIL) config.relationType = 4;
|
|
25
|
+
else if (_gct.store.context.scene === ContextSceneEnum.TXN) config.relationType = 5;
|
|
26
|
+
const res = await _api.apaas.pageDesignerLog.getPageList(config);
|
|
19
27
|
if (res) {
|
|
20
28
|
if (pageNo.value === 1) pageDesignHistoryList.value = res.data || [];
|
|
21
29
|
else pageDesignHistoryList.value = [...pageDesignHistoryList.value, ...res.data || []];
|
|
@@ -70,7 +78,8 @@ function useDesignHistory() {
|
|
|
70
78
|
}
|
|
71
79
|
});
|
|
72
80
|
const { save } = useDesignSave();
|
|
73
|
-
|
|
81
|
+
const scene = _gct.store.context.scene;
|
|
82
|
+
await save(false, true, scene);
|
|
74
83
|
loadPageDesignHistoryList();
|
|
75
84
|
}
|
|
76
85
|
}
|
|
@@ -26,16 +26,20 @@ function deepFindPlugins(widgets) {
|
|
|
26
26
|
return items;
|
|
27
27
|
}
|
|
28
28
|
function getDefaultTxnDetailPageJson() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
paddingLeft: "16"
|
|
37
|
-
}
|
|
29
|
+
const _json = cloneDeep(defaultPageJson);
|
|
30
|
+
_json.style = {
|
|
31
|
+
paddingAll: "",
|
|
32
|
+
paddingTop: "",
|
|
33
|
+
paddingRight: "16",
|
|
34
|
+
paddingBottom: "16",
|
|
35
|
+
paddingLeft: "16"
|
|
38
36
|
};
|
|
37
|
+
_json.pageConfig = {
|
|
38
|
+
title: "",
|
|
39
|
+
i18n: {},
|
|
40
|
+
hasFooter: false
|
|
41
|
+
};
|
|
42
|
+
return _json;
|
|
39
43
|
}
|
|
40
44
|
function useDesignSave() {
|
|
41
45
|
const { cancelOccupy } = useUserOccupy();
|
|
@@ -144,15 +148,29 @@ function useDesignSave() {
|
|
|
144
148
|
return plugins;
|
|
145
149
|
}
|
|
146
150
|
/**
|
|
151
|
+
* 事务页专用兜底:老数据或默认 JSON 可能缺 widgets/modals/pageConfig 等字段,
|
|
152
|
+
* 只在事务保存路径补齐,避免影响页面设计、详情卡片等其他入口
|
|
153
|
+
*/
|
|
154
|
+
function normalizeTxnPageJson(json) {
|
|
155
|
+
json.widgets = json.widgets ?? [];
|
|
156
|
+
json.modals = json.modals ?? [];
|
|
157
|
+
if (!json.pageConfig) json.pageConfig = {
|
|
158
|
+
title: "",
|
|
159
|
+
i18n: {},
|
|
160
|
+
hasFooter: false
|
|
161
|
+
};
|
|
162
|
+
return json;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
147
165
|
* 根据 txnPageMode 解析创建页 / 详情页两份 pageJson
|
|
148
166
|
*/
|
|
149
167
|
function resolveTxnPageJsonPair() {
|
|
150
168
|
if (pageInfo.value.txnPageMode === "create") return {
|
|
151
169
|
createPageJson: pageJson,
|
|
152
|
-
detailPageJson: pageInfo.value.detailDesignerJson ? JSON.parse(pageInfo.value.detailDesignerJson) : getDefaultTxnDetailPageJson()
|
|
170
|
+
detailPageJson: pageInfo.value.detailDesignerJson ? normalizeTxnPageJson(JSON.parse(pageInfo.value.detailDesignerJson)) : getDefaultTxnDetailPageJson()
|
|
153
171
|
};
|
|
154
172
|
return {
|
|
155
|
-
createPageJson: pageInfo.value._designerJson ? JSON.parse(pageInfo.value._designerJson) : cloneDeep(defaultPageJson),
|
|
173
|
+
createPageJson: pageInfo.value._designerJson ? normalizeTxnPageJson(JSON.parse(pageInfo.value._designerJson)) : cloneDeep(defaultPageJson),
|
|
156
174
|
detailPageJson: pageJson
|
|
157
175
|
};
|
|
158
176
|
}
|
|
@@ -249,6 +267,13 @@ function useDesignSave() {
|
|
|
249
267
|
async function saveTxn(flag = true, showSuccess = true) {
|
|
250
268
|
const pageId = _gct.store.context.pid;
|
|
251
269
|
const { createPageJson, detailPageJson } = resolveTxnPageJsonPair();
|
|
270
|
+
const MAX_TITLE_LENGTH = 100;
|
|
271
|
+
const createTitle = createPageJson.pageConfig?.title;
|
|
272
|
+
const detailTitle = detailPageJson.pageConfig?.title;
|
|
273
|
+
if (createTitle && createTitle.length > MAX_TITLE_LENGTH || detailTitle && detailTitle.length > MAX_TITLE_LENGTH) {
|
|
274
|
+
message.error(t("sys.pageDesigner.titleMaxLength"));
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
252
277
|
const createPayload = await preparePagePayload(createPageJson);
|
|
253
278
|
if (!createPayload) return false;
|
|
254
279
|
const detailPayload = await preparePagePayload(detailPageJson);
|
|
@@ -257,7 +282,7 @@ function useDesignSave() {
|
|
|
257
282
|
const { designerJson: _detailDesignerJson, runtimeJson: detailRuntimeJson } = detailPayload;
|
|
258
283
|
pageInfo.value._designerJson = JSON.stringify(_designerJson);
|
|
259
284
|
pageInfo.value.detailDesignerJson = JSON.stringify(_detailDesignerJson);
|
|
260
|
-
await _api.apaas.transaction.
|
|
285
|
+
await _api.apaas.transaction.putUpdateDesignerJsonId({ id: pageId }, {
|
|
261
286
|
designerJson: JSON.stringify(_designerJson),
|
|
262
287
|
runtimeJson: JSON.stringify(runtimeJson),
|
|
263
288
|
detailDesignerJson: JSON.stringify(_detailDesignerJson),
|
|
@@ -265,11 +290,12 @@ function useDesignSave() {
|
|
|
265
290
|
modelKey: pageInfo.value.modelKey,
|
|
266
291
|
name: pageInfo.value.name,
|
|
267
292
|
version: pageInfo.value.version,
|
|
268
|
-
default: pageInfo.value.default,
|
|
269
|
-
key: pageInfo.value.key
|
|
293
|
+
default: Number(pageInfo.value.default),
|
|
294
|
+
key: pageInfo.value.key,
|
|
295
|
+
logId: (pageDesignHistoryList.value[0] ?? {}).id
|
|
270
296
|
});
|
|
271
297
|
savePageJsonSnapshot(pageInfo.value.txnPageMode === "create" ? _designerJson : _detailDesignerJson);
|
|
272
|
-
if (showSuccess) _gct.message.success(flag ? "sys.saveSuccess" : "sys.recoverSuccess");
|
|
298
|
+
if (showSuccess) _gct.message.success(flag ? t("sys.saveSuccess") : t("sys.recoverSuccess"));
|
|
273
299
|
cancelOccupy();
|
|
274
300
|
noMore.value = false;
|
|
275
301
|
pageNo.value = 1;
|
|
@@ -289,12 +315,14 @@ function useDesignSave() {
|
|
|
289
315
|
pageInfo.value._designerJson = JSON.stringify(_designerJson);
|
|
290
316
|
await _api.apaas.detailPage.putUpdateDesignerJsonId({ id: pageId }, {
|
|
291
317
|
designerJson: JSON.stringify(_designerJson),
|
|
292
|
-
|
|
318
|
+
description: pageInfo.value.description,
|
|
293
319
|
key: pageInfo.value.key,
|
|
294
320
|
name: pageInfo.value.name,
|
|
295
|
-
|
|
321
|
+
logId: (pageDesignHistoryList.value[0] ?? {}).id,
|
|
322
|
+
runtimeJson: JSON.stringify(runtimeJson)
|
|
296
323
|
});
|
|
297
|
-
|
|
324
|
+
savePageJsonSnapshot();
|
|
325
|
+
if (showSuccess) _gct.message.success(flag ? t("sys.saveSuccess") : t("sys.recoverSuccess"));
|
|
298
326
|
cancelOccupy();
|
|
299
327
|
noMore.value = false;
|
|
300
328
|
pageNo.value = 1;
|
|
@@ -6,9 +6,9 @@ export declare function useGlobal(): {
|
|
|
6
6
|
updateInfo: (id: string, data: AppGlobalSettingsRequest) => Promise<void>;
|
|
7
7
|
addInfo: (data: AppGlobalSettingsRequest) => Promise<void>;
|
|
8
8
|
deleteInfo: (ids: string) => Promise<void>;
|
|
9
|
-
queryGModal: (fullInfo?: boolean) => Promise<void>;
|
|
10
|
-
queryGVar: (fullInfo?: boolean) => Promise<void>;
|
|
11
|
-
queryGEvent: (fullInfo?: boolean) => Promise<void>;
|
|
9
|
+
queryGModal: (fullInfo?: boolean, configObj?: Record<string, string>) => Promise<void>;
|
|
10
|
+
queryGVar: (fullInfo?: boolean, configObj?: Record<string, string>) => Promise<void>;
|
|
11
|
+
queryGEvent: (fullInfo?: boolean, configObj?: Record<string, string>) => Promise<void>;
|
|
12
12
|
gVar: import('vue').Ref<{
|
|
13
13
|
id: string;
|
|
14
14
|
key: string;
|
|
@@ -8,11 +8,16 @@ var gModal = ref([]);
|
|
|
8
8
|
/**全局事件 */
|
|
9
9
|
var gEvent = ref([]);
|
|
10
10
|
function useGlobal() {
|
|
11
|
-
async function queryGModal(fullInfo = false) {
|
|
12
|
-
|
|
11
|
+
async function queryGModal(fullInfo = false, configObj) {
|
|
12
|
+
let queryObj = {
|
|
13
13
|
type: GLOBAL_TYPE.MODAL,
|
|
14
14
|
fullInfo
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
|
+
if (configObj) queryObj = {
|
|
17
|
+
...queryObj,
|
|
18
|
+
...configObj
|
|
19
|
+
};
|
|
20
|
+
gModal.value = (await _api.apaas.appGlobalSettings.getList(queryObj))?.map((modal) => {
|
|
16
21
|
return {
|
|
17
22
|
id: modal.id,
|
|
18
23
|
name: modal.name,
|
|
@@ -21,11 +26,16 @@ function useGlobal() {
|
|
|
21
26
|
};
|
|
22
27
|
}) || [];
|
|
23
28
|
}
|
|
24
|
-
async function queryGVar(fullInfo = true) {
|
|
25
|
-
|
|
29
|
+
async function queryGVar(fullInfo = true, configObj) {
|
|
30
|
+
let queryObj = {
|
|
26
31
|
type: GLOBAL_TYPE.VAR,
|
|
27
32
|
fullInfo
|
|
28
|
-
}
|
|
33
|
+
};
|
|
34
|
+
if (configObj) queryObj = {
|
|
35
|
+
...queryObj,
|
|
36
|
+
...configObj
|
|
37
|
+
};
|
|
38
|
+
gVar.value = (await _api.apaas.appGlobalSettings.getList(queryObj))?.map((variable) => {
|
|
29
39
|
return {
|
|
30
40
|
id: variable.id,
|
|
31
41
|
key: variable.key,
|
|
@@ -33,11 +43,16 @@ function useGlobal() {
|
|
|
33
43
|
};
|
|
34
44
|
}) || [];
|
|
35
45
|
}
|
|
36
|
-
async function queryGEvent(fullInfo = false) {
|
|
37
|
-
|
|
46
|
+
async function queryGEvent(fullInfo = false, configObj) {
|
|
47
|
+
let queryObj = {
|
|
38
48
|
type: GLOBAL_TYPE.EVENT,
|
|
39
49
|
fullInfo
|
|
40
|
-
}
|
|
50
|
+
};
|
|
51
|
+
if (configObj) queryObj = {
|
|
52
|
+
...queryObj,
|
|
53
|
+
...configObj
|
|
54
|
+
};
|
|
55
|
+
gEvent.value = (await _api.apaas.appGlobalSettings.getList(queryObj))?.map((event) => {
|
|
41
56
|
return {
|
|
42
57
|
id: event.id,
|
|
43
58
|
key: event.key,
|
|
@@ -2,7 +2,7 @@ import { useWidgetRegistry } from "../widget/useWidgetRegistry.mjs";
|
|
|
2
2
|
import { useModelField } from "../../use-model-field/use-model-field.mjs";
|
|
3
3
|
import "../../index.mjs";
|
|
4
4
|
import { clone, cloneDeep } from "lodash-es";
|
|
5
|
-
import { CategoryTypeEnum, ContextSceneEnum, FormComponents, Platform, ToolkitEnum } from "@gct-paas/core";
|
|
5
|
+
import { CategoryTypeEnum, ContextSceneEnum, ContextTxnPageModeEnum, FormComponents, Platform, ToolkitEnum } from "@gct-paas/core";
|
|
6
6
|
import { ref } from "vue";
|
|
7
7
|
import { getWidgetInfo } from "@gct-paas/schema";
|
|
8
8
|
//#region src/hooks/design-view/layout/useToolkit.ts
|
|
@@ -148,24 +148,25 @@ var instance = class ComponentUtils {
|
|
|
148
148
|
}
|
|
149
149
|
/** 根据当前分组上下文返回应显示的分类列表 */
|
|
150
150
|
get categoryTypes() {
|
|
151
|
-
|
|
151
|
+
let categoryTypes;
|
|
152
|
+
if (this.groupType === ComponentUtils.SubTableGroup) categoryTypes = [
|
|
152
153
|
CategoryTypeEnum.FORM,
|
|
153
154
|
CategoryTypeEnum.LAYOUT,
|
|
154
155
|
CategoryTypeEnum.ADVANCED
|
|
155
156
|
];
|
|
156
|
-
if (this.groupType === ComponentUtils.TxnPageGroup)
|
|
157
|
+
else if (this.groupType === ComponentUtils.TxnPageGroup) {
|
|
158
|
+
categoryTypes = [
|
|
159
|
+
CategoryTypeEnum.FORM,
|
|
160
|
+
CategoryTypeEnum.LAYOUT,
|
|
161
|
+
CategoryTypeEnum.DATA
|
|
162
|
+
];
|
|
163
|
+
if (_gct.store.context.txnPageMode === ContextTxnPageModeEnum.CREATE) categoryTypes = [...categoryTypes, CategoryTypeEnum.BUTTON];
|
|
164
|
+
} else if (this.groupType === ComponentUtils.DetailPageGroup) categoryTypes = [
|
|
157
165
|
CategoryTypeEnum.FORM,
|
|
158
166
|
CategoryTypeEnum.LAYOUT,
|
|
159
|
-
CategoryTypeEnum.BUTTON,
|
|
160
167
|
CategoryTypeEnum.DATA
|
|
161
168
|
];
|
|
162
|
-
|
|
163
|
-
CategoryTypeEnum.FORM,
|
|
164
|
-
CategoryTypeEnum.LAYOUT,
|
|
165
|
-
CategoryTypeEnum.DATA,
|
|
166
|
-
CategoryTypeEnum.KIT
|
|
167
|
-
];
|
|
168
|
-
return [
|
|
169
|
+
else categoryTypes = [
|
|
169
170
|
CategoryTypeEnum.FORM,
|
|
170
171
|
CategoryTypeEnum.LAYOUT,
|
|
171
172
|
CategoryTypeEnum.ADVANCED,
|
|
@@ -174,6 +175,8 @@ var instance = class ComponentUtils {
|
|
|
174
175
|
CategoryTypeEnum.KIT,
|
|
175
176
|
CategoryTypeEnum.PROCESS
|
|
176
177
|
];
|
|
178
|
+
if (_gct.store.context.txnPageMode === ContextTxnPageModeEnum.CREATE) return categoryTypes.filter((categoryType) => categoryType !== CategoryTypeEnum.ADVANCED);
|
|
179
|
+
return categoryTypes;
|
|
177
180
|
}
|
|
178
181
|
/**
|
|
179
182
|
* 根据分类类型返回当前上下文下允许使用的组件 key 列表
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Ref, App } from 'vue';
|
|
2
|
-
import { PanelEnum } from '@gct-paas/core';
|
|
2
|
+
import { PanelEnum, ContextTxnPageModeEnum } from '@gct-paas/core';
|
|
3
3
|
import { PermissionResponse } from '@gct-paas/api/apaas';
|
|
4
4
|
export type { PageInfo } from '../design-state';
|
|
5
5
|
export { pageInfo } from '../design-state';
|
|
@@ -50,11 +50,11 @@ export declare function loadDetailPageInfo(app: App): Promise<void>;
|
|
|
50
50
|
/**
|
|
51
51
|
* @param mode 切换模式
|
|
52
52
|
*/
|
|
53
|
-
export declare function toggleTxnPageInfo(mode:
|
|
53
|
+
export declare function toggleTxnPageInfo(mode: ContextTxnPageModeEnum): Promise<void>;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* 初始化界面占用信息,目前针对详情和事务,补充2个锁了type,分别是detail_page和transaction_module
|
|
56
56
|
*/
|
|
57
|
-
declare function initLockState(): void;
|
|
57
|
+
declare function initLockState(type?: string): void;
|
|
58
58
|
/**
|
|
59
59
|
* 更新页面锁定状态
|
|
60
60
|
* @param {boolean} value
|
|
@@ -10,7 +10,7 @@ import { useCacheHistory } from "../../develop/useCacheHistory.mjs";
|
|
|
10
10
|
import { useToolkit } from "../layout/useToolkit.mjs";
|
|
11
11
|
import { useDesigner } from "../useDesigner.mjs";
|
|
12
12
|
import { isEmpty, isNil } from "lodash-es";
|
|
13
|
-
import { ButtonSize, ButtonStyle,
|
|
13
|
+
import { ButtonSize, ButtonStyle, ContextTxnPageModeEnum, FormComponents, KitPkgUtil, PanelEnum, Platform, t } from "@gct-paas/core";
|
|
14
14
|
import { computed, createVNode, ref } from "vue";
|
|
15
15
|
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
|
16
16
|
import { Modal } from "ant-design-vue";
|
|
@@ -117,37 +117,40 @@ async function loadPageInfo(app) {
|
|
|
117
117
|
* @returns
|
|
118
118
|
*/
|
|
119
119
|
async function loadTxnPageInfo(app) {
|
|
120
|
+
await _gct.store.setContext({ txnPageMode: ContextTxnPageModeEnum.CREATE });
|
|
120
121
|
const { initToolkitWidgets } = useToolkit();
|
|
121
|
-
const {
|
|
122
|
+
const { setTxnPageJson, loadPageDesignHistoryList, emitCache, pageJson, setPluginConfigs, savePageJsonSnapshot } = useDesigner();
|
|
122
123
|
const { historyUtils } = useCacheHistory();
|
|
123
124
|
platform.value = _gct.store.context.platform || Platform.WEB;
|
|
124
|
-
const baseid = _gct.store.context.baseid || "";
|
|
125
125
|
const pid = _gct.store.context.pid || "";
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
|
|
126
|
+
if (pid.startsWith("___new___")) {
|
|
127
|
+
const baseid = _gct.store.context.baseid || "";
|
|
128
|
+
if (baseid) {
|
|
129
|
+
const res = await _api.apaas.transaction.getGetVersionById({ id: baseid });
|
|
130
|
+
pageInfo.value = {
|
|
131
|
+
id: newKeyTag,
|
|
132
|
+
name: res.name,
|
|
133
|
+
key: res.key,
|
|
134
|
+
modelKey: res.modelKey,
|
|
135
|
+
designerJson: "",
|
|
136
|
+
_designerJson: "",
|
|
137
|
+
detailDesignerJson: "",
|
|
138
|
+
txnPageMode: "create",
|
|
139
|
+
baseId: baseid
|
|
140
|
+
};
|
|
141
|
+
} else pageInfo.value = {
|
|
129
142
|
id: newKeyTag,
|
|
130
|
-
name:
|
|
131
|
-
key:
|
|
132
|
-
modelKey: res.modelKey,
|
|
143
|
+
name: "",
|
|
144
|
+
key: pid.replace(`${newKeyTag}:`, ""),
|
|
133
145
|
designerJson: "",
|
|
134
146
|
_designerJson: "",
|
|
135
147
|
detailDesignerJson: "",
|
|
136
|
-
txnPageMode: "create"
|
|
137
|
-
baseId: baseid
|
|
148
|
+
txnPageMode: "create"
|
|
138
149
|
};
|
|
139
|
-
} else
|
|
140
|
-
id: newKeyTag,
|
|
141
|
-
name: "",
|
|
142
|
-
key: pid.replace(`${newKeyTag}:`, ""),
|
|
143
|
-
designerJson: "",
|
|
144
|
-
_designerJson: "",
|
|
145
|
-
detailDesignerJson: "",
|
|
146
|
-
txnPageMode: "create"
|
|
147
|
-
};
|
|
148
|
-
else {
|
|
150
|
+
} else {
|
|
149
151
|
const pageInfoRes = await _api.apaas.transaction.getInfo({ id: _gct.store.context.pid });
|
|
150
152
|
pageInfo.value = pageInfoRes;
|
|
153
|
+
pageInfo.value.default = Boolean(pageInfoRes.defaulted ?? false);
|
|
151
154
|
pageInfo.value._designerJson = pageInfoRes.designerJson;
|
|
152
155
|
pageInfo.value.txnPageMode = "create";
|
|
153
156
|
}
|
|
@@ -175,13 +178,13 @@ async function loadTxnPageInfo(app) {
|
|
|
175
178
|
i18n: {},
|
|
176
179
|
hasFooter: false
|
|
177
180
|
};
|
|
178
|
-
|
|
181
|
+
setTxnPageJson({
|
|
179
182
|
..._json,
|
|
180
183
|
id: pageInfo.value.id
|
|
181
184
|
}, true);
|
|
182
185
|
} else {
|
|
183
186
|
emitCache();
|
|
184
|
-
|
|
187
|
+
setTxnPageJson({
|
|
185
188
|
newDesigner: true,
|
|
186
189
|
style: {
|
|
187
190
|
paddingAll: "",
|
|
@@ -202,14 +205,13 @@ async function loadTxnPageInfo(app) {
|
|
|
202
205
|
data.props.noDelete = true;
|
|
203
206
|
bottomBtnWidget.children?.push(data);
|
|
204
207
|
});
|
|
208
|
+
pageJson.pageConfig.hasFooter = true;
|
|
205
209
|
pageJson.widgets.push(bottomBtnWidget);
|
|
206
210
|
}
|
|
207
211
|
initToolkitWidgets();
|
|
208
212
|
loadPageDesignHistoryList();
|
|
209
213
|
pagePermissions.value = await _api.apaas.permission.getList({ relationId: _gct.store.context.pid }) || [];
|
|
210
|
-
if (!pid.startsWith("___new___")) initLockState();
|
|
211
|
-
pageJson.pageConfig.unitType = "%";
|
|
212
|
-
pageJson.pageConfig.pageWidth = 80;
|
|
214
|
+
if (!pid.startsWith("___new___")) initLockState("transaction_module");
|
|
213
215
|
savePageJsonSnapshot();
|
|
214
216
|
}
|
|
215
217
|
/**
|
|
@@ -279,21 +281,22 @@ async function loadDetailPageInfo(app) {
|
|
|
279
281
|
initToolkitWidgets();
|
|
280
282
|
loadPageDesignHistoryList();
|
|
281
283
|
pagePermissions.value = await _api.apaas.permission.getList({ relationId: _gct.store.context.pid }) || [];
|
|
282
|
-
if (!pid.startsWith("___new___")) initLockState();
|
|
283
|
-
pageJson.pageConfig.title = pageJson.pageConfig.title || "
|
|
284
|
-
pageJson.pageConfig.unitType = "%";
|
|
285
|
-
pageJson.pageConfig.pageWidth = 80;
|
|
284
|
+
if (!pid.startsWith("___new___")) initLockState("detail_page");
|
|
285
|
+
pageJson.pageConfig.title = pageJson.pageConfig.title || t("sys.detail");
|
|
286
|
+
pageJson.pageConfig.unitType = pageJson.pageConfig.unitType || "%";
|
|
287
|
+
pageJson.pageConfig.pageWidth = pageJson.pageConfig.pageWidth || 80;
|
|
286
288
|
savePageJsonSnapshot();
|
|
287
289
|
}
|
|
288
290
|
/**
|
|
289
291
|
* @param mode 切换模式
|
|
290
292
|
*/
|
|
291
293
|
async function toggleTxnPageInfo(mode) {
|
|
294
|
+
await _gct.store.setContext({ txnPageMode: mode });
|
|
292
295
|
const { setTxnPageJson, pageJson } = useDesigner();
|
|
293
|
-
if (mode ===
|
|
296
|
+
if (mode === ContextTxnPageModeEnum.CREATE) {
|
|
294
297
|
pageInfo.value.detailDesignerJson = JSON.stringify(pageJson);
|
|
295
298
|
pageInfo.value.txnPageMode = mode;
|
|
296
|
-
setTxnPageJson({ ...JSON.parse(pageInfo.value._designerJson) });
|
|
299
|
+
setTxnPageJson({ ...JSON.parse(pageInfo.value._designerJson) }, true);
|
|
297
300
|
} else {
|
|
298
301
|
pageInfo.value._designerJson = JSON.stringify(pageJson);
|
|
299
302
|
pageInfo.value.txnPageMode = mode;
|
|
@@ -306,19 +309,20 @@ async function toggleTxnPageInfo(mode) {
|
|
|
306
309
|
paddingBottom: "16",
|
|
307
310
|
paddingLeft: "16"
|
|
308
311
|
}
|
|
309
|
-
} });
|
|
312
|
+
} }, false);
|
|
310
313
|
}
|
|
311
314
|
}
|
|
312
315
|
/**
|
|
313
|
-
*
|
|
316
|
+
* 初始化界面占用信息,目前针对详情和事务,补充2个锁了type,分别是detail_page和transaction_module
|
|
314
317
|
*/
|
|
315
|
-
function initLockState() {
|
|
316
|
-
if (_gct.store.context.scene === ContextSceneEnum.TXN || _gct.store.context.scene === ContextSceneEnum.DETAIL) return;
|
|
318
|
+
function initLockState(type) {
|
|
317
319
|
const { setLockInfo, initOccupy, loadOccupyInfo } = useUserOccupy();
|
|
318
|
-
|
|
320
|
+
const initData = {
|
|
319
321
|
id: _gct.store.context.pid || "",
|
|
320
322
|
type: (platform.value === Platform.WEB ? PageTypeEnum.WEB : platform.value === Platform.PAD ? PageTypeEnum.PAD : PageTypeEnum.MOBILE).toString()
|
|
321
|
-
}
|
|
323
|
+
};
|
|
324
|
+
if (type) initData.type = type;
|
|
325
|
+
initOccupy(initData);
|
|
322
326
|
loadOccupyInfo();
|
|
323
327
|
setLockInfo({
|
|
324
328
|
id: pageInfo.value?.lockUserId,
|
|
@@ -1072,6 +1072,7 @@ export declare function useDesigner(): {
|
|
|
1072
1072
|
unitType?: "px" | "%" | undefined;
|
|
1073
1073
|
pageWidth?: number | undefined;
|
|
1074
1074
|
independentDetailPage?: boolean | undefined;
|
|
1075
|
+
detailPageCustom?: boolean | undefined;
|
|
1075
1076
|
};
|
|
1076
1077
|
pageVars: {
|
|
1077
1078
|
id: string;
|
|
@@ -1096,7 +1097,6 @@ export declare function useDesigner(): {
|
|
|
1096
1097
|
handleAddDrag: (newIndex: number, childrenList: LowCodeWidget.BasicSchema[], scope: SCOPE, formID?: string) => void;
|
|
1097
1098
|
setPageJson: (json: PageJson, hasFooter?: boolean) => Promise<void>;
|
|
1098
1099
|
setTxnPageJson: (json: PageJson, hasFooter?: boolean) => Promise<void>;
|
|
1099
|
-
setDetailPageJson: (json: PageJson, hasFooter?: boolean) => Promise<void>;
|
|
1100
1100
|
save: (flag?: boolean, showSuccess?: boolean, scene?: string) => Promise<boolean>;
|
|
1101
1101
|
savePageJsonSnapshot: (json?: PageJson) => void;
|
|
1102
1102
|
emitCache: () => void;
|
|
@@ -56,16 +56,6 @@ function useDesigner() {
|
|
|
56
56
|
if (!pageJson.pageConfig.pageWidth) pageJson.pageConfig.pageWidth = 80;
|
|
57
57
|
cache.emitCache();
|
|
58
58
|
}
|
|
59
|
-
async function setDetailPageJson(json, hasFooter = false) {
|
|
60
|
-
pageJson.pageConfig.hasFooter = hasFooter || platform.value === Platform.MOBILE || platform.value === Platform.PAD;
|
|
61
|
-
Object.assign(pageJson, defaultPageJson, json);
|
|
62
|
-
initMethodMap(pageJson.js).then((map) => {
|
|
63
|
-
methodMap.value = map;
|
|
64
|
-
});
|
|
65
|
-
if (!pageJson.pageConfig.unitType) pageJson.pageConfig.unitType = "%";
|
|
66
|
-
if (!pageJson.pageConfig.pageWidth) pageJson.pageConfig.pageWidth = 80;
|
|
67
|
-
cache.emitCache();
|
|
68
|
-
}
|
|
69
59
|
/** 检查是否可以拖拽进入的方法,比如某些组件不能拖到某些组件内 */
|
|
70
60
|
function checkWidgetMove() {
|
|
71
61
|
return true;
|
|
@@ -87,7 +77,6 @@ function useDesigner() {
|
|
|
87
77
|
handleAddDrag,
|
|
88
78
|
setPageJson,
|
|
89
79
|
setTxnPageJson,
|
|
90
|
-
setDetailPageJson,
|
|
91
80
|
save: saveHook.save,
|
|
92
81
|
savePageJsonSnapshot: saveHook.savePageJsonSnapshot,
|
|
93
82
|
emitCache: cache.emitCache,
|
|
@@ -55,8 +55,8 @@ function useWidget(props) {
|
|
|
55
55
|
});
|
|
56
56
|
const widgetdesigner = designRegister.value.getProvider(widget.type)?.designerConfig || {};
|
|
57
57
|
const hideMaskValue = computed(() => {
|
|
58
|
-
if (typeof widgetdesigner
|
|
59
|
-
return widgetdesigner
|
|
58
|
+
if (typeof widgetdesigner.hideMask === "function") return widgetdesigner.hideMask(widget);
|
|
59
|
+
return widgetdesigner.hideMask;
|
|
60
60
|
});
|
|
61
61
|
return {
|
|
62
62
|
isWidgetSelected,
|
package/es/locale/sys.d.ts
CHANGED
package/es/locale/sys.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { useScope } from "../../hooks/design-view/layout/useScope.mjs";
|
|
|
3
3
|
import { useDesigner } from "../../hooks/design-view/useDesigner.mjs";
|
|
4
4
|
import "../../hooks/index.mjs";
|
|
5
5
|
import { has } from "lodash-es";
|
|
6
|
-
import { BindCmpStyleEnum, BindCmpStyleTypeEnum, ContextSceneEnum, EntityModelTypeEnum, FIELD_TYPE, FormComponents, MaterialEnum, Platform, PropGroup, TreeHelper } from "@gct-paas/core";
|
|
6
|
+
import { BindCmpStyleEnum, BindCmpStyleTypeEnum, ContextSceneEnum, ContextTxnPageModeEnum, EntityModelTypeEnum, FIELD_TYPE, FormComponents, MaterialEnum, Platform, PropGroup, TreeHelper } from "@gct-paas/core";
|
|
7
7
|
import { isFormFieldType } from "@gct-paas/schema";
|
|
8
8
|
//#region src/schema/common-config/common-field-editor-config.ts
|
|
9
9
|
/** 字段名称和显示标题config */
|
|
@@ -62,7 +62,7 @@ var getInputAttrEditor = (needFieldAttrs) => {
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
hidden(widget) {
|
|
65
|
-
return widget.props.field === "operating_state_" || widget.props.bindFieldKey || widget.materialType === MaterialEnum.DescriptionsFormField || widget.props.fieldReadonly || _gct.store.context.scene === ContextSceneEnum.DETAIL;
|
|
65
|
+
return widget.props.field === "operating_state_" || widget.props.bindFieldKey || widget.materialType === MaterialEnum.DescriptionsFormField || widget.props.fieldReadonly || _gct.store.context.scene === ContextSceneEnum.DETAIL || _gct.store.context.txnPageMode === ContextTxnPageModeEnum.DETAIL;
|
|
66
66
|
}
|
|
67
67
|
}];
|
|
68
68
|
};
|
|
@@ -118,7 +118,7 @@ var explainEditor = [{
|
|
|
118
118
|
formItemStyle: { marginBottom: "12px" },
|
|
119
119
|
group: PropGroup.FIELD_CONFIG,
|
|
120
120
|
hidden: (widget) => {
|
|
121
|
-
if (
|
|
121
|
+
if (widget.props.hiddenInDetail) return true;
|
|
122
122
|
if (widget.props.bindFieldKey || widget.props.fieldReadonly) return true;
|
|
123
123
|
if ((widget.materialType === MaterialEnum.MaterialFormField || widget.materialType === MaterialEnum.MaterialSubTableModalField) && widget.platform === Platform.PAD) return true;
|
|
124
124
|
return widget.platform !== Platform.WEB && widget.platform !== Platform.PAD;
|
|
@@ -162,8 +162,8 @@ var validatorEditor = [{
|
|
|
162
162
|
label: "sys.pageDesigner.closeValidator",
|
|
163
163
|
group: PropGroup.FIELD_CONFIG,
|
|
164
164
|
formField: true,
|
|
165
|
-
hidden() {
|
|
166
|
-
return
|
|
165
|
+
hidden(widget) {
|
|
166
|
+
return widget.props.hiddenInDetail;
|
|
167
167
|
}
|
|
168
168
|
}];
|
|
169
169
|
/** 下拉列表、单选、多选公共config */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hiddenButtonProps } from "./button-props-func.mjs";
|
|
2
|
-
import { ASSIGNMENTSTRATEGY_ENUM,
|
|
2
|
+
import { ASSIGNMENTSTRATEGY_ENUM, Dependency_ENUM, FIELD_TYPE, FormComponents, MaterialEnum, Platform, PropGroup } from "@gct-paas/core";
|
|
3
3
|
import { padVTableSupportEditFieldTypes } from "@gct-paas/schema";
|
|
4
4
|
//#region src/schema/common-config/display-editor-config.ts
|
|
5
5
|
var displayProps = {
|
|
@@ -66,7 +66,7 @@ var displayEditor = [
|
|
|
66
66
|
label: "sys.pageDesigner.deviceConnectivity",
|
|
67
67
|
group: PropGroup.FIELD_CONFIG,
|
|
68
68
|
hidden: (widget) => {
|
|
69
|
-
return widget.platform !== Platform.WEB || ![MaterialEnum.MaterialFormField].includes(widget.materialType) || !deviceFields.includes(widget.props.fieldType) || widget.props.fieldReadonly ||
|
|
69
|
+
return widget.platform !== Platform.WEB || ![MaterialEnum.MaterialFormField].includes(widget.materialType) || !deviceFields.includes(widget.props.fieldType) || widget.props.fieldReadonly || widget.props.hiddenInDetail;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { widget as widget$1 } from "./modal-body.mjs";
|
|
3
3
|
import { widget as widget$2 } from "./modal-footer.mjs";
|
|
4
|
-
import { BuiltinType, Platform, PropGroup, StyleGroup
|
|
4
|
+
import { BuiltinType, ContextSceneEnum, ContextTxnPageModeEnum, Platform, PropGroup, StyleGroup } from "@gct-paas/core";
|
|
5
5
|
//#region src/schema/modal/modal.ts
|
|
6
6
|
var modal_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
beforeCreate: () => beforeCreate,
|
|
@@ -145,7 +145,7 @@ var propEditorList = [
|
|
|
145
145
|
label: "sys.pageDesigner.operateButton",
|
|
146
146
|
group: PropGroup.BUTTON,
|
|
147
147
|
hidden: (widget) => {
|
|
148
|
-
return widget.props.isSubTableModal;
|
|
148
|
+
return widget.props.isSubTableModal || _gct.store.context.scene === ContextSceneEnum.DETAIL || _gct.store.context.txnPageMode === ContextTxnPageModeEnum.DETAIL;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
];
|
|
@@ -166,8 +166,7 @@ var eventList = [{
|
|
|
166
166
|
}];
|
|
167
167
|
var runCallback = () => {};
|
|
168
168
|
var beforeCreate = (widget) => {
|
|
169
|
-
|
|
170
|
-
widget.children[1].id = buildShortUUID(widget.children[1].type);
|
|
169
|
+
if (_gct.store.context.scene === ContextSceneEnum.DETAIL || _gct.store.context.txnPageMode === ContextTxnPageModeEnum.DETAIL) widget.props.hasFooter = false;
|
|
171
170
|
};
|
|
172
171
|
var designerConfig = { basicProps: {
|
|
173
172
|
key_label: "弹窗",
|