@longhongguo/form-create-ant-design-vue 3.2.90 → 3.2.92
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longhongguo/form-create-ant-design-vue",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.92",
|
|
4
4
|
"description": "AntDesignVue版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。",
|
|
5
5
|
"main": "./dist/form-create.min.js",
|
|
6
6
|
"module": "./dist/form-create.esm.js",
|
package/src/parsers/accTable.js
CHANGED
|
@@ -133,22 +133,32 @@ export default {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
// 无论 props.pagination 是否已存在,只要满足条件就添加/检查 beforeFetch 钩子
|
|
136
|
+
// 使用标记防止重复初始化,避免重复请求
|
|
137
|
+
const paginationInitialized = rule._accTablePaginationInitialized === true
|
|
138
|
+
|
|
136
139
|
console.log('[accTable] 检查分页钩子添加条件:', {
|
|
137
140
|
hasFetch: !!rule.effect?.fetch,
|
|
138
141
|
hasPaginationConfig: !!paginationConfig,
|
|
139
142
|
paginationConfigType: typeof paginationConfig,
|
|
140
143
|
paginationConfigValue: paginationConfig,
|
|
141
144
|
paginationCurrent: paginationConfig?.current,
|
|
142
|
-
paginationCurrentDefined: paginationConfig?.current !== undefined
|
|
145
|
+
paginationCurrentDefined: paginationConfig?.current !== undefined,
|
|
146
|
+
paginationInitialized
|
|
143
147
|
})
|
|
144
148
|
|
|
145
149
|
if (
|
|
150
|
+
!paginationInitialized && // 只初始化一次
|
|
146
151
|
rule.effect?.fetch &&
|
|
147
152
|
paginationConfig &&
|
|
148
153
|
typeof paginationConfig === 'object' &&
|
|
149
154
|
paginationConfig.current !== undefined
|
|
150
155
|
) {
|
|
151
|
-
console.log(
|
|
156
|
+
console.log(
|
|
157
|
+
'[accTable] ✅ 满足条件,进入分页请求参数处理逻辑(首次初始化)'
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
// 标记已初始化,防止重复执行
|
|
161
|
+
rule._accTablePaginationInitialized = true
|
|
152
162
|
|
|
153
163
|
console.log('[accTable] 进入分页请求参数处理逻辑')
|
|
154
164
|
// 获取分页参数配置
|
|
@@ -188,23 +198,27 @@ export default {
|
|
|
188
198
|
const savedPageParamName = pageParamName
|
|
189
199
|
const savedPageSizeParamName = pageSizeParamName
|
|
190
200
|
const savedOriginalBeforeFetch = originalFetch.beforeFetch
|
|
201
|
+
// 在闭包中保存 rule 的引用,因为 beforeFetch 只接收 (config, {api}) 参数
|
|
202
|
+
const savedRule = rule
|
|
191
203
|
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
) {
|
|
204
|
+
// 检查是否已经添加过我们的 beforeFetch 钩子(通过检查函数是否包含特定标记)
|
|
205
|
+
const isOurBeforeFetch =
|
|
206
|
+
savedOriginalBeforeFetch &&
|
|
207
|
+
savedOriginalBeforeFetch._accTablePaginationHook === true
|
|
208
|
+
|
|
209
|
+
if (!isOurBeforeFetch) {
|
|
198
210
|
// 添加 beforeFetch 钩子来注入分页参数
|
|
199
|
-
|
|
211
|
+
// 注意:form-create 的 beforeFetch 只接收 (config, {api}) 参数,没有 rule
|
|
212
|
+
originalFetch.beforeFetch = (config, { api }) => {
|
|
200
213
|
console.log('[accTable] beforeFetch 被调用:', {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
214
|
+
configAction: config?.action,
|
|
215
|
+
hasApi: !!api,
|
|
216
|
+
ruleProps: savedRule?.props,
|
|
217
|
+
pagination: savedRule?.props?.pagination
|
|
204
218
|
})
|
|
205
219
|
|
|
206
|
-
//
|
|
207
|
-
const currentPagination =
|
|
220
|
+
// 从闭包中获取当前分页配置
|
|
221
|
+
const currentPagination = savedRule?.props?.pagination
|
|
208
222
|
console.log('[accTable] 当前分页配置:', {
|
|
209
223
|
currentPagination,
|
|
210
224
|
isObject: typeof currentPagination === 'object',
|
|
@@ -256,12 +270,13 @@ export default {
|
|
|
256
270
|
}
|
|
257
271
|
|
|
258
272
|
// 调用原始的 beforeFetch 钩子(如果存在)
|
|
273
|
+
// 原始钩子可能也只接收 (config, {api}) 参数
|
|
259
274
|
if (
|
|
260
275
|
savedOriginalBeforeFetch &&
|
|
261
276
|
typeof savedOriginalBeforeFetch === 'function'
|
|
262
277
|
) {
|
|
263
278
|
console.log('[accTable] 调用原始 beforeFetch 钩子')
|
|
264
|
-
return savedOriginalBeforeFetch(config, {
|
|
279
|
+
return savedOriginalBeforeFetch(config, { api })
|
|
265
280
|
}
|
|
266
281
|
|
|
267
282
|
console.log('[accTable] beforeFetch 完成,最终 config:', {
|
|
@@ -270,8 +285,14 @@ export default {
|
|
|
270
285
|
action: config.action
|
|
271
286
|
})
|
|
272
287
|
}
|
|
288
|
+
|
|
289
|
+
// 标记这是我们添加的钩子,避免重复添加
|
|
290
|
+
originalFetch.beforeFetch._accTablePaginationHook = true
|
|
291
|
+
console.log('[accTable] ✅ beforeFetch 钩子已添加并标记')
|
|
292
|
+
} else {
|
|
293
|
+
console.log('[accTable] ⚠️ beforeFetch 钩子已存在,跳过添加')
|
|
273
294
|
}
|
|
274
|
-
console.log('[accTable] beforeFetch
|
|
295
|
+
console.log('[accTable] beforeFetch 钩子处理完成')
|
|
275
296
|
} else {
|
|
276
297
|
console.warn('[accTable] fetch 配置不是对象类型:', {
|
|
277
298
|
type: typeof originalFetch,
|