@jt-home/mfe-components 1.0.0
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/index.cjs +2 -0
- package/dist/index.mjs +3029 -0
- package/dist/style.css +1 -0
- package/dist/types/components/JtButton/index.d.ts +1 -0
- package/dist/types/components/JtButton/index.vue.d.ts +21 -0
- package/dist/types/components/JtPageHeader/index.d.ts +2 -0
- package/dist/types/components/JtPageHeader/index.vue.d.ts +25 -0
- package/dist/types/components/JtPageHeader/types.d.ts +31 -0
- package/dist/types/components/JtPagination/index.d.ts +2 -0
- package/dist/types/components/JtPagination/index.vue.d.ts +22 -0
- package/dist/types/components/JtPagination/types.d.ts +16 -0
- package/dist/types/components/form/JtFormItems.vue.d.ts +16 -0
- package/dist/types/components/form/index.d.ts +4 -0
- package/dist/types/components/form/item/JtCascader/index.d.ts +1 -0
- package/dist/types/components/form/item/JtCascader/index.vue.d.ts +29 -0
- package/dist/types/components/form/item/JtDatePicker/index.d.ts +1 -0
- package/dist/types/components/form/item/JtDatePicker/index.vue.d.ts +9 -0
- package/dist/types/components/form/item/JtInput/index.d.ts +1 -0
- package/dist/types/components/form/item/JtInput/index.vue.d.ts +35 -0
- package/dist/types/components/form/item/JtSelect/index.d.ts +2 -0
- package/dist/types/components/form/item/JtSelect/index.vue.d.ts +34 -0
- package/dist/types/components/form/item/JtSelect/types.d.ts +6 -0
- package/dist/types/components/form/item/index.d.ts +5 -0
- package/dist/types/components/form/types.d.ts +71 -0
- package/dist/types/components/globalInfo/components/GlobalInfoGroup.vue.d.ts +105 -0
- package/dist/types/components/globalInfo/components/GlobalInfoProvider.vue.d.ts +22 -0
- package/dist/types/components/globalInfo/components/GlobalInfoSectionBlock.vue.d.ts +165 -0
- package/dist/types/components/globalInfo/components/GlobalInfoSectionOutlet.vue.d.ts +31 -0
- package/dist/types/components/globalInfo/components/GlobalInfoSections.vue.d.ts +59 -0
- package/dist/types/components/globalInfo/components/GlobalInfoSlotErrorBoundary.vue.d.ts +36 -0
- package/dist/types/components/globalInfo/controller/useGlobalInfoController.d.ts +19 -0
- package/dist/types/components/globalInfo/index.d.ts +14 -0
- package/dist/types/components/globalInfo/model/adapter.d.ts +9 -0
- package/dist/types/components/globalInfo/model/fieldUtils.d.ts +11 -0
- package/dist/types/components/globalInfo/model/types.d.ts +558 -0
- package/dist/types/components/globalInfo/renderers/GlobalInfoAutoRenderer.vue.d.ts +11 -0
- package/dist/types/components/globalInfo/renderers/GlobalInfoDeleteConfirm.vue.d.ts +28 -0
- package/dist/types/components/globalInfo/renderers/GlobalInfoFieldControl.vue.d.ts +19 -0
- package/dist/types/components/globalInfo/renderers/GlobalInfoFieldValue.vue.d.ts +11 -0
- package/dist/types/components/globalInfo/renderers/GlobalInfoFormRenderer.vue.d.ts +34 -0
- package/dist/types/components/globalInfo/renderers/GlobalInfoTableRenderer.vue.d.ts +39 -0
- package/dist/types/components/index.d.ts +11 -0
- package/dist/types/components/table/JtCrudTable.vue.d.ts +288 -0
- package/dist/types/components/table/JtFilterBar.vue.d.ts +65 -0
- package/dist/types/components/table/JtPagination.vue.d.ts +22 -0
- package/dist/types/components/table/JtTable.vue.d.ts +27 -0
- package/dist/types/components/table/index.d.ts +5 -0
- package/dist/types/components/table/types.d.ts +134 -0
- package/dist/types/components/table/useSearchDisabled.d.ts +12 -0
- package/dist/types/main.d.ts +3 -0
- package/dist/types/utils/componentAttrs.d.ts +14 -0
- package/package.json +77 -0
- package/readme.md +671 -0
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
/** 后端原始对象的统一容器,适合透传未知字段。 */
|
|
2
|
+
export type GlobalInfoRawRecord = Record<string, unknown>;
|
|
3
|
+
/** 组件内部允许直接展示或保存的基础值类型。 */
|
|
4
|
+
export type GlobalInfoPrimitive = string | number | boolean | null;
|
|
5
|
+
/** 字段值保持开放,文件、日期对象、自定义插槽值都可以透传。 */
|
|
6
|
+
export type GlobalInfoFieldValue = unknown;
|
|
7
|
+
/** 信息集最终渲染类型:表单、表格、文本、HTML、代码、多行、空态或文件。 */
|
|
8
|
+
export type GlobalInfoRenderType = 'form' | 'table' | 'text' | 'html' | 'code' | 'multi-row' | 'empty' | 'file';
|
|
9
|
+
/** 后端 operationInfo 里的接口描述,页面不用解析,交给 service.requestOperation 执行。 */
|
|
10
|
+
export interface GlobalInfoApiOperation {
|
|
11
|
+
/** 请求方法,例如 post/get。 */
|
|
12
|
+
method?: string;
|
|
13
|
+
/** 请求地址,通常来自后端 operationInfo。 */
|
|
14
|
+
url?: string;
|
|
15
|
+
/** 请求参数模板,controller 会在部分场景补齐当前字段数据。 */
|
|
16
|
+
params?: GlobalInfoRawRecord;
|
|
17
|
+
/** 保留后端扩展字段,例如 javaApi、headers 等。 */
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
/** 顶部模板树接口入参。 */
|
|
21
|
+
export interface GlobalInfoTemplateTreeParams {
|
|
22
|
+
/** 场景编码,由页面传入,用于获取对应模板。 */
|
|
23
|
+
adaptScene?: string;
|
|
24
|
+
/** 信息方案 id。 */
|
|
25
|
+
infSchmId?: string | number;
|
|
26
|
+
/** 员工 id。 */
|
|
27
|
+
emplid?: string | number;
|
|
28
|
+
/** 当前树节点 id。 */
|
|
29
|
+
tagId?: string | number;
|
|
30
|
+
/** 当前树节点层级。 */
|
|
31
|
+
tagLevel?: string | number | null;
|
|
32
|
+
/** 父级树节点 id。 */
|
|
33
|
+
parentTagId?: string | number | null;
|
|
34
|
+
/** 允许页面或业务 service 追加额外参数。 */
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
/** 展开某个树节点时的入参,必须带当前 tagId。 */
|
|
38
|
+
export interface GlobalInfoOpenTreeParams extends GlobalInfoTemplateTreeParams {
|
|
39
|
+
tagId: string | number;
|
|
40
|
+
}
|
|
41
|
+
/** 查询某个信息集详情时的入参。 */
|
|
42
|
+
export interface GlobalInfoDetailParams extends GlobalInfoTemplateTreeParams {
|
|
43
|
+
/** 信息集 id,新接口主要依赖这个字段。 */
|
|
44
|
+
infSetId?: string | number;
|
|
45
|
+
/** 信息集内部 id,和 infSetId 一起用于 section 缓存与保存。 */
|
|
46
|
+
setId?: string | number;
|
|
47
|
+
}
|
|
48
|
+
/** 保存信息集时的入参,包含待提交数据和当前渲染上下文。 */
|
|
49
|
+
export interface GlobalInfoUpdateParams extends GlobalInfoDetailParams {
|
|
50
|
+
/** 后端保存接口约定的行数据字段,表单也会整理成一行。 */
|
|
51
|
+
infSetFields?: Record<string, unknown>[];
|
|
52
|
+
/** 当前表单模型。 */
|
|
53
|
+
values?: Record<string, unknown>;
|
|
54
|
+
/** 当前字段定义快照。 */
|
|
55
|
+
fields?: GlobalInfoField[];
|
|
56
|
+
/** 多信息集保存时的 section 快照。 */
|
|
57
|
+
sections?: GlobalInfoSection[];
|
|
58
|
+
/** 当前归属树节点。 */
|
|
59
|
+
activeNode?: GlobalInfoNode | null;
|
|
60
|
+
/** 当前信息集。 */
|
|
61
|
+
section?: GlobalInfoSection;
|
|
62
|
+
/** 当前整体视图模型。 */
|
|
63
|
+
viewModel?: GlobalInfoViewModel;
|
|
64
|
+
}
|
|
65
|
+
/** requestOperation 执行时的上下文,service 可据此判断正在请求哪类接口。 */
|
|
66
|
+
export interface GlobalInfoOperationContext {
|
|
67
|
+
/** 操作类型:展开树、查详情、保存、加载字段选项。 */
|
|
68
|
+
type: 'openTag' | 'queryInfoSet' | 'editInfoSet' | 'fieldOptions';
|
|
69
|
+
/** 当前树节点。 */
|
|
70
|
+
node?: GlobalInfoNode | null;
|
|
71
|
+
/** 当前信息集。 */
|
|
72
|
+
section?: GlobalInfoSection | null;
|
|
73
|
+
/** 当前字段,主要用于动态下拉。 */
|
|
74
|
+
field?: GlobalInfoField | null;
|
|
75
|
+
/** controller 已整理过的本次请求参数。 */
|
|
76
|
+
params?: GlobalInfoRawRecord;
|
|
77
|
+
}
|
|
78
|
+
/** 页面注入的数据服务。新功能只保留顶部树入口和 operationInfo 统一执行入口。 */
|
|
79
|
+
export interface GlobalInfoService {
|
|
80
|
+
/** 加载顶部模板树,返回一级菜单和每个一级菜单的 operationInfo.openTag。 */
|
|
81
|
+
templateTree?: (params: GlobalInfoTemplateTreeParams) => Promise<unknown>;
|
|
82
|
+
/** operationInfo 统一执行入口,openTag/queryInfoSet/editInfoSet/fieldOptions 都走这里。 */
|
|
83
|
+
requestOperation?: (operation: GlobalInfoApiOperation, context?: GlobalInfoOperationContext) => Promise<unknown>;
|
|
84
|
+
}
|
|
85
|
+
/** 顶部接口返回的方案标识信息。 */
|
|
86
|
+
export interface GlobalInfoScheme {
|
|
87
|
+
/** 信息方案 id。 */
|
|
88
|
+
infSchmId: string;
|
|
89
|
+
/** 员工 id。 */
|
|
90
|
+
emplid: string;
|
|
91
|
+
/** 组件内部统一 id,默认等于 infSchmId。 */
|
|
92
|
+
id: string;
|
|
93
|
+
/** 后端方案标识。 */
|
|
94
|
+
mark: string;
|
|
95
|
+
/** 后端方案配置。 */
|
|
96
|
+
config: string;
|
|
97
|
+
/** 原始后端数据,便于业务排查或自定义适配。 */
|
|
98
|
+
raw: GlobalInfoRawRecord;
|
|
99
|
+
}
|
|
100
|
+
/** 模板树节点:一级菜单、二级菜单都会归一成这个结构。 */
|
|
101
|
+
export interface GlobalInfoNode {
|
|
102
|
+
/** 组件内部稳定 key,列表渲染和缓存都会使用。 */
|
|
103
|
+
key: string;
|
|
104
|
+
/** 节点 id,通常等于 tagId。 */
|
|
105
|
+
id: string;
|
|
106
|
+
/** 后端树节点 id。 */
|
|
107
|
+
tagId: string;
|
|
108
|
+
/** 后端树节点名称。 */
|
|
109
|
+
tagName: string;
|
|
110
|
+
/** 展示名称,默认等于 tagName。 */
|
|
111
|
+
label: string;
|
|
112
|
+
/** 原始层级。 */
|
|
113
|
+
tagLevel: string | number | null;
|
|
114
|
+
/** 数字化层级,无法转换时为 null。 */
|
|
115
|
+
level: number | null;
|
|
116
|
+
/** 父级 tagId。 */
|
|
117
|
+
parentTagId?: string | number | null;
|
|
118
|
+
/** 组件内部父级 id。 */
|
|
119
|
+
parentId: string | null;
|
|
120
|
+
/** 当前节点所属方案 id。 */
|
|
121
|
+
infSchmId?: string;
|
|
122
|
+
/** 组件内部方案 id。 */
|
|
123
|
+
schemeId: string;
|
|
124
|
+
/** 节点默认信息集 id;多信息集时取 infSetList 第一项。 */
|
|
125
|
+
infSetId?: string;
|
|
126
|
+
/** 信息集内部 id。 */
|
|
127
|
+
setId?: string;
|
|
128
|
+
/** 业务编码,存在时可作为插槽身份补充。 */
|
|
129
|
+
code?: string;
|
|
130
|
+
/** 子节点;顶部接口只返回一级菜单时,controller 会通过 openTag 补齐。 */
|
|
131
|
+
children: GlobalInfoNode[];
|
|
132
|
+
/** 当前节点挂载的信息集列表,一个二级节点可以包含多个信息集。 */
|
|
133
|
+
infSetList: GlobalInfoInfoSet[];
|
|
134
|
+
/** 节点级操作描述,例如 operationInfo.openTag。 */
|
|
135
|
+
operationInfo?: GlobalInfoRawRecord;
|
|
136
|
+
/** 子树是否已加载,避免重复展开。 */
|
|
137
|
+
loaded: boolean;
|
|
138
|
+
/** 原始后端节点。 */
|
|
139
|
+
raw: GlobalInfoRawRecord;
|
|
140
|
+
}
|
|
141
|
+
/** 树节点下挂载的信息集描述,负责告诉 controller 如何查详情、如何保存。 */
|
|
142
|
+
export interface GlobalInfoInfoSet {
|
|
143
|
+
/** 信息集 id。 */
|
|
144
|
+
infSetId: string;
|
|
145
|
+
/** 信息集内部 id。 */
|
|
146
|
+
setId?: string;
|
|
147
|
+
/** 信息集级操作描述,queryInfoSet 查详情,editInfoSet 保存。 */
|
|
148
|
+
operationInfo?: GlobalInfoRawRecord & {
|
|
149
|
+
queryInfoSet?: GlobalInfoApiOperation;
|
|
150
|
+
editInfoSet?: GlobalInfoApiOperation;
|
|
151
|
+
};
|
|
152
|
+
/** 原始后端信息集描述。 */
|
|
153
|
+
raw: GlobalInfoRawRecord;
|
|
154
|
+
}
|
|
155
|
+
/** 字段下拉选项。 */
|
|
156
|
+
export interface GlobalInfoFieldOption {
|
|
157
|
+
/** 选项 id。 */
|
|
158
|
+
id?: string | number;
|
|
159
|
+
/** 选项编码。 */
|
|
160
|
+
code?: string | number;
|
|
161
|
+
/** 展示文案。 */
|
|
162
|
+
label: string;
|
|
163
|
+
/** 后端 name 字段。 */
|
|
164
|
+
name?: string;
|
|
165
|
+
/** 实际提交值。 */
|
|
166
|
+
value: unknown;
|
|
167
|
+
/** 原始选项数据。 */
|
|
168
|
+
raw?: unknown;
|
|
169
|
+
/** 保留扩展字段。 */
|
|
170
|
+
[key: string]: unknown;
|
|
171
|
+
}
|
|
172
|
+
/** 字段定义,表单项和表格列都使用同一套结构。 */
|
|
173
|
+
export interface GlobalInfoField {
|
|
174
|
+
/** 组件内部稳定 key。 */
|
|
175
|
+
key: string;
|
|
176
|
+
/** 字段 id。 */
|
|
177
|
+
id: string;
|
|
178
|
+
/** 表单 prop,未传时通常等于 code。 */
|
|
179
|
+
prop?: string;
|
|
180
|
+
/** 后端字段编码,保存和 model 同步主要使用它。 */
|
|
181
|
+
code: string;
|
|
182
|
+
/** 后端字段名称。 */
|
|
183
|
+
name?: string;
|
|
184
|
+
/** 展示标题。 */
|
|
185
|
+
label: string;
|
|
186
|
+
/** 当前字段值。 */
|
|
187
|
+
value: unknown;
|
|
188
|
+
/** 归一后的控件类型,例如 text/select/date/file。 */
|
|
189
|
+
type: string;
|
|
190
|
+
/** 后端原始字段类型。 */
|
|
191
|
+
fieldType?: string;
|
|
192
|
+
/** 只读展示类型。 */
|
|
193
|
+
renderType: GlobalInfoRenderType;
|
|
194
|
+
/** 是否必填,归一后的字段。 */
|
|
195
|
+
required: boolean;
|
|
196
|
+
/** 是否只读。 */
|
|
197
|
+
readonly: boolean;
|
|
198
|
+
/** 是否可见。 */
|
|
199
|
+
visible: boolean;
|
|
200
|
+
/** 是否 HTML 展示。 */
|
|
201
|
+
htmlDisplay: boolean;
|
|
202
|
+
/** 是否多行展示。 */
|
|
203
|
+
multRow: boolean;
|
|
204
|
+
/** 后端原始必填标记。 */
|
|
205
|
+
isRequired: boolean;
|
|
206
|
+
/** 是否禁用编辑控件。 */
|
|
207
|
+
disabled?: boolean;
|
|
208
|
+
/** 表单栅格跨度。 */
|
|
209
|
+
span?: number;
|
|
210
|
+
/** 表格或表单列跨度。 */
|
|
211
|
+
colSpan?: number;
|
|
212
|
+
/** 表格列宽。 */
|
|
213
|
+
width?: string | number;
|
|
214
|
+
/** 表格列最小宽度。 */
|
|
215
|
+
minWidth?: string | number;
|
|
216
|
+
/** 编辑态占位文案。 */
|
|
217
|
+
placeholder?: string;
|
|
218
|
+
/** 静态或动态加载后的选项。 */
|
|
219
|
+
options?: GlobalInfoFieldOption[];
|
|
220
|
+
/** 字段动态接口描述,常用于级联下拉。 */
|
|
221
|
+
interface?: GlobalInfoApiOperation;
|
|
222
|
+
/** 当前字段变更后需要清空的字段 code 列表。 */
|
|
223
|
+
cascadeClearFields?: string[];
|
|
224
|
+
/** 当前字段加载或选择前依赖的字段 code 列表。 */
|
|
225
|
+
cascadeDependFields?: string[];
|
|
226
|
+
/** 传给具体控件的额外 props。 */
|
|
227
|
+
props?: GlobalInfoRawRecord;
|
|
228
|
+
/** 传给表单项容器的额外 props。 */
|
|
229
|
+
formItemProps?: GlobalInfoRawRecord;
|
|
230
|
+
/** 原始后端字段。 */
|
|
231
|
+
raw: GlobalInfoRawRecord;
|
|
232
|
+
}
|
|
233
|
+
/** 信息集标识区,来自详情接口里的 infSetMark。 */
|
|
234
|
+
export interface GlobalInfoSetMark {
|
|
235
|
+
/** 信息集名称。 */
|
|
236
|
+
name: string;
|
|
237
|
+
/** 父级名称,后端有返回时保留。 */
|
|
238
|
+
parentName?: string;
|
|
239
|
+
/** 后端扩展值字段。 */
|
|
240
|
+
value?: string;
|
|
241
|
+
/** 后端扩展类型字段。 */
|
|
242
|
+
type?: string;
|
|
243
|
+
/** 信息集编码。 */
|
|
244
|
+
code: string;
|
|
245
|
+
/** 信息集 id。 */
|
|
246
|
+
setId: string;
|
|
247
|
+
/** 后端 HTML 展示标记。 */
|
|
248
|
+
htmlDisplay: string;
|
|
249
|
+
/** 是否多行数据,通常决定渲染表格。 */
|
|
250
|
+
multRow: boolean;
|
|
251
|
+
/** 信息集是否必填。 */
|
|
252
|
+
isRequired: boolean;
|
|
253
|
+
/** 原始后端标识。 */
|
|
254
|
+
raw: GlobalInfoRawRecord;
|
|
255
|
+
}
|
|
256
|
+
/** 表格行结构,保留行级字段快照。 */
|
|
257
|
+
export interface GlobalInfoSectionRow extends GlobalInfoRawRecord {
|
|
258
|
+
/** 行 key。 */
|
|
259
|
+
key: string;
|
|
260
|
+
/** 行对应的字段定义。 */
|
|
261
|
+
fields: GlobalInfoField[];
|
|
262
|
+
}
|
|
263
|
+
/** 归一后的信息集快照,是表单、表格和插槽渲染的核心数据。 */
|
|
264
|
+
export interface GlobalInfoSection {
|
|
265
|
+
/** 组件内部稳定 key。 */
|
|
266
|
+
key: string;
|
|
267
|
+
/** 信息集 id。 */
|
|
268
|
+
id: string;
|
|
269
|
+
/** 信息集内部 id。 */
|
|
270
|
+
setId: string;
|
|
271
|
+
/** 信息集编码。 */
|
|
272
|
+
code: string;
|
|
273
|
+
/** section 自己的 tag 身份,不能用请求节点 tagId 硬塞,避免串数据。 */
|
|
274
|
+
tagId: string;
|
|
275
|
+
/** 本次请求用的 tagId,只做归属记录,和 section.tagId 分开。 */
|
|
276
|
+
requestTagId?: string;
|
|
277
|
+
/** 请求或拥有这个 section 的树节点 key。 */
|
|
278
|
+
ownerNodeKey?: string;
|
|
279
|
+
/** 信息集 id,新接口主要使用。 */
|
|
280
|
+
infSetId: string;
|
|
281
|
+
/** 信息集标题。 */
|
|
282
|
+
title: string;
|
|
283
|
+
/** 渲染类型,form/table 等。 */
|
|
284
|
+
renderType: GlobalInfoRenderType;
|
|
285
|
+
/** 信息集标识原始归一结构。 */
|
|
286
|
+
mark: GlobalInfoSetMark;
|
|
287
|
+
/** 字段定义。 */
|
|
288
|
+
fields: GlobalInfoField[];
|
|
289
|
+
/** 表格列定义,通常和 fields 相同。 */
|
|
290
|
+
columns?: GlobalInfoField[];
|
|
291
|
+
/** 表单模型;表格场景下可用于字段级接口依赖。 */
|
|
292
|
+
model: GlobalInfoRawRecord;
|
|
293
|
+
/** 原始数据,可能是对象或数组。 */
|
|
294
|
+
data?: GlobalInfoRawRecord | GlobalInfoRawRecord[];
|
|
295
|
+
/** 行数据,表单也会整理成一行,方便统一保存。 */
|
|
296
|
+
rows: GlobalInfoRawRecord[];
|
|
297
|
+
/** 信息集级操作描述,例如 queryInfoSet/editInfoSet。 */
|
|
298
|
+
operationInfo?: GlobalInfoRawRecord;
|
|
299
|
+
/** 原始后端详情。 */
|
|
300
|
+
raw: GlobalInfoRawRecord;
|
|
301
|
+
}
|
|
302
|
+
/** 整个 globalInfo 的视图模型,页面和 Provider 插槽会消费这个结构。 */
|
|
303
|
+
export interface GlobalInfoViewModel {
|
|
304
|
+
/** 方案标识。 */
|
|
305
|
+
scheme: GlobalInfoScheme | null;
|
|
306
|
+
/** 当前节点。 */
|
|
307
|
+
node: GlobalInfoNode | null;
|
|
308
|
+
/** 顶部节点。 */
|
|
309
|
+
topNodes: GlobalInfoNode[];
|
|
310
|
+
/** 完整树节点。 */
|
|
311
|
+
treeNodes: GlobalInfoNode[];
|
|
312
|
+
/** 当前激活节点。 */
|
|
313
|
+
activeNode: GlobalInfoNode | null;
|
|
314
|
+
/** 当前激活信息集。 */
|
|
315
|
+
activeSection: GlobalInfoSection | null;
|
|
316
|
+
/** 已加载的信息集列表。 */
|
|
317
|
+
sections: GlobalInfoSection[];
|
|
318
|
+
/** 已加载信息集缓存,key 为 section key / infSetId 等身份。 */
|
|
319
|
+
sectionMap: Record<string, GlobalInfoSection>;
|
|
320
|
+
/** 原始后端响应。 */
|
|
321
|
+
raw: unknown;
|
|
322
|
+
}
|
|
323
|
+
/** 单个信息集的局部状态。 */
|
|
324
|
+
export interface GlobalInfoSectionStatus {
|
|
325
|
+
/** 是否正在加载。 */
|
|
326
|
+
loading: boolean;
|
|
327
|
+
/** 是否正在保存。 */
|
|
328
|
+
saving: boolean;
|
|
329
|
+
/** 错误对象,只给控制台或自定义错误槽使用,默认不直接渲染到页面。 */
|
|
330
|
+
error: unknown;
|
|
331
|
+
/** 是否已加载过。 */
|
|
332
|
+
loaded: boolean;
|
|
333
|
+
/** 是否处于编辑态。 */
|
|
334
|
+
editing: boolean;
|
|
335
|
+
}
|
|
336
|
+
/** 模板树适配后的返回结构。 */
|
|
337
|
+
export interface GlobalInfoTemplateResponse {
|
|
338
|
+
/** 方案标识。 */
|
|
339
|
+
scheme?: GlobalInfoScheme;
|
|
340
|
+
/** 树节点。 */
|
|
341
|
+
tree: GlobalInfoNode[];
|
|
342
|
+
/** 原始响应。 */
|
|
343
|
+
raw: unknown;
|
|
344
|
+
}
|
|
345
|
+
/** 详情适配后的返回结构。 */
|
|
346
|
+
export interface GlobalInfoDetailResponse {
|
|
347
|
+
/** 归一后的视图模型。 */
|
|
348
|
+
viewModel: GlobalInfoViewModel;
|
|
349
|
+
/** 原始响应。 */
|
|
350
|
+
raw: unknown;
|
|
351
|
+
}
|
|
352
|
+
/** 保存时提交给后端的标准 payload。 */
|
|
353
|
+
export interface GlobalInfoUpdatePayload {
|
|
354
|
+
/** 表单模型值。 */
|
|
355
|
+
values: Record<string, unknown>;
|
|
356
|
+
/** 一个或多个信息集提交内容。 */
|
|
357
|
+
sections: Array<{
|
|
358
|
+
/** 信息集编码。 */
|
|
359
|
+
infSetMark: string;
|
|
360
|
+
/** 信息集 id。 */
|
|
361
|
+
setId: string;
|
|
362
|
+
/** 单行字段值。 */
|
|
363
|
+
fields: Record<string, unknown>;
|
|
364
|
+
/** 多行表格值。 */
|
|
365
|
+
rows?: Record<string, unknown>[];
|
|
366
|
+
}>;
|
|
367
|
+
}
|
|
368
|
+
/** controller 暴露给页面的全局状态。 */
|
|
369
|
+
export interface GlobalInfoState {
|
|
370
|
+
/** 顶部树加载中。 */
|
|
371
|
+
loading: boolean;
|
|
372
|
+
/** 详情加载中。 */
|
|
373
|
+
detailLoading: boolean;
|
|
374
|
+
/** 保存中。 */
|
|
375
|
+
saving: boolean;
|
|
376
|
+
/** 当前处于编辑态的 section key 列表。 */
|
|
377
|
+
editingSectionKeys: string[];
|
|
378
|
+
/** 已加载 section 缓存。 */
|
|
379
|
+
sectionMap: Record<string, GlobalInfoSection>;
|
|
380
|
+
/** 每个 section 的加载、保存、错误、编辑状态。 */
|
|
381
|
+
sectionStatusMap: Record<string, GlobalInfoSectionStatus>;
|
|
382
|
+
/** 全局错误对象。 */
|
|
383
|
+
error: unknown;
|
|
384
|
+
}
|
|
385
|
+
/** 可以定位一个 section 的目标:section 对象、树节点、key 字符串或空值。 */
|
|
386
|
+
export type GlobalInfoSectionTarget = GlobalInfoSection | GlobalInfoNode | string | null | undefined;
|
|
387
|
+
/** loadSection 使用的目标类型,语义上和 section target 一致。 */
|
|
388
|
+
export type GlobalInfoSectionLoadTarget = GlobalInfoSectionTarget;
|
|
389
|
+
/** controller 提供给页面和插槽的动作集合。 */
|
|
390
|
+
export interface GlobalInfoActions {
|
|
391
|
+
/** 加载顶部树,并按 openTag 补齐一级节点 children。 */
|
|
392
|
+
loadTree: () => Promise<GlobalInfoNode[]>;
|
|
393
|
+
/** 选中树节点;只负责节点状态和展开,不强行渲染具体内容。 */
|
|
394
|
+
selectNode: (nodeOrKey: GlobalInfoNode | string) => Promise<GlobalInfoNode | null>;
|
|
395
|
+
/** 加载当前节点详情并更新 activeSection。 */
|
|
396
|
+
loadDetail: (node?: GlobalInfoNode | null) => Promise<GlobalInfoViewModel | null>;
|
|
397
|
+
/** 重新加载当前激活 section。 */
|
|
398
|
+
reloadActiveSection: () => Promise<GlobalInfoViewModel | null>;
|
|
399
|
+
/** 按节点或 section 独立加载详情,适合整页分块渲染。 */
|
|
400
|
+
loadSection: (nodeOrKey?: GlobalInfoSectionLoadTarget) => Promise<GlobalInfoSection | null>;
|
|
401
|
+
/** 重新加载指定节点或 section。 */
|
|
402
|
+
reloadSection: (nodeOrKey?: GlobalInfoSectionLoadTarget) => Promise<GlobalInfoSection | null>;
|
|
403
|
+
/** 从缓存读取指定节点或 section 对应的数据,只返回精确命中的 section。 */
|
|
404
|
+
getSection: (nodeOrKey?: GlobalInfoSectionTarget) => GlobalInfoSection | null;
|
|
405
|
+
/** 读取指定节点或 section 的局部状态。 */
|
|
406
|
+
getSectionStatus: (nodeOrKey?: GlobalInfoSectionTarget) => GlobalInfoSectionStatus;
|
|
407
|
+
/** 进入编辑态。 */
|
|
408
|
+
startEdit: (section?: GlobalInfoSectionTarget) => void;
|
|
409
|
+
/** 取消编辑态并还原本地状态。 */
|
|
410
|
+
cancelEdit: (section?: GlobalInfoSectionTarget) => void;
|
|
411
|
+
/** 更新单个字段,并处理 cascadeClearFields。 */
|
|
412
|
+
updateField: (section: GlobalInfoSection | string, field: GlobalInfoField | string, value: unknown) => void;
|
|
413
|
+
/** 加载字段动态选项,并按当前表单 model 或表格 row 补齐接口参数。 */
|
|
414
|
+
loadFieldOptions: (section: GlobalInfoSection | string, field: GlobalInfoField | string, model?: GlobalInfoRawRecord) => Promise<GlobalInfoFieldOption[]>;
|
|
415
|
+
/** 批量更新表单 model 或表格 rows。 */
|
|
416
|
+
updateModel: (section: GlobalInfoSection | string, model: GlobalInfoRawRecord | GlobalInfoRawRecord[]) => void;
|
|
417
|
+
/** 更新表格行数据。 */
|
|
418
|
+
updateTableRows: (section: GlobalInfoSection | string, rows: GlobalInfoRawRecord[]) => void;
|
|
419
|
+
/** 保存单行,当前默认汇总到 saveSection。 */
|
|
420
|
+
saveRow: (section: GlobalInfoSection | string, row?: GlobalInfoRawRecord, index?: number) => Promise<unknown> | void;
|
|
421
|
+
/** 删除指定表格行。 */
|
|
422
|
+
deleteRow: (section: GlobalInfoSection | string, index: number | string) => void;
|
|
423
|
+
/** 保存指定 section,会优先走 editInfoSet operation。 */
|
|
424
|
+
saveSection: (section?: GlobalInfoSection | string | null) => Promise<unknown>;
|
|
425
|
+
/** 判断指定 section 是否处于编辑态。 */
|
|
426
|
+
isEditing: (section?: GlobalInfoSectionTarget) => boolean;
|
|
427
|
+
}
|
|
428
|
+
/** section 内容插槽的上下文,页面通过它接管表单、表格或某个信息集内容。 */
|
|
429
|
+
export interface GlobalInfoSectionSlotScope {
|
|
430
|
+
/** 当前信息集,未加载或加载失败时为 null。 */
|
|
431
|
+
section: GlobalInfoSection | null;
|
|
432
|
+
/** section 视图数据,等同于 section。 */
|
|
433
|
+
sectionView?: GlobalInfoSection | null;
|
|
434
|
+
/** 当前归属树节点。 */
|
|
435
|
+
node?: GlobalInfoNode | null;
|
|
436
|
+
/** 当前字段列表。 */
|
|
437
|
+
fields?: GlobalInfoField[];
|
|
438
|
+
/** 当前整体视图模型。 */
|
|
439
|
+
viewModel?: GlobalInfoViewModel;
|
|
440
|
+
/** 当前标题。 */
|
|
441
|
+
title?: string;
|
|
442
|
+
/** 当前是否编辑态。 */
|
|
443
|
+
editing: boolean;
|
|
444
|
+
/** 是否空态。 */
|
|
445
|
+
isEmpty?: boolean;
|
|
446
|
+
/** 空态标识,等同于 isEmpty。 */
|
|
447
|
+
empty?: boolean;
|
|
448
|
+
/** 当前节点是否就是一级块自身。 */
|
|
449
|
+
isSelfSection?: boolean;
|
|
450
|
+
/** 是否加载中。 */
|
|
451
|
+
loading?: boolean;
|
|
452
|
+
/** 错误对象。 */
|
|
453
|
+
error?: unknown;
|
|
454
|
+
/** 错误文案,只供自定义错误槽使用。 */
|
|
455
|
+
errorMessage?: string;
|
|
456
|
+
/** 当前 section 局部状态。 */
|
|
457
|
+
sectionStatus?: GlobalInfoSectionStatus;
|
|
458
|
+
/** 全局状态。 */
|
|
459
|
+
state?: GlobalInfoState;
|
|
460
|
+
/** controller 动作集合。 */
|
|
461
|
+
actions?: GlobalInfoActions;
|
|
462
|
+
/** 重新加载当前块。 */
|
|
463
|
+
reload?: () => Promise<void>;
|
|
464
|
+
/** 进入编辑态。 */
|
|
465
|
+
handleEdit?: () => Promise<void>;
|
|
466
|
+
/** 取消编辑态。 */
|
|
467
|
+
handleCancel?: () => Promise<void>;
|
|
468
|
+
/** 新增表格行。 */
|
|
469
|
+
handleAddTableRow?: () => void;
|
|
470
|
+
/** 保存当前块。 */
|
|
471
|
+
handleSave?: () => Promise<void>;
|
|
472
|
+
}
|
|
473
|
+
/** Provider 默认插槽参数,页面拿到这些即可组合任意布局。 */
|
|
474
|
+
export interface GlobalInfoProviderSlotProps {
|
|
475
|
+
/** 当前视图模型。 */
|
|
476
|
+
viewModel: GlobalInfoViewModel | null;
|
|
477
|
+
/** 当前树节点。 */
|
|
478
|
+
nodes: GlobalInfoNode[];
|
|
479
|
+
/** 已加载 section 列表。 */
|
|
480
|
+
sections: GlobalInfoSection[];
|
|
481
|
+
/** 当前激活树节点。 */
|
|
482
|
+
activeNode: GlobalInfoNode | null;
|
|
483
|
+
/** 当前激活 section。 */
|
|
484
|
+
activeSection: GlobalInfoSection | null;
|
|
485
|
+
/** 全局状态。 */
|
|
486
|
+
state: GlobalInfoState;
|
|
487
|
+
/** 动作集合。 */
|
|
488
|
+
actions: GlobalInfoActions;
|
|
489
|
+
}
|
|
490
|
+
/** 外部自管渲染状态的扩展结构,保留给自定义页面使用。 */
|
|
491
|
+
export interface GlobalInfoRenderState {
|
|
492
|
+
/** 按 section key 存储的表单模型。 */
|
|
493
|
+
models?: Record<string, GlobalInfoRawRecord>;
|
|
494
|
+
/** 按 section key 存储的表格行。 */
|
|
495
|
+
tables?: Record<string, GlobalInfoRawRecord[]>;
|
|
496
|
+
/** 允许业务扩展额外状态。 */
|
|
497
|
+
[key: string]: unknown;
|
|
498
|
+
}
|
|
499
|
+
/** adapter 适配时的上下文。 */
|
|
500
|
+
export interface GlobalInfoAdapterContext extends GlobalInfoRawRecord {
|
|
501
|
+
/** 当前激活节点,详情适配时用于记录 ownerNodeKey。 */
|
|
502
|
+
activeNode?: GlobalInfoNode | null;
|
|
503
|
+
}
|
|
504
|
+
/** 数据适配器接口,外部可替换后端数据归一逻辑。 */
|
|
505
|
+
export interface GlobalInfoAdapter {
|
|
506
|
+
/** 把后端树响应转成 GlobalInfoNode[]。 */
|
|
507
|
+
adaptGlobalInfoTree: (input: unknown, context?: GlobalInfoAdapterContext) => GlobalInfoNode[];
|
|
508
|
+
/** 把后端详情响应转成 GlobalInfoViewModel。 */
|
|
509
|
+
adaptGlobalInfoDetail: (input: unknown, context?: GlobalInfoAdapterContext) => GlobalInfoViewModel;
|
|
510
|
+
/** 把当前 section/model 转成保存 payload。 */
|
|
511
|
+
buildGlobalInfoUpdatePayload: (params: GlobalInfoUpdateParams) => GlobalInfoUpdatePayload;
|
|
512
|
+
}
|
|
513
|
+
/** controller 初始化选项。 */
|
|
514
|
+
export interface GlobalInfoControllerOptions<TService extends GlobalInfoService = GlobalInfoService> {
|
|
515
|
+
/** 页面注入的数据服务。 */
|
|
516
|
+
service?: TService;
|
|
517
|
+
/** 可选自定义适配器。 */
|
|
518
|
+
adapter?: GlobalInfoAdapter;
|
|
519
|
+
}
|
|
520
|
+
/** controller 返回值的基础结构,组合式 API 内部使用。 */
|
|
521
|
+
export interface GlobalInfoControllerReturn {
|
|
522
|
+
/** 当前视图模型。 */
|
|
523
|
+
viewModel: GlobalInfoViewModel | null;
|
|
524
|
+
/** 树节点。 */
|
|
525
|
+
nodes: GlobalInfoNode[];
|
|
526
|
+
/** 已加载 section。 */
|
|
527
|
+
sections: GlobalInfoSection[];
|
|
528
|
+
/** section 缓存。 */
|
|
529
|
+
sectionMap: Record<string, GlobalInfoSection>;
|
|
530
|
+
/** section 状态缓存。 */
|
|
531
|
+
sectionStatusMap: Record<string, GlobalInfoSectionStatus>;
|
|
532
|
+
/** 当前节点。 */
|
|
533
|
+
activeNode: GlobalInfoNode | null;
|
|
534
|
+
/** 当前 section。 */
|
|
535
|
+
activeSection: GlobalInfoSection | null;
|
|
536
|
+
}
|
|
537
|
+
/** GlobalInfoProvider props。 */
|
|
538
|
+
export interface GlobalInfoProps<TService extends GlobalInfoService = GlobalInfoService> {
|
|
539
|
+
/** 数据服务,必传。 */
|
|
540
|
+
service: TService;
|
|
541
|
+
/** 业务场景编码。 */
|
|
542
|
+
adaptScene?: string;
|
|
543
|
+
/** 员工 id。 */
|
|
544
|
+
emplid?: string | number;
|
|
545
|
+
/** 是否挂载后自动加载模板树。 */
|
|
546
|
+
autoLoad?: boolean;
|
|
547
|
+
/** 初始激活节点 key。 */
|
|
548
|
+
initialActiveNodeKey?: string;
|
|
549
|
+
}
|
|
550
|
+
/** 字段级插槽上下文。 */
|
|
551
|
+
export interface GlobalInfoItemSlotProps {
|
|
552
|
+
/** 当前字段。 */
|
|
553
|
+
field: GlobalInfoField;
|
|
554
|
+
/** 当前 section。 */
|
|
555
|
+
section: GlobalInfoSection;
|
|
556
|
+
/** 当前字段值。 */
|
|
557
|
+
value: unknown;
|
|
558
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GlobalInfoActions, GlobalInfoNode, GlobalInfoSection, GlobalInfoState } from '../model/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
section: GlobalInfoSection;
|
|
4
|
+
node?: GlobalInfoNode | null;
|
|
5
|
+
editing: boolean;
|
|
6
|
+
state: GlobalInfoState;
|
|
7
|
+
actions: GlobalInfoActions;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
title?: string;
|
|
3
|
+
confirmText?: string;
|
|
4
|
+
cancelText?: string;
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_12: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_12) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
confirm: () => any;
|
|
12
|
+
cancel: () => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
onConfirm?: (() => any) | undefined;
|
|
15
|
+
onCancel?: (() => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
title: string;
|
|
18
|
+
confirmText: string;
|
|
19
|
+
cancelText: string;
|
|
20
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GlobalInfoField, GlobalInfoFieldValue } from '../model/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
field: GlobalInfoField;
|
|
4
|
+
modelValue?: GlobalInfoFieldValue;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: unknown) => any;
|
|
9
|
+
change: (value: unknown) => any;
|
|
10
|
+
loadOptions: () => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
13
|
+
onChange?: ((value: unknown) => any) | undefined;
|
|
14
|
+
onLoadOptions?: (() => any) | undefined;
|
|
15
|
+
}>, {
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GlobalInfoField, GlobalInfoFieldValue } from '../model/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
field: GlobalInfoField;
|
|
4
|
+
value?: GlobalInfoFieldValue;
|
|
5
|
+
emptyText?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
8
|
+
emptyText: string;
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GlobalInfoActions, GlobalInfoField, GlobalInfoNode, GlobalInfoRawRecord, GlobalInfoSection, GlobalInfoState } from '../model/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
section: GlobalInfoSection;
|
|
4
|
+
node?: GlobalInfoNode | null;
|
|
5
|
+
editing: boolean;
|
|
6
|
+
state: GlobalInfoState;
|
|
7
|
+
actions: GlobalInfoActions;
|
|
8
|
+
model?: GlobalInfoRawRecord;
|
|
9
|
+
onUpdateModel?: (model: GlobalInfoRawRecord) => void;
|
|
10
|
+
};
|
|
11
|
+
declare var __VLS_28: string, __VLS_29: {
|
|
12
|
+
field: GlobalInfoField;
|
|
13
|
+
section: GlobalInfoSection;
|
|
14
|
+
sectionView: GlobalInfoSection;
|
|
15
|
+
node: GlobalInfoNode | null | undefined;
|
|
16
|
+
editing: boolean;
|
|
17
|
+
modelValue: unknown;
|
|
18
|
+
value: unknown;
|
|
19
|
+
state: GlobalInfoState;
|
|
20
|
+
actions: GlobalInfoActions;
|
|
21
|
+
updateModelValue: (value: unknown) => void;
|
|
22
|
+
};
|
|
23
|
+
type __VLS_Slots = {} & {
|
|
24
|
+
[K in NonNullable<typeof __VLS_28>]?: (props: typeof __VLS_29) => any;
|
|
25
|
+
};
|
|
26
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
31
|
+
new (): {
|
|
32
|
+
$slots: S;
|
|
33
|
+
};
|
|
34
|
+
};
|