@gct-paas/design 0.1.6-dev.21 → 0.1.6-dev.22

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.
@@ -1,6 +1,6 @@
1
1
  import { pageLayoutModeEnum } from '@gct-paas/core';
2
2
  import { ExportMethod, LowCodeWidget, PageJson, IModal } from '@gct-paas/schema';
3
- import { PageDesignerLogResponse } from '@gct-paas/api/apaas';
3
+ import { PageDesignerLogResponse, WebpageResponse } from '@gct-paas/api/apaas';
4
4
  import { platform, designRegister } from '../../utils';
5
5
  export { platform, designRegister };
6
6
  /**
@@ -13,6 +13,112 @@ export declare const widgetInfo: import('vue').ComputedRef<import('@gct-paas/sch
13
13
  /**
14
14
  * 当前平台的插件注册实例
15
15
  */
16
+ export type PageInfo = WebpageResponse & {
17
+ categoryId?: string;
18
+ version?: string;
19
+ default?: boolean;
20
+ modelKey?: string;
21
+ _designerJson?: string;
22
+ detailDesignerJson?: string;
23
+ txnPageMode?: 'create' | 'detail';
24
+ baseId?: string;
25
+ };
26
+ /** 当前设计页面基础信息 */
27
+ export declare const pageInfo: import('vue').Ref<{
28
+ categoryResponse?: {
29
+ createTime?: string | undefined;
30
+ createUserId?: string | undefined;
31
+ createUserName?: string | undefined;
32
+ id?: string | undefined;
33
+ modifyTime?: string | undefined;
34
+ modifyUserId?: string | undefined;
35
+ modifyUserName?: string | undefined;
36
+ module?: string | undefined;
37
+ name?: string | undefined;
38
+ sortNum?: number | undefined;
39
+ sysBuiltin?: number | undefined;
40
+ } | undefined;
41
+ createTime?: string | undefined;
42
+ createUserId?: string | undefined;
43
+ createUserName?: string | undefined;
44
+ description?: string | undefined;
45
+ designerJson?: string | undefined;
46
+ id?: string | undefined;
47
+ key?: string | undefined;
48
+ lockUserId?: string | undefined;
49
+ lockUserName?: string | undefined;
50
+ modifyTime?: string | undefined;
51
+ modifyUserId?: string | undefined;
52
+ modifyUserName?: string | undefined;
53
+ name?: string | undefined;
54
+ newLogId?: string | undefined;
55
+ runtimeJson?: string | undefined;
56
+ categoryId?: string | undefined;
57
+ version?: string | undefined;
58
+ default?: boolean | undefined;
59
+ modelKey?: string | undefined;
60
+ _designerJson?: string | undefined;
61
+ detailDesignerJson?: string | undefined;
62
+ txnPageMode?: "create" | "detail" | undefined;
63
+ baseId?: string | undefined;
64
+ }, {
65
+ categoryResponse?: {
66
+ createTime?: string | undefined;
67
+ createUserId?: string | undefined;
68
+ createUserName?: string | undefined;
69
+ id?: string | undefined;
70
+ modifyTime?: string | undefined;
71
+ modifyUserId?: string | undefined;
72
+ modifyUserName?: string | undefined;
73
+ module?: string | undefined;
74
+ name?: string | undefined;
75
+ sortNum?: number | undefined;
76
+ sysBuiltin?: number | undefined;
77
+ } | undefined;
78
+ createTime?: string | undefined;
79
+ createUserId?: string | undefined;
80
+ createUserName?: string | undefined;
81
+ description?: string | undefined;
82
+ designerJson?: string | undefined;
83
+ id?: string | undefined;
84
+ key?: string | undefined;
85
+ lockUserId?: string | undefined;
86
+ lockUserName?: string | undefined;
87
+ modifyTime?: string | undefined;
88
+ modifyUserId?: string | undefined;
89
+ modifyUserName?: string | undefined;
90
+ name?: string | undefined;
91
+ newLogId?: string | undefined;
92
+ runtimeJson?: string | undefined;
93
+ categoryId?: string | undefined;
94
+ version?: string | undefined;
95
+ default?: boolean | undefined;
96
+ modelKey?: string | undefined;
97
+ _designerJson?: string | undefined;
98
+ detailDesignerJson?: string | undefined;
99
+ txnPageMode?: "create" | "detail" | undefined;
100
+ baseId?: string | undefined;
101
+ } | PageInfo>;
102
+ export declare const defaultPageJson: {
103
+ id: string;
104
+ keepAlive: boolean;
105
+ pageEvents: {};
106
+ pageVars: never[];
107
+ widgets: never[];
108
+ js: string;
109
+ css: string;
110
+ modals: never[];
111
+ globalEvents: {};
112
+ permissions: {};
113
+ plugins: never[];
114
+ style: {};
115
+ pageConfig: {
116
+ title: string;
117
+ i18n: {};
118
+ hasFooter: undefined;
119
+ };
120
+ pageLayoutMode: pageLayoutModeEnum;
121
+ };
16
122
  /** 设计页面JSON */
17
123
  export declare const pageJson: {
18
124
  id: string;
@@ -22,11 +22,9 @@ import { getWidgetInfo } from "@gct-paas/schema";
22
22
  var widgetInfo = computed(() => {
23
23
  return getWidgetInfo(platform.value);
24
24
  });
25
- /**
26
- * 当前平台的插件注册实例
27
- */
28
- /** 设计页面JSON */
29
- var pageJson = reactive({
25
+ /** 当前设计页面基础信息 */
26
+ var pageInfo = ref({});
27
+ var defaultPageJson = {
30
28
  id: "",
31
29
  keepAlive: false,
32
30
  pageEvents: {},
@@ -45,7 +43,9 @@ var pageJson = reactive({
45
43
  hasFooter: void 0
46
44
  },
47
45
  pageLayoutMode: pageLayoutModeEnum.SHOW_ALL_DATA
48
- });
46
+ };
47
+ /** 设计页面JSON */
48
+ var pageJson = reactive(cloneDeep(defaultPageJson));
49
49
  /** 页面数据快照,用于脏检查对比 */
50
50
  var pageJsonSnapshot = ref("");
51
51
  /** 界面数据是否修改过,通过对比快照和当前数据判断 */
@@ -100,4 +100,4 @@ function transformPageJson(json, isClone = false) {
100
100
  return _json;
101
101
  }
102
102
  //#endregion
103
- export { isModified, loading, methodMap, modalDesignId, modalDesignState, modalInfo, noMore, pageDesignHistoryList, pageJson, pageJsonSnapshot, pageNo, pluginConfigs, regRoot, subTableModalId, subTableModalState, transformPageJson, wfNodesModalId, wfNodesModalState, widgetInfo, workflowModalId, workflowModalState };
103
+ export { defaultPageJson, isModified, loading, methodMap, modalDesignId, modalDesignState, modalInfo, noMore, pageDesignHistoryList, pageInfo, pageJson, pageJsonSnapshot, pageNo, pluginConfigs, regRoot, subTableModalId, subTableModalState, transformPageJson, wfNodesModalId, wfNodesModalState, widgetInfo, workflowModalId, workflowModalState };
@@ -1,6 +1,6 @@
1
1
  import { PageJson, RuntimePageJson } from '@gct-paas/schema';
2
2
  export declare function useDesignSave(): {
3
- save: (flag?: boolean, showSuccess?: boolean) => Promise<boolean>;
3
+ save: (flag?: boolean, showSuccess?: boolean, isTxn?: boolean) => Promise<boolean>;
4
4
  validateWidgets: (widgets: IData[], parents?: IData[]) => boolean;
5
5
  savePageJsonSnapshot: (json?: PageJson) => void;
6
6
  };
@@ -9,4 +9,4 @@ export declare function useDesignSave(): {
9
9
  *
10
10
  * @returns {Promise<RuntimePageJson>} 运行时页面JSON
11
11
  */
12
- export declare function buildRuntimeJson(): Promise<RuntimePageJson>;
12
+ export declare function buildRuntimeJson(source?: PageJson): Promise<RuntimePageJson>;
@@ -1,10 +1,10 @@
1
1
  import { platform } from "../../../utils/design-view/index.mjs";
2
2
  import { buildRunJs } from "../../../utils/transform-js/transform-js.mjs";
3
3
  import "../../../utils/index.mjs";
4
- import { noMore, pageDesignHistoryList, pageJson, pageJsonSnapshot, pageNo, regRoot, transformPageJson, widgetInfo } from "../design-state.mjs";
4
+ import { defaultPageJson, noMore, pageDesignHistoryList, pageInfo, pageJson, pageJsonSnapshot, pageNo, regRoot, transformPageJson, widgetInfo } from "../design-state.mjs";
5
5
  import { useUserOccupy } from "../../../components/user-occupy/useUserOccupy.mjs";
6
6
  import "../../../components/index.mjs";
7
- import { isArray, isEmpty, isNil } from "lodash-es";
7
+ import { cloneDeep, isArray, isEmpty, isNil } from "lodash-es";
8
8
  import { Platform, SearchComponents, TreeHelper, t } from "@gct-paas/core";
9
9
  import { message } from "ant-design-vue";
10
10
  //#region src/hooks/design-view/designer/useDesignSave.ts
@@ -14,6 +14,30 @@ import { message } from "ant-design-vue";
14
14
  * 管理设计器页面数据的保存、预处理和校验逻辑,
15
15
  * 包括组件必填校验、数值范围校验、运行时 JSON 构建等。
16
16
  */
17
+ function deepFindPlugins(widgets) {
18
+ const items = [];
19
+ widgets.forEach((widget) => {
20
+ if (widget._plugin) items.push({
21
+ key: widget._plugin.key,
22
+ version: widget._plugin.version,
23
+ url: widget._plugin.url
24
+ });
25
+ if (widget.children && widget.children.length > 0) items.push(...deepFindPlugins(widget.children));
26
+ });
27
+ return items;
28
+ }
29
+ function getDefaultTxnDetailPageJson() {
30
+ return {
31
+ newDesigner: true,
32
+ style: {
33
+ paddingAll: "",
34
+ paddingTop: "",
35
+ paddingRight: "16",
36
+ paddingBottom: "16",
37
+ paddingLeft: "16"
38
+ }
39
+ };
40
+ }
17
41
  function useDesignSave() {
18
42
  const { cancelOccupy } = useUserOccupy();
19
43
  /**
@@ -90,13 +114,66 @@ function useDesignSave() {
90
114
  return true;
91
115
  }
92
116
  /**
117
+ * 保存前预处理并校验单个 pageJson
118
+ */
119
+ function preparePageJsonForSave(json) {
120
+ const _pageJson = transformPageJson(json, true);
121
+ if (validateWidgets(_pageJson.widgets) === false) return false;
122
+ if (_pageJson.widgets.some((n) => n.type === "data-list")) _pageJson.widgets.forEach((item) => {
123
+ if (item.type === "data-list" && !item.props.showFieldExp) item.props.showFieldExpVal = "";
124
+ });
125
+ if (validateWidgets(_pageJson.modals) === false) return false;
126
+ if (_pageJson.modals.length) _pageJson.modals.forEach((item) => {
127
+ if (!item.props.hasFooter) item.children = item.children.filter((n) => {
128
+ return n?.type !== "bottom-button-container";
129
+ });
130
+ if (item.props.hasFooter && item.children.some((n) => n?.type === "modalFooter")) item.children = item.children.filter((n) => {
131
+ return n?.type !== "modalFooter";
132
+ });
133
+ });
134
+ _pageJson.plugins = collectPlugins(_pageJson);
135
+ return _pageJson;
136
+ }
137
+ function collectPlugins(_pageJson) {
138
+ const plugins = [];
139
+ plugins.push(...deepFindPlugins(_pageJson.widgets));
140
+ if (_pageJson.modals) _pageJson.modals.forEach((modal) => {
141
+ if (modal.children) modal.children.forEach((item) => {
142
+ plugins.push(...deepFindPlugins(item.children));
143
+ });
144
+ });
145
+ return plugins;
146
+ }
147
+ /**
148
+ * 根据 txnPageMode 解析创建页 / 详情页两份 pageJson
149
+ */
150
+ function resolveTxnPageJsonPair() {
151
+ if (pageInfo.value.txnPageMode === "create") return {
152
+ createPageJson: pageJson,
153
+ detailPageJson: pageInfo.value.detailDesignerJson ? JSON.parse(pageInfo.value.detailDesignerJson) : getDefaultTxnDetailPageJson()
154
+ };
155
+ return {
156
+ createPageJson: pageInfo.value._designerJson ? JSON.parse(pageInfo.value._designerJson) : cloneDeep(defaultPageJson),
157
+ detailPageJson: pageJson
158
+ };
159
+ }
160
+ async function preparePagePayload(json) {
161
+ const prepared = preparePageJsonForSave(json);
162
+ if (!prepared) return false;
163
+ return {
164
+ designerJson: prepared,
165
+ runtimeJson: await buildRuntimeJson(prepared)
166
+ };
167
+ }
168
+ /**
93
169
  * 保存完成解除占用
94
170
  *
95
171
  * @param {boolean} flag 是否为保存操作(true为保存,false为恢复)
96
172
  * @param {boolean} showSuccess 是否显示成功提示
97
173
  * @returns {Promise<boolean>} 是否保存成功
98
174
  */
99
- async function save(flag = true, showSuccess = true) {
175
+ async function save(flag = true, showSuccess = true, isTxn = false) {
176
+ if (isTxn) return saveTxn(flag, showSuccess);
100
177
  const pageId = _gct.store.context.pid;
101
178
  const _pageJson = transformPageJson(pageJson);
102
179
  if (validateWidgets(_pageJson.widgets) === false) return false;
@@ -161,6 +238,42 @@ function useDesignSave() {
161
238
  pageNo.value = 1;
162
239
  return true;
163
240
  }
241
+ /**
242
+ * 保存完成解除占用
243
+ *
244
+ * @param {boolean} flag 是否为保存操作(true为保存,false为恢复)
245
+ * @param {boolean} showSuccess 是否显示成功提示
246
+ * @returns {Promise<boolean>} 是否保存成功
247
+ */
248
+ async function saveTxn(flag = true, showSuccess = true) {
249
+ const pageId = _gct.store.context.pid;
250
+ const { createPageJson, detailPageJson } = resolveTxnPageJsonPair();
251
+ const createPayload = await preparePagePayload(createPageJson);
252
+ if (!createPayload) return false;
253
+ const detailPayload = await preparePagePayload(detailPageJson);
254
+ if (!detailPayload) return false;
255
+ const { designerJson: _designerJson, runtimeJson } = createPayload;
256
+ const { designerJson: _detailDesignerJson, runtimeJson: detailRuntimeJson } = detailPayload;
257
+ pageInfo.value._designerJson = JSON.stringify(_designerJson);
258
+ pageInfo.value.detailDesignerJson = JSON.stringify(_detailDesignerJson);
259
+ await _api.apaas.transaction.putUpdateVersionByIdId({ id: pageId }, {
260
+ designerJson: JSON.stringify(_designerJson),
261
+ runtimeJson: JSON.stringify(runtimeJson),
262
+ detailDesignerJson: JSON.stringify(_detailDesignerJson),
263
+ detailRuntimeJson: JSON.stringify(detailRuntimeJson),
264
+ modelKey: pageInfo.value.modelKey,
265
+ name: pageInfo.value.name,
266
+ version: pageInfo.value.version,
267
+ default: pageInfo.value.default,
268
+ key: pageInfo.value.key
269
+ });
270
+ savePageJsonSnapshot(pageInfo.value.txnPageMode === "create" ? _designerJson : _detailDesignerJson);
271
+ if (showSuccess) _gct.message.success(flag ? "sys.saveSuccess" : "sys.recoverSuccess");
272
+ cancelOccupy();
273
+ noMore.value = false;
274
+ pageNo.value = 1;
275
+ return true;
276
+ }
164
277
  return {
165
278
  save,
166
279
  validateWidgets,
@@ -172,13 +285,11 @@ function useDesignSave() {
172
285
  *
173
286
  * @returns {Promise<RuntimePageJson>} 运行时页面JSON
174
287
  */
175
- async function buildRuntimeJson() {
288
+ async function buildRuntimeJson(source = pageJson) {
176
289
  try {
177
- const runtimeWidgets = TreeHelper.traverseAndBuildTree(JSON.parse(JSON.stringify(pageJson.widgets)), (node) => findWidgetCallback(node));
178
- /**经过babel转换过的所有函数集合包含未export ES5字符串
179
- 来源于页面JS和逻辑编排*/
180
- const funcStr = await buildRunJs(pageJson.js);
181
- const modals = pageJson.modals.map(async (modal) => {
290
+ const runtimeWidgets = TreeHelper.traverseAndBuildTree(JSON.parse(JSON.stringify(source.widgets)), (node) => findWidgetCallback(node));
291
+ const funcStr = await buildRunJs(source.js);
292
+ const modals = source.modals.map(async (modal) => {
182
293
  const modalFuncStr = await buildRunJs(modal.js);
183
294
  const runtimeWidgets = TreeHelper.traverseAndBuildTree(JSON.parse(JSON.stringify(modal.children)), (node) => findWidgetCallback(node, modal));
184
295
  return {
@@ -197,16 +308,16 @@ async function buildRuntimeJson() {
197
308
  widgets: runtimeWidgets,
198
309
  runJs: funcStr,
199
310
  modals: await Promise.all(modals),
200
- css: pageJson.css,
201
- keepAlive: pageJson.keepAlive,
202
- globalEvents: pageJson.globalEvents,
203
- pageEvents: pageJson.pageEvents,
204
- permissions: pageJson.permissions,
205
- pageStyle: pageJson.style,
206
- pageConfig: pageJson.pageConfig,
207
- pageVars: pageJson.pageVars,
208
- plugins: pageJson.plugins,
209
- pageLayoutMode: pageJson.pageLayoutMode
311
+ css: source.css,
312
+ keepAlive: source.keepAlive,
313
+ globalEvents: source.globalEvents,
314
+ pageEvents: source.pageEvents,
315
+ permissions: source.permissions,
316
+ pageStyle: source.style,
317
+ pageConfig: source.pageConfig,
318
+ pageVars: source.pageVars,
319
+ plugins: source.plugins,
320
+ pageLayoutMode: source.pageLayoutMode
210
321
  };
211
322
  } catch (error) {
212
323
  message.warn(t("sys.pageDesigner.codeError"));
@@ -392,7 +392,7 @@ export declare function useToolkit(): {
392
392
  }[];
393
393
  }[]>;
394
394
  initToolkitWidgets: () => void;
395
- changeToolkitWidgets: ({ data, modalState }: IObject) => void;
395
+ changeToolkitWidgets: ({ data, modalState, isTxn }: IObject) => void;
396
396
  fixedToolkit: () => void;
397
397
  setFieldToolkit: ({ modelKey, formId, childParentModelKey, }: {
398
398
  modelKey: string;
@@ -15,6 +15,102 @@ var toolkitPinned = ref(false);
15
15
  var instance = class ComponentUtils {
16
16
  static SubTableGroup = "SubTableGroup";
17
17
  static CardListGroup = "CardListGroup";
18
+ static TxnPageGroup = "TxnPageGroup";
19
+ /** 按分组上下文存储分类组件映射,仅保留现有两套逻辑 */
20
+ static _categoryCompsMap = {
21
+ default: {
22
+ [CategoryTypeEnum.FORM]: [
23
+ FormComponents.GenRadio,
24
+ FormComponents.GenCheckbox,
25
+ FormComponents.GenSwitch,
26
+ FormComponents.Text,
27
+ FormComponents.GenImage,
28
+ FormComponents.Form
29
+ ],
30
+ [CategoryTypeEnum.LAYOUT]: [
31
+ FormComponents.Collapse,
32
+ FormComponents.SpaceOccupation,
33
+ FormComponents.Divider,
34
+ FormComponents.ButtonContainer,
35
+ FormComponents.LayoutContainer,
36
+ FormComponents.Grid,
37
+ FormComponents.LeftRightColumns,
38
+ FormComponents.Tabs
39
+ ],
40
+ [CategoryTypeEnum.ADVANCED]: [
41
+ FormComponents.Search,
42
+ FormComponents.QuickSearch,
43
+ FormComponents.SelectSearch,
44
+ FormComponents.TableSelect,
45
+ FormComponents.Iframe,
46
+ FormComponents.CustomCode
47
+ ],
48
+ [CategoryTypeEnum.PROCESS]: [
49
+ FormComponents.FormProcess,
50
+ FormComponents.ProcessButton,
51
+ FormComponents.ButtonProcessContainer,
52
+ FormComponents.ApprovalHistory,
53
+ FormComponents.FlowDiagram
54
+ ],
55
+ [CategoryTypeEnum.BUTTON]: [
56
+ FormComponents.CustomButton,
57
+ FormComponents.SubmitButton,
58
+ FormComponents.RefreshButton,
59
+ FormComponents.ResetButton,
60
+ FormComponents.LabelPrintButton
61
+ ],
62
+ [CategoryTypeEnum.DATA]: [
63
+ FormComponents.CardList,
64
+ FormComponents.DataTable,
65
+ FormComponents.DataVTable,
66
+ FormComponents.TreeTable,
67
+ FormComponents.RefDataTable,
68
+ FormComponents.Descriptions
69
+ ]
70
+ },
71
+ SubTableGroup: {
72
+ [CategoryTypeEnum.FORM]: [
73
+ FormComponents.GenRadio,
74
+ FormComponents.GenCheckbox,
75
+ FormComponents.GenSwitch,
76
+ FormComponents.Text,
77
+ FormComponents.GenImage
78
+ ],
79
+ [CategoryTypeEnum.LAYOUT]: [
80
+ FormComponents.Collapse,
81
+ FormComponents.SpaceOccupation,
82
+ FormComponents.Divider,
83
+ FormComponents.LayoutContainer,
84
+ FormComponents.Grid,
85
+ FormComponents.LeftRightColumns,
86
+ FormComponents.Tabs
87
+ ],
88
+ [CategoryTypeEnum.ADVANCED]: [FormComponents.Iframe, FormComponents.CustomCode],
89
+ [CategoryTypeEnum.PROCESS]: [],
90
+ [CategoryTypeEnum.BUTTON]: [],
91
+ [CategoryTypeEnum.DATA]: []
92
+ },
93
+ TxnPageGroup: {
94
+ [CategoryTypeEnum.FORM]: [
95
+ FormComponents.GenRadio,
96
+ FormComponents.GenCheckbox,
97
+ FormComponents.GenSwitch,
98
+ FormComponents.Text,
99
+ FormComponents.GenImage,
100
+ FormComponents.Form
101
+ ],
102
+ [CategoryTypeEnum.LAYOUT]: [
103
+ FormComponents.Collapse,
104
+ FormComponents.SpaceOccupation,
105
+ FormComponents.Divider,
106
+ FormComponents.LayoutContainer,
107
+ FormComponents.Grid,
108
+ FormComponents.LeftRightColumns,
109
+ FormComponents.Tabs
110
+ ],
111
+ [CategoryTypeEnum.DATA]: [FormComponents.DataTable, FormComponents.Descriptions]
112
+ }
113
+ };
18
114
  static _instance;
19
115
  /** 当前所处的组件分组上下文 */
20
116
  groupType = "";
@@ -30,6 +126,11 @@ var instance = class ComponentUtils {
30
126
  CategoryTypeEnum.LAYOUT,
31
127
  CategoryTypeEnum.ADVANCED
32
128
  ];
129
+ if (this.groupType === ComponentUtils.TxnPageGroup) return [
130
+ CategoryTypeEnum.FORM,
131
+ CategoryTypeEnum.LAYOUT,
132
+ CategoryTypeEnum.DATA
133
+ ];
33
134
  return [
34
135
  CategoryTypeEnum.FORM,
35
136
  CategoryTypeEnum.LAYOUT,
@@ -47,92 +148,17 @@ var instance = class ComponentUtils {
47
148
  * @returns 当前上下文下允许使用的组件枚举值列表
48
149
  */
49
150
  _getCompsForCategory(categoryType) {
50
- const isSubTable = this.groupType === ComponentUtils.SubTableGroup;
51
- switch (categoryType) {
52
- case CategoryTypeEnum.FORM:
53
- if (isSubTable) return [
54
- FormComponents.GenRadio,
55
- FormComponents.GenCheckbox,
56
- FormComponents.GenSwitch,
57
- FormComponents.Text,
58
- FormComponents.GenImage
59
- ];
60
- return [
61
- FormComponents.GenRadio,
62
- FormComponents.GenCheckbox,
63
- FormComponents.GenSwitch,
64
- FormComponents.Text,
65
- FormComponents.GenImage,
66
- FormComponents.Form
67
- ];
68
- case CategoryTypeEnum.LAYOUT:
69
- if (isSubTable) return [
70
- FormComponents.Collapse,
71
- FormComponents.SpaceOccupation,
72
- FormComponents.Divider,
73
- FormComponents.LayoutContainer,
74
- FormComponents.Grid,
75
- FormComponents.LeftRightColumns,
76
- FormComponents.Tabs
77
- ];
78
- return [
79
- FormComponents.Collapse,
80
- FormComponents.SpaceOccupation,
81
- FormComponents.Divider,
82
- FormComponents.ButtonContainer,
83
- FormComponents.LayoutContainer,
84
- FormComponents.Grid,
85
- FormComponents.LeftRightColumns,
86
- FormComponents.Tabs
87
- ];
88
- case CategoryTypeEnum.ADVANCED:
89
- if (isSubTable) return [FormComponents.Iframe, FormComponents.CustomCode];
90
- return [
91
- FormComponents.Search,
92
- FormComponents.QuickSearch,
93
- FormComponents.SelectSearch,
94
- FormComponents.TableSelect,
95
- FormComponents.Iframe,
96
- FormComponents.CustomCode
97
- ];
98
- case CategoryTypeEnum.PROCESS:
99
- if (isSubTable) return [];
100
- return [
101
- FormComponents.FormProcess,
102
- FormComponents.ProcessButton,
103
- FormComponents.ButtonProcessContainer,
104
- FormComponents.ApprovalHistory,
105
- FormComponents.FlowDiagram
106
- ];
107
- case CategoryTypeEnum.BUTTON:
108
- if (isSubTable) return [];
109
- return [
110
- FormComponents.CustomButton,
111
- FormComponents.SubmitButton,
112
- FormComponents.RefreshButton,
113
- FormComponents.ResetButton,
114
- FormComponents.LabelPrintButton
115
- ];
116
- case CategoryTypeEnum.DATA:
117
- if (isSubTable) return [];
118
- return [
119
- FormComponents.CardList,
120
- FormComponents.DataTable,
121
- FormComponents.DataVTable,
122
- FormComponents.TreeTable,
123
- FormComponents.RefDataTable,
124
- FormComponents.Descriptions
125
- ];
126
- default: return [];
127
- }
151
+ const groupKey = this.groupType === ComponentUtils.SubTableGroup ? "SubTableGroup" : this.groupType === ComponentUtils.TxnPageGroup ? "TxnPageGroup" : "default";
152
+ return ComponentUtils._categoryCompsMap[groupKey][categoryType] ?? [];
128
153
  }
129
154
  /**
130
155
  * 根据所处分组上下文更新 groupType
131
156
  *
132
157
  * @param data - 当前选中组件数据
133
158
  * @param modalState - 是否处于子表单(弹框)状态
159
+ * @param isTxn - 是否处于事务页面状态
134
160
  */
135
- changeGroupType({ data, modalState }) {
161
+ changeGroupType({ data, modalState, isTxn }) {
136
162
  if (data.type === FormComponents.CardList) {
137
163
  this._setGroupType(ComponentUtils.CardListGroup);
138
164
  return;
@@ -141,6 +167,10 @@ var instance = class ComponentUtils {
141
167
  this._setGroupType(ComponentUtils.SubTableGroup);
142
168
  return;
143
169
  }
170
+ if (isTxn) {
171
+ this._setGroupType(ComponentUtils.TxnPageGroup);
172
+ return;
173
+ }
144
174
  this._setGroupType("");
145
175
  }
146
176
  /** 更新组件分组上下文 */
@@ -260,11 +290,12 @@ function useToolkit() {
260
290
  });
261
291
  }
262
292
  /** 根据当前选中组件的上下文刷新组件列表 */
263
- function changeToolkitWidgets({ data, modalState }) {
293
+ function changeToolkitWidgets({ data, modalState, isTxn }) {
264
294
  const oldGroupType = instance.groupType;
265
295
  instance.changeGroupType({
266
296
  data,
267
- modalState
297
+ modalState,
298
+ isTxn
268
299
  });
269
300
  if (oldGroupType !== instance.groupType) toolkitWidgets.value = instance.getWidgetsToolkit({
270
301
  platform: _gct.store.context.platform,
@@ -1,11 +1,9 @@
1
1
  import { Ref, App } from 'vue';
2
2
  import { PanelEnum } from '@gct-paas/core';
3
- import { PermissionResponse, WebpageResponse } from '@gct-paas/api/apaas';
3
+ import { PermissionResponse } from '@gct-paas/api/apaas';
4
4
  export declare const newKeyTag = "___new___";
5
- export type PageInfo = WebpageResponse & {
6
- categoryId?: string;
7
- };
8
- export declare const pageInfo: Ref<PageInfo>;
5
+ export type { PageInfo } from '../design-state';
6
+ export { pageInfo } from '../design-state';
9
7
  export declare const pagePermissions: Ref<{
10
8
  createTime?: string | undefined;
11
9
  createUserId?: string | undefined;
@@ -40,6 +38,15 @@ export declare const currentPanel: Ref<PanelEnum>;
40
38
  * @returns
41
39
  */
42
40
  export declare function loadPageInfo(app: App): Promise<void>;
41
+ /**
42
+ * 加载页面信息
43
+ * @returns
44
+ */
45
+ export declare function loadTxnPageInfo(app: App): Promise<void>;
46
+ /**
47
+ * @param mode 切换模式
48
+ */
49
+ export declare function toggleTxnPageInfo(mode: 'create' | 'detail'): Promise<void>;
43
50
  /**
44
51
  * 初始化界面占用信息
45
52
  */
@@ -54,4 +61,3 @@ export declare function usePage(): {
54
61
  togglePanel: typeof togglePanel;
55
62
  initLockState: typeof initLockState;
56
63
  };
57
- export {};