@longhongguo/form-create-ant-design-vue 3.2.86 → 3.2.87
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/form-create.esm.js +2 -2
- package/dist/form-create.esm.js.map +1 -1
- package/dist/form-create.js +2 -2
- package/dist/form-create.js.map +1 -1
- package/package.json +1 -1
- package/src/parsers/accTable.js +115 -21
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.87",
|
|
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
|
@@ -106,53 +106,147 @@ export default {
|
|
|
106
106
|
const responseTotalPath =
|
|
107
107
|
rule.props?.paginationResponseTotalPath || 'total'
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
console.log('[accTable] 分页配置初始化:', {
|
|
110
|
+
hasFetch: !!rule.effect?.fetch,
|
|
111
|
+
paginationConfig,
|
|
112
|
+
pageParamName,
|
|
113
|
+
pageSizeParamName,
|
|
114
|
+
paramType,
|
|
115
|
+
currentPage: pagination.current,
|
|
116
|
+
currentPageSize: pagination.pageSize
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
// 包装 fetch 配置,通过 beforeFetch 钩子动态注入分页参数
|
|
110
120
|
const originalFetch = rule.effect.fetch
|
|
121
|
+
console.log('[accTable] 原始 fetch 配置:', {
|
|
122
|
+
type: typeof originalFetch,
|
|
123
|
+
isObject: typeof originalFetch === 'object',
|
|
124
|
+
originalFetch
|
|
125
|
+
})
|
|
126
|
+
|
|
111
127
|
if (typeof originalFetch === 'object') {
|
|
112
128
|
// 保存原始配置和分页参数配置到闭包中
|
|
113
|
-
const savedOriginalFetch = { ...originalFetch }
|
|
114
129
|
const savedParamType = paramType
|
|
115
130
|
const savedPageParamName = pageParamName
|
|
116
131
|
const savedPageSizeParamName = pageSizeParamName
|
|
132
|
+
const savedOriginalBeforeFetch = originalFetch.beforeFetch
|
|
117
133
|
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
baseOption = { ...savedOriginalFetch, ...actionResult }
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// 使用扩展运算符创建新配置,保留所有原始属性(包括函数)
|
|
130
|
-
const fetchOption = { ...baseOption }
|
|
134
|
+
// 添加 beforeFetch 钩子来注入分页参数
|
|
135
|
+
originalFetch.beforeFetch = (config, { rule: r, api: a }) => {
|
|
136
|
+
console.log('[accTable] beforeFetch 被调用:', {
|
|
137
|
+
configBefore: JSON.parse(JSON.stringify(config)),
|
|
138
|
+
ruleProps: r.props,
|
|
139
|
+
pagination: r.props?.pagination
|
|
140
|
+
})
|
|
131
141
|
|
|
132
142
|
// 获取当前分页配置
|
|
133
143
|
const currentPagination = r.props?.pagination
|
|
144
|
+
console.log('[accTable] 当前分页配置:', {
|
|
145
|
+
currentPagination,
|
|
146
|
+
isObject: typeof currentPagination === 'object',
|
|
147
|
+
currentPage: currentPagination?.current,
|
|
148
|
+
currentPageSize: currentPagination?.pageSize
|
|
149
|
+
})
|
|
150
|
+
|
|
134
151
|
if (currentPagination && typeof currentPagination === 'object') {
|
|
135
152
|
const currentPage = currentPagination.current || 1
|
|
136
153
|
const currentPageSize = currentPagination.pageSize || 10
|
|
137
154
|
|
|
138
|
-
|
|
155
|
+
console.log('[accTable] 准备添加分页参数:', {
|
|
156
|
+
savedParamType,
|
|
157
|
+
savedPageParamName,
|
|
158
|
+
savedPageSizeParamName,
|
|
159
|
+
currentPage,
|
|
160
|
+
currentPageSize,
|
|
161
|
+
existingQuery: config.query,
|
|
162
|
+
existingData: config.data
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
// 添加分页参数(使用闭包中保存的参数名)
|
|
139
166
|
if (savedParamType === 'query') {
|
|
140
|
-
|
|
141
|
-
|
|
167
|
+
// 合并已有的 query 参数,确保不覆盖用户自定义的参数
|
|
168
|
+
config.query = {
|
|
169
|
+
...(config.query || {}),
|
|
142
170
|
[savedPageParamName]: currentPage,
|
|
143
171
|
[savedPageSizeParamName]: currentPageSize
|
|
144
172
|
}
|
|
173
|
+
console.log('[accTable] 添加 query 参数后:', {
|
|
174
|
+
query: config.query
|
|
175
|
+
})
|
|
145
176
|
} else {
|
|
146
|
-
|
|
147
|
-
|
|
177
|
+
// 合并已有的 data 参数,确保不覆盖用户自定义的参数
|
|
178
|
+
config.data = {
|
|
179
|
+
...(config.data || {}),
|
|
148
180
|
[savedPageParamName]: currentPage,
|
|
149
181
|
[savedPageSizeParamName]: currentPageSize
|
|
150
182
|
}
|
|
183
|
+
console.log('[accTable] 添加 data 参数后:', {
|
|
184
|
+
data: config.data
|
|
185
|
+
})
|
|
151
186
|
}
|
|
187
|
+
} else {
|
|
188
|
+
console.warn('[accTable] 分页配置无效,无法添加分页参数:', {
|
|
189
|
+
currentPagination,
|
|
190
|
+
type: typeof currentPagination
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// 调用原始的 beforeFetch 钩子(如果存在)
|
|
195
|
+
if (
|
|
196
|
+
savedOriginalBeforeFetch &&
|
|
197
|
+
typeof savedOriginalBeforeFetch === 'function'
|
|
198
|
+
) {
|
|
199
|
+
console.log('[accTable] 调用原始 beforeFetch 钩子')
|
|
200
|
+
return savedOriginalBeforeFetch(config, { rule: r, api: a })
|
|
152
201
|
}
|
|
153
202
|
|
|
154
|
-
|
|
203
|
+
console.log('[accTable] beforeFetch 完成,最终 config:', {
|
|
204
|
+
query: config.query,
|
|
205
|
+
data: config.data,
|
|
206
|
+
action: config.action
|
|
207
|
+
})
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// 初始化时也添加分页参数到配置中
|
|
211
|
+
const currentPage = pagination.current || 1
|
|
212
|
+
const currentPageSize = pagination.pageSize || 10
|
|
213
|
+
|
|
214
|
+
console.log('[accTable] 初始化分页参数到 fetch 配置:', {
|
|
215
|
+
paramType,
|
|
216
|
+
pageParamName,
|
|
217
|
+
pageSizeParamName,
|
|
218
|
+
currentPage,
|
|
219
|
+
currentPageSize
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
if (paramType === 'query') {
|
|
223
|
+
if (!originalFetch.query) {
|
|
224
|
+
originalFetch.query = {}
|
|
225
|
+
}
|
|
226
|
+
originalFetch.query[pageParamName] = currentPage
|
|
227
|
+
originalFetch.query[pageSizeParamName] = currentPageSize
|
|
228
|
+
console.log('[accTable] 初始化后的 query:', originalFetch.query)
|
|
229
|
+
} else {
|
|
230
|
+
if (!originalFetch.data) {
|
|
231
|
+
originalFetch.data = {}
|
|
232
|
+
}
|
|
233
|
+
originalFetch.data[pageParamName] = currentPage
|
|
234
|
+
originalFetch.data[pageSizeParamName] = currentPageSize
|
|
235
|
+
console.log('[accTable] 初始化后的 data:', originalFetch.data)
|
|
155
236
|
}
|
|
237
|
+
|
|
238
|
+
console.log('[accTable] 最终 fetch 配置:', {
|
|
239
|
+
action: originalFetch.action,
|
|
240
|
+
method: originalFetch.method,
|
|
241
|
+
query: originalFetch.query,
|
|
242
|
+
data: originalFetch.data,
|
|
243
|
+
hasBeforeFetch: typeof originalFetch.beforeFetch === 'function'
|
|
244
|
+
})
|
|
245
|
+
} else {
|
|
246
|
+
console.warn('[accTable] fetch 配置不是对象类型:', {
|
|
247
|
+
type: typeof originalFetch,
|
|
248
|
+
originalFetch
|
|
249
|
+
})
|
|
156
250
|
}
|
|
157
251
|
|
|
158
252
|
// 添加分页 onChange 事件处理
|