@longhongguo/form-create-ant-design-vue 3.2.91 → 3.2.93
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.93",
|
|
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
|
@@ -149,8 +149,6 @@ export default {
|
|
|
149
149
|
paginationConfig.current !== undefined
|
|
150
150
|
) {
|
|
151
151
|
console.log('[accTable] ✅ 满足条件,进入分页请求参数处理逻辑')
|
|
152
|
-
|
|
153
|
-
console.log('[accTable] 进入分页请求参数处理逻辑')
|
|
154
152
|
// 获取分页参数配置
|
|
155
153
|
const pageParamName = rule.props?.paginationPageParam || 'page'
|
|
156
154
|
const pageSizeParamName =
|
|
@@ -261,12 +259,30 @@ export default {
|
|
|
261
259
|
|
|
262
260
|
// 调用原始的 beforeFetch 钩子(如果存在)
|
|
263
261
|
// 原始钩子可能也只接收 (config, {api}) 参数
|
|
262
|
+
// 使用 try-catch 包装,避免原始钩子中的错误影响我们的逻辑
|
|
264
263
|
if (
|
|
265
264
|
savedOriginalBeforeFetch &&
|
|
266
265
|
typeof savedOriginalBeforeFetch === 'function'
|
|
267
266
|
) {
|
|
268
267
|
console.log('[accTable] 调用原始 beforeFetch 钩子')
|
|
269
|
-
|
|
268
|
+
try {
|
|
269
|
+
const result = savedOriginalBeforeFetch(config, { api })
|
|
270
|
+
// 如果原始钩子返回了 Promise,处理它
|
|
271
|
+
if (result && typeof result.then === 'function') {
|
|
272
|
+
return result.catch((err) => {
|
|
273
|
+
console.error(
|
|
274
|
+
'[accTable] 原始 beforeFetch 钩子执行出错:',
|
|
275
|
+
err
|
|
276
|
+
)
|
|
277
|
+
// 即使原始钩子出错,也继续执行
|
|
278
|
+
return Promise.resolve()
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
return result
|
|
282
|
+
} catch (err) {
|
|
283
|
+
console.error('[accTable] 原始 beforeFetch 钩子执行出错:', err)
|
|
284
|
+
// 即使原始钩子出错,也继续执行,不影响分页参数的添加
|
|
285
|
+
}
|
|
270
286
|
}
|
|
271
287
|
|
|
272
288
|
console.log('[accTable] beforeFetch 完成,最终 config:', {
|
|
@@ -290,49 +306,52 @@ export default {
|
|
|
290
306
|
})
|
|
291
307
|
}
|
|
292
308
|
|
|
293
|
-
//
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
rule.props
|
|
309
|
+
// 只在首次初始化时添加分页事件处理函数,避免重复设置
|
|
310
|
+
if (!paginationInitialized) {
|
|
311
|
+
// 添加分页 onChange 和 onShowSizeChange 事件处理(确保事件处理函数存在)
|
|
312
|
+
const paginationObj = props.pagination || paginationConfig
|
|
313
|
+
if (paginationObj && typeof paginationObj === 'object') {
|
|
314
|
+
if (!paginationObj.onChange) {
|
|
315
|
+
paginationObj.onChange = (page, size) => {
|
|
316
|
+
console.log('[accTable] pagination onChange 被调用:', {
|
|
317
|
+
page,
|
|
318
|
+
size
|
|
319
|
+
})
|
|
320
|
+
// 更新分页配置
|
|
321
|
+
if (rule.props?.pagination) {
|
|
322
|
+
rule.props.pagination.current = page
|
|
323
|
+
rule.props.pagination.pageSize = size
|
|
324
|
+
}
|
|
325
|
+
// 分页参数已经通过 beforeFetch 钩子自动添加,只需要触发重新加载
|
|
326
|
+
ctx.api.sync(rule)
|
|
327
|
+
setTimeout(() => {
|
|
328
|
+
ctx.api.refresh()
|
|
329
|
+
}, 0)
|
|
306
330
|
}
|
|
307
|
-
// 分页参数已经通过 beforeFetch 钩子自动添加,只需要触发重新加载
|
|
308
|
-
ctx.api.sync(rule)
|
|
309
|
-
setTimeout(() => {
|
|
310
|
-
ctx.api.refresh()
|
|
311
|
-
}, 0)
|
|
312
331
|
}
|
|
313
|
-
}
|
|
314
332
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
333
|
+
if (!paginationObj.onShowSizeChange) {
|
|
334
|
+
paginationObj.onShowSizeChange = (current, size) => {
|
|
335
|
+
console.log('[accTable] pagination onShowSizeChange 被调用:', {
|
|
336
|
+
current,
|
|
337
|
+
size
|
|
338
|
+
})
|
|
339
|
+
if (rule.props?.pagination) {
|
|
340
|
+
rule.props.pagination.current = 1 // 改变每页条数时重置到第一页
|
|
341
|
+
rule.props.pagination.pageSize = size
|
|
342
|
+
}
|
|
343
|
+
// 分页参数已经通过 beforeFetch 钩子自动添加,只需要触发重新加载
|
|
344
|
+
ctx.api.sync(rule)
|
|
345
|
+
setTimeout(() => {
|
|
346
|
+
ctx.api.refresh()
|
|
347
|
+
}, 0)
|
|
324
348
|
}
|
|
325
|
-
// 分页参数已经通过 beforeFetch 钩子自动添加,只需要触发重新加载
|
|
326
|
-
ctx.api.sync(rule)
|
|
327
|
-
setTimeout(() => {
|
|
328
|
-
ctx.api.refresh()
|
|
329
|
-
}, 0)
|
|
330
349
|
}
|
|
331
|
-
}
|
|
332
350
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
351
|
+
// 如果 props.pagination 不存在,将 paginationObj 赋值给 props.pagination
|
|
352
|
+
if (!props.pagination) {
|
|
353
|
+
props.pagination = paginationObj
|
|
354
|
+
}
|
|
336
355
|
}
|
|
337
356
|
}
|
|
338
357
|
}
|