vxe-table 4.20.8 → 4.20.10
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/all.esm.js +333 -205
- package/dist/style.css +1 -1
- package/dist/style.min.css +1 -1
- package/es/grid/src/grid.js +252 -161
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/panel.js +3 -3
- package/es/table/module/export/hook.js +56 -36
- package/es/table/render/index.js +12 -2
- package/es/table/src/table.js +8 -1
- package/es/table/style.css +22 -12
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +22 -12
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +321 -204
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +446 -263
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/panel.js +3 -3
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/export/hook.js +70 -43
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/render/index.js +24 -2
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/table.js +4 -4
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +22 -12
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +22 -12
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +243 -153
- package/packages/table/module/custom/panel.ts +3 -3
- package/packages/table/module/export/hook.ts +54 -33
- package/packages/table/render/index.ts +12 -2
- package/packages/table/src/table.ts +8 -1
- package/styles/components/table.scss +24 -6
- package/styles/theme/base.scss +0 -1
- /package/es/{iconfont.1785140083044.ttf → iconfont.1785940490728.ttf} +0 -0
- /package/es/{iconfont.1785140083044.woff → iconfont.1785940490728.woff} +0 -0
- /package/es/{iconfont.1785140083044.woff2 → iconfont.1785940490728.woff2} +0 -0
- /package/lib/{iconfont.1785140083044.ttf → iconfont.1785940490728.ttf} +0 -0
- /package/lib/{iconfont.1785140083044.woff → iconfont.1785940490728.woff} +0 -0
- /package/lib/{iconfont.1785140083044.woff2 → iconfont.1785940490728.woff2} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vxe-table",
|
|
3
|
-
"version": "4.20.
|
|
3
|
+
"version": "4.20.10",
|
|
4
4
|
"description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "npm install --legacy-peer-deps",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"typescript": "~5.9.3",
|
|
67
67
|
"vue": "3.4.27",
|
|
68
68
|
"vue-router": "~4.5.1",
|
|
69
|
-
"vxe-pc-ui": "4.16.
|
|
69
|
+
"vxe-pc-ui": "4.16.27"
|
|
70
70
|
},
|
|
71
71
|
"vetur": {
|
|
72
72
|
"tags": "helper/vetur/tags.json",
|
|
@@ -998,7 +998,7 @@ export default defineVxeComponent({
|
|
|
998
998
|
const proxyOpts = computeProxyOpts.value
|
|
999
999
|
const pagerOpts = computePagerOpts.value
|
|
1000
1000
|
const toolbarOpts = computeToolbarOpts.value
|
|
1001
|
-
const { beforeQuery, afterQuery, beforeQueryFooter, afterQueryFooter, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts
|
|
1001
|
+
const { beforeQuery: oldBeforeQuery, afterQuery: oldAfterQuery, beforeQueryFooter: oldBeforeQueryFooter, afterQueryFooter: oldAfterQueryFooter, beforeDelete: oldBeforeDelete, afterDelete: oldAfterDelete, beforeSave: oldBeforeSave, afterSave: oldAfterSave, ajax = {} } = proxyOpts
|
|
1002
1002
|
const resConfigs = (proxyOpts.response || proxyOpts.props || {}) as VxeGridDefines.ProxyConfigResponseConfig
|
|
1003
1003
|
const $xeTable = refTable.value
|
|
1004
1004
|
if (!$xeTable) {
|
|
@@ -1050,10 +1050,12 @@ export default defineVxeComponent({
|
|
|
1050
1050
|
case 'initial':
|
|
1051
1051
|
case 'reload':
|
|
1052
1052
|
case 'query': {
|
|
1053
|
-
const
|
|
1054
|
-
const
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1053
|
+
const bqMethod = ajax.beforeQuery
|
|
1054
|
+
const qMethod = ajax.query
|
|
1055
|
+
const aqMethod = ajax.afterQuery
|
|
1056
|
+
const qsMethod = ajax.querySuccess
|
|
1057
|
+
const qeMethod = ajax.queryError
|
|
1058
|
+
if (qMethod) {
|
|
1057
1059
|
const isInited = code === 'initial'
|
|
1058
1060
|
const isReload = code === 'reload'
|
|
1059
1061
|
if (!isInited && reactData.tableLoading) {
|
|
@@ -1133,119 +1135,167 @@ export default defineVxeComponent({
|
|
|
1133
1135
|
sorts: sortList,
|
|
1134
1136
|
filters: filterList,
|
|
1135
1137
|
form: formData,
|
|
1136
|
-
options:
|
|
1138
|
+
options: qMethod
|
|
1137
1139
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
const totalProp = resConfigs.total
|
|
1151
|
-
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0
|
|
1152
|
-
tablePage.total = XEUtils.toNumber(total)
|
|
1153
|
-
const resultProp = resConfigs.result
|
|
1154
|
-
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || []
|
|
1155
|
-
// 检验当前页码,不能超出当前最大页数
|
|
1156
|
-
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1)
|
|
1157
|
-
if (tablePage.currentPage > pageCount) {
|
|
1158
|
-
tablePage.currentPage = pageCount
|
|
1159
|
-
}
|
|
1140
|
+
|
|
1141
|
+
const handleQuery = () => {
|
|
1142
|
+
reactData.sortData = sortList
|
|
1143
|
+
reactData.filterData = filterList
|
|
1144
|
+
reactData.tableLoading = true
|
|
1145
|
+
return Promise.all([
|
|
1146
|
+
Promise.resolve((oldBeforeQuery || qMethod)(commitParams, ...args)),
|
|
1147
|
+
operPromise
|
|
1148
|
+
]).then(([rest]) => {
|
|
1149
|
+
reactData.tableLoading = false
|
|
1150
|
+
if (aqMethod) {
|
|
1151
|
+
aqMethod({ ...commitParams, response: rest, status: 'success' }, ...args)
|
|
1160
1152
|
} else {
|
|
1161
|
-
|
|
1162
|
-
if (
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1153
|
+
let tableData: any[] = []
|
|
1154
|
+
if (rest) {
|
|
1155
|
+
const reParams = { data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }
|
|
1156
|
+
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1157
|
+
const totalProp = resConfigs.total
|
|
1158
|
+
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0
|
|
1159
|
+
tablePage.total = XEUtils.toNumber(total)
|
|
1160
|
+
const resultProp = resConfigs.result
|
|
1161
|
+
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || []
|
|
1162
|
+
// 检验当前页码,不能超出当前最大页数
|
|
1163
|
+
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1)
|
|
1164
|
+
if (tablePage.currentPage > pageCount) {
|
|
1165
|
+
tablePage.currentPage = pageCount
|
|
1166
|
+
}
|
|
1167
|
+
} else {
|
|
1168
|
+
const listProp = resConfigs.list
|
|
1169
|
+
if (XEUtils.isArray(rest)) {
|
|
1170
|
+
tableData = rest
|
|
1171
|
+
} else if (listProp) {
|
|
1172
|
+
tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || []
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
if (showFooter) {
|
|
1176
|
+
const fdProp = resConfigs.footerData
|
|
1177
|
+
const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : []
|
|
1178
|
+
if (XEUtils.isArray(footerList)) {
|
|
1179
|
+
reactData.footerData = footerList
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1173
1182
|
}
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
if ($xeTable) {
|
|
1177
|
-
$xeTable.loadData(tableData)
|
|
1178
|
-
} else {
|
|
1179
|
-
nextTick(() => {
|
|
1180
|
-
const $xeTable = refTable.value
|
|
1181
1183
|
if ($xeTable) {
|
|
1182
1184
|
$xeTable.loadData(tableData)
|
|
1185
|
+
} else {
|
|
1186
|
+
nextTick(() => {
|
|
1187
|
+
const $xeTable = refTable.value
|
|
1188
|
+
if ($xeTable) {
|
|
1189
|
+
$xeTable.loadData(tableData)
|
|
1190
|
+
}
|
|
1191
|
+
})
|
|
1183
1192
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1193
|
+
if (oldAfterQuery) {
|
|
1194
|
+
oldAfterQuery({ ...commitParams, response: rest }, ...args)
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
if (qsMethod) {
|
|
1199
|
+
qsMethod({ ...commitParams, response: rest })
|
|
1200
|
+
}
|
|
1201
|
+
return { status: true }
|
|
1202
|
+
}).catch((rest) => {
|
|
1203
|
+
reactData.tableLoading = false
|
|
1204
|
+
if (aqMethod) {
|
|
1205
|
+
aqMethod({ ...commitParams, response: rest, status: 'error' }, ...args)
|
|
1206
|
+
}
|
|
1207
|
+
if (qeMethod) {
|
|
1208
|
+
qeMethod({ ...commitParams, response: rest })
|
|
1209
|
+
}
|
|
1210
|
+
return { status: false }
|
|
1211
|
+
})
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
if (bqMethod) {
|
|
1215
|
+
return Promise.resolve(bqMethod(commitParams, ...args)).then(status => {
|
|
1216
|
+
if (status !== false) {
|
|
1217
|
+
return handleQuery()
|
|
1218
|
+
}
|
|
1219
|
+
})
|
|
1220
|
+
}
|
|
1221
|
+
return handleQuery()
|
|
1200
1222
|
} else {
|
|
1201
1223
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.query'])
|
|
1202
1224
|
}
|
|
1203
1225
|
break
|
|
1204
1226
|
}
|
|
1205
1227
|
case 'queryFooter': {
|
|
1206
|
-
const
|
|
1207
|
-
const
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1228
|
+
const bqfMethod = ajax.beforeQueryFooter
|
|
1229
|
+
const qfMethod = ajax.queryFooter
|
|
1230
|
+
const aqfMethod = ajax.afterQueryFooter
|
|
1231
|
+
const qfSuccessMethod = ajax.queryFooterSuccess
|
|
1232
|
+
const qfErrorMethod = ajax.queryFooterError
|
|
1233
|
+
if (qfMethod) {
|
|
1210
1234
|
let filterList: VxeTableDefines.FilterCheckedParams[] = []
|
|
1211
1235
|
if ($xeTable) {
|
|
1212
1236
|
filterList = $xeTable.getCheckedFilters()
|
|
1213
1237
|
}
|
|
1238
|
+
let pageParams: any = {}
|
|
1239
|
+
if (pagerConfig) {
|
|
1240
|
+
if (isEnableConf(pagerOpts)) {
|
|
1241
|
+
pageParams = { ...tablePage }
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1214
1244
|
const commitParams = {
|
|
1215
1245
|
$table: $xeTable,
|
|
1216
1246
|
$grid: $xeGrid,
|
|
1217
1247
|
$gantt: null,
|
|
1218
1248
|
code,
|
|
1219
1249
|
button,
|
|
1250
|
+
page: pageParams,
|
|
1220
1251
|
filters: filterList,
|
|
1221
1252
|
form: formData,
|
|
1222
|
-
options:
|
|
1253
|
+
options: qfMethod
|
|
1223
1254
|
}
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1255
|
+
const handleQueryFooter = () => {
|
|
1256
|
+
return Promise.resolve((oldBeforeQueryFooter || qfMethod)(commitParams, ...args)).then(rest => {
|
|
1257
|
+
if (aqfMethod) {
|
|
1258
|
+
aqfMethod({ ...commitParams, response: rest, status: 'success' }, ...args)
|
|
1259
|
+
} else {
|
|
1260
|
+
reactData.footerData = XEUtils.isArray(rest) ? rest : []
|
|
1261
|
+
if (oldAfterQueryFooter) {
|
|
1262
|
+
oldAfterQueryFooter({ ...commitParams, response: rest }, ...args)
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
if (qfSuccessMethod) {
|
|
1266
|
+
qfSuccessMethod({ ...commitParams, response: rest })
|
|
1267
|
+
}
|
|
1268
|
+
return { status: true }
|
|
1269
|
+
}).catch((rest) => {
|
|
1270
|
+
if (aqfMethod) {
|
|
1271
|
+
aqfMethod({ ...commitParams, response: rest, status: 'error' }, ...args)
|
|
1272
|
+
}
|
|
1273
|
+
if (qfErrorMethod) {
|
|
1274
|
+
qfErrorMethod({ ...commitParams, response: rest })
|
|
1275
|
+
}
|
|
1276
|
+
return { status: false }
|
|
1277
|
+
})
|
|
1278
|
+
}
|
|
1279
|
+
if (bqfMethod) {
|
|
1280
|
+
return Promise.resolve(bqfMethod(commitParams, ...args)).then(status => {
|
|
1281
|
+
if (status !== false) {
|
|
1282
|
+
return handleQueryFooter()
|
|
1283
|
+
}
|
|
1284
|
+
})
|
|
1285
|
+
}
|
|
1286
|
+
return handleQueryFooter()
|
|
1239
1287
|
} else {
|
|
1240
1288
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter'])
|
|
1241
1289
|
}
|
|
1242
1290
|
break
|
|
1243
1291
|
}
|
|
1244
1292
|
case 'delete': {
|
|
1245
|
-
const
|
|
1293
|
+
const bdMethod = ajax.beforeDelete
|
|
1294
|
+
const dMethod = ajax.delete
|
|
1295
|
+
const adMethod = ajax.afterDelete
|
|
1246
1296
|
const deleteSuccessMethods = ajax.deleteSuccess
|
|
1247
1297
|
const deleteErrorMethods = ajax.deleteError
|
|
1248
|
-
if (
|
|
1298
|
+
if (dMethod) {
|
|
1249
1299
|
const selectRecords = $xeGrid.getCheckboxRecords()
|
|
1250
1300
|
const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row))
|
|
1251
1301
|
const body = { removeRecords }
|
|
@@ -1257,48 +1307,68 @@ export default defineVxeComponent({
|
|
|
1257
1307
|
button,
|
|
1258
1308
|
body,
|
|
1259
1309
|
form: formData,
|
|
1260
|
-
options:
|
|
1310
|
+
options: dMethod
|
|
1261
1311
|
}
|
|
1262
1312
|
if (selectRecords.length) {
|
|
1263
1313
|
return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
1264
1314
|
if (!removeRecords.length) {
|
|
1265
1315
|
return $xeTable.remove(selectRecords)
|
|
1266
1316
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
.
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
if (
|
|
1274
|
-
|
|
1317
|
+
|
|
1318
|
+
const handleDelete = () => {
|
|
1319
|
+
reactData.tableLoading = true
|
|
1320
|
+
return Promise.resolve((oldBeforeDelete || dMethod)(commitParams, ...args))
|
|
1321
|
+
.then(rest => {
|
|
1322
|
+
reactData.tableLoading = false
|
|
1323
|
+
if (adMethod) {
|
|
1324
|
+
adMethod({ ...commitParams, response: rest, status: 'success' }, ...args)
|
|
1325
|
+
} else {
|
|
1326
|
+
$xeTable.setPendingRow(removeRecords, false)
|
|
1327
|
+
if (isRespMsg) {
|
|
1328
|
+
if (VxeUI.modal) {
|
|
1329
|
+
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' })
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
if (oldAfterDelete) {
|
|
1333
|
+
oldAfterDelete({ ...commitParams, response: rest }, ...args)
|
|
1334
|
+
} else {
|
|
1335
|
+
internalData.uFoot = true
|
|
1336
|
+
$xeGrid.commitProxy('query')
|
|
1337
|
+
internalData.uFoot = false
|
|
1338
|
+
updateQueryFooter()
|
|
1339
|
+
}
|
|
1275
1340
|
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
afterDelete(commitParams, ...args)
|
|
1279
|
-
} else {
|
|
1280
|
-
internalData.uFoot = true
|
|
1281
|
-
$xeGrid.commitProxy('query')
|
|
1282
|
-
internalData.uFoot = false
|
|
1283
|
-
updateQueryFooter()
|
|
1284
|
-
}
|
|
1285
|
-
if (deleteSuccessMethods) {
|
|
1286
|
-
deleteSuccessMethods({ ...commitParams, response: rest })
|
|
1287
|
-
}
|
|
1288
|
-
return { status: true }
|
|
1289
|
-
})
|
|
1290
|
-
.catch(rest => {
|
|
1291
|
-
reactData.tableLoading = false
|
|
1292
|
-
if (isRespMsg) {
|
|
1293
|
-
if (VxeUI.modal) {
|
|
1294
|
-
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1341
|
+
if (deleteSuccessMethods) {
|
|
1342
|
+
deleteSuccessMethods({ ...commitParams, response: rest })
|
|
1295
1343
|
}
|
|
1344
|
+
return { status: true }
|
|
1345
|
+
})
|
|
1346
|
+
.catch(rest => {
|
|
1347
|
+
reactData.tableLoading = false
|
|
1348
|
+
if (adMethod) {
|
|
1349
|
+
adMethod({ ...commitParams, response: rest, status: 'error' }, ...args)
|
|
1350
|
+
} else {
|
|
1351
|
+
if (isRespMsg) {
|
|
1352
|
+
if (VxeUI.modal) {
|
|
1353
|
+
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
if (deleteErrorMethods) {
|
|
1358
|
+
deleteErrorMethods({ ...commitParams, response: rest })
|
|
1359
|
+
}
|
|
1360
|
+
return { status: false }
|
|
1361
|
+
})
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
if (bdMethod) {
|
|
1365
|
+
return Promise.resolve(bdMethod(commitParams, ...args)).then(status => {
|
|
1366
|
+
if (status !== false) {
|
|
1367
|
+
return handleDelete()
|
|
1296
1368
|
}
|
|
1297
|
-
if (deleteErrorMethods) {
|
|
1298
|
-
deleteErrorMethods({ ...commitParams, response: rest })
|
|
1299
|
-
}
|
|
1300
|
-
return { status: false }
|
|
1301
1369
|
})
|
|
1370
|
+
}
|
|
1371
|
+
return handleDelete()
|
|
1302
1372
|
})
|
|
1303
1373
|
} else {
|
|
1304
1374
|
if (isActiveMsg) {
|
|
@@ -1313,10 +1383,12 @@ export default defineVxeComponent({
|
|
|
1313
1383
|
break
|
|
1314
1384
|
}
|
|
1315
1385
|
case 'save': {
|
|
1316
|
-
const
|
|
1317
|
-
const
|
|
1318
|
-
const
|
|
1319
|
-
|
|
1386
|
+
const bSaveMethod = ajax.beforeSave
|
|
1387
|
+
const sMethod = ajax.save
|
|
1388
|
+
const aSaveMethod = ajax.afterSave
|
|
1389
|
+
const sSuccessMethod = ajax.saveSuccess
|
|
1390
|
+
const sErrorMethod = ajax.saveError
|
|
1391
|
+
if (sMethod) {
|
|
1320
1392
|
const body = $xeTable.getRecordset()
|
|
1321
1393
|
const { insertRecords, removeRecords, updateRecords, pendingRecords } = body
|
|
1322
1394
|
const commitParams = {
|
|
@@ -1327,7 +1399,7 @@ export default defineVxeComponent({
|
|
|
1327
1399
|
button,
|
|
1328
1400
|
body,
|
|
1329
1401
|
form: formData,
|
|
1330
|
-
options:
|
|
1402
|
+
options: sMethod
|
|
1331
1403
|
}
|
|
1332
1404
|
// 排除掉新增且标记为删除的数据
|
|
1333
1405
|
if (insertRecords.length) {
|
|
@@ -1348,41 +1420,59 @@ export default defineVxeComponent({
|
|
|
1348
1420
|
return
|
|
1349
1421
|
}
|
|
1350
1422
|
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
.
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1423
|
+
const handleSave = () => {
|
|
1424
|
+
reactData.tableLoading = true
|
|
1425
|
+
return Promise.resolve((oldBeforeSave || sMethod)(commitParams, ...args))
|
|
1426
|
+
.then(rest => {
|
|
1427
|
+
reactData.tableLoading = false
|
|
1428
|
+
if (aSaveMethod) {
|
|
1429
|
+
aSaveMethod({ ...commitParams, response: rest, status: 'success' }, ...args)
|
|
1430
|
+
} else {
|
|
1431
|
+
$xeTable.clearPendingRow()
|
|
1432
|
+
if (isRespMsg) {
|
|
1433
|
+
if (VxeUI.modal) {
|
|
1434
|
+
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' })
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
if (oldAfterSave) {
|
|
1438
|
+
oldAfterSave({ ...commitParams, response: rest }, ...args)
|
|
1439
|
+
} else {
|
|
1440
|
+
internalData.uFoot = true
|
|
1441
|
+
$xeGrid.commitProxy('query')
|
|
1442
|
+
internalData.uFoot = false
|
|
1443
|
+
updateQueryFooter()
|
|
1444
|
+
}
|
|
1359
1445
|
}
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
afterSave(commitParams, ...args)
|
|
1363
|
-
} else {
|
|
1364
|
-
internalData.uFoot = true
|
|
1365
|
-
$xeGrid.commitProxy('query')
|
|
1366
|
-
internalData.uFoot = false
|
|
1367
|
-
updateQueryFooter()
|
|
1368
|
-
}
|
|
1369
|
-
if (saveSuccessMethods) {
|
|
1370
|
-
saveSuccessMethods({ ...commitParams, response: rest })
|
|
1371
|
-
}
|
|
1372
|
-
return { status: true }
|
|
1373
|
-
})
|
|
1374
|
-
.catch(rest => {
|
|
1375
|
-
reactData.tableLoading = false
|
|
1376
|
-
if (isRespMsg) {
|
|
1377
|
-
if (VxeUI.modal) {
|
|
1378
|
-
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1446
|
+
if (sSuccessMethod) {
|
|
1447
|
+
sSuccessMethod({ ...commitParams, response: rest })
|
|
1379
1448
|
}
|
|
1449
|
+
return { status: true }
|
|
1450
|
+
})
|
|
1451
|
+
.catch(rest => {
|
|
1452
|
+
reactData.tableLoading = false
|
|
1453
|
+
if (aSaveMethod) {
|
|
1454
|
+
aSaveMethod({ ...commitParams, response: rest, status: 'error' }, ...args)
|
|
1455
|
+
} else {
|
|
1456
|
+
if (isRespMsg) {
|
|
1457
|
+
if (VxeUI.modal) {
|
|
1458
|
+
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' })
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
if (sErrorMethod) {
|
|
1463
|
+
sErrorMethod({ ...commitParams, response: rest })
|
|
1464
|
+
}
|
|
1465
|
+
return { status: false }
|
|
1466
|
+
})
|
|
1467
|
+
}
|
|
1468
|
+
if (bSaveMethod) {
|
|
1469
|
+
return Promise.resolve(bSaveMethod(commitParams, ...args)).then(status => {
|
|
1470
|
+
if (status !== false) {
|
|
1471
|
+
return handleSave()
|
|
1380
1472
|
}
|
|
1381
|
-
if (saveErrorMethods) {
|
|
1382
|
-
saveErrorMethods({ ...commitParams, response: rest })
|
|
1383
|
-
}
|
|
1384
|
-
return { status: false }
|
|
1385
1473
|
})
|
|
1474
|
+
}
|
|
1475
|
+
return handleSave()
|
|
1386
1476
|
} else {
|
|
1387
1477
|
if (isActiveMsg) {
|
|
1388
1478
|
if (VxeUI.modal) {
|
|
@@ -1308,7 +1308,7 @@ export default defineVxeComponent({
|
|
|
1308
1308
|
}, VxeUIRadioGroupComponent
|
|
1309
1309
|
? [
|
|
1310
1310
|
h(VxeUIRadioGroupComponent, {
|
|
1311
|
-
modelValue: column.renderAlign || '',
|
|
1311
|
+
modelValue: column.renderAlign || 'left',
|
|
1312
1312
|
type: 'button',
|
|
1313
1313
|
strict: false,
|
|
1314
1314
|
disabled: isHidden,
|
|
@@ -1332,7 +1332,7 @@ export default defineVxeComponent({
|
|
|
1332
1332
|
: (VxeUIRadioGroupComponent
|
|
1333
1333
|
? [
|
|
1334
1334
|
h(VxeUIRadioGroupComponent, {
|
|
1335
|
-
modelValue: column.renderHeaderAlign || '',
|
|
1335
|
+
modelValue: column.renderHeaderAlign || 'left',
|
|
1336
1336
|
type: 'button',
|
|
1337
1337
|
strict: false,
|
|
1338
1338
|
disabled: isHidden,
|
|
@@ -1357,7 +1357,7 @@ export default defineVxeComponent({
|
|
|
1357
1357
|
: (VxeUIRadioGroupComponent
|
|
1358
1358
|
? [
|
|
1359
1359
|
h(VxeUIRadioGroupComponent, {
|
|
1360
|
-
modelValue: column.renderFooterAlign || '',
|
|
1360
|
+
modelValue: column.renderFooterAlign || 'left',
|
|
1361
1361
|
type: 'button',
|
|
1362
1362
|
strict: false,
|
|
1363
1363
|
disabled: isHidden,
|