vxe-table 4.20.9 → 4.20.11
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 +339 -204
- package/dist/style.css +1 -1
- package/es/grid/src/grid.js +252 -161
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +3 -3
- package/es/table/module/export/hook.js +53 -33
- package/es/table/render/index.js +12 -2
- package/es/table/src/table.js +17 -3
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +321 -204
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +442 -259
- package/lib/index.umd.min.js +1 -1
- package/lib/style.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 +67 -40
- 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 +3 -3
- package/lib/table/src/table.min.js +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/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 +51 -30
- package/packages/table/render/index.ts +12 -2
- package/packages/table/src/table.ts +17 -3
- /package/es/{iconfont.1785242738274.ttf → iconfont.1786329229929.ttf} +0 -0
- /package/es/{iconfont.1785242738274.woff → iconfont.1786329229929.woff} +0 -0
- /package/es/{iconfont.1785242738274.woff2 → iconfont.1786329229929.woff2} +0 -0
- /package/lib/{iconfont.1785242738274.ttf → iconfont.1786329229929.ttf} +0 -0
- /package/lib/{iconfont.1785242738274.woff → iconfont.1786329229929.woff} +0 -0
- /package/lib/{iconfont.1785242738274.woff2 → iconfont.1786329229929.woff2} +0 -0
package/lib/grid/src/grid.js
CHANGED
|
@@ -1056,14 +1056,14 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1056
1056
|
const pagerOpts = computePagerOpts.value;
|
|
1057
1057
|
const toolbarOpts = computeToolbarOpts.value;
|
|
1058
1058
|
const {
|
|
1059
|
-
beforeQuery,
|
|
1060
|
-
afterQuery,
|
|
1061
|
-
beforeQueryFooter,
|
|
1062
|
-
afterQueryFooter,
|
|
1063
|
-
beforeDelete,
|
|
1064
|
-
afterDelete,
|
|
1065
|
-
beforeSave,
|
|
1066
|
-
afterSave,
|
|
1059
|
+
beforeQuery: oldBeforeQuery,
|
|
1060
|
+
afterQuery: oldAfterQuery,
|
|
1061
|
+
beforeQueryFooter: oldBeforeQueryFooter,
|
|
1062
|
+
afterQueryFooter: oldAfterQueryFooter,
|
|
1063
|
+
beforeDelete: oldBeforeDelete,
|
|
1064
|
+
afterDelete: oldAfterDelete,
|
|
1065
|
+
beforeSave: oldBeforeSave,
|
|
1066
|
+
afterSave: oldAfterSave,
|
|
1067
1067
|
ajax = {}
|
|
1068
1068
|
} = proxyOpts;
|
|
1069
1069
|
const resConfigs = proxyOpts.response || proxyOpts.props || {};
|
|
@@ -1124,10 +1124,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1124
1124
|
case 'reload':
|
|
1125
1125
|
case 'query':
|
|
1126
1126
|
{
|
|
1127
|
-
const
|
|
1128
|
-
const
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1127
|
+
const bqMethod = ajax.beforeQuery;
|
|
1128
|
+
const qMethod = ajax.query;
|
|
1129
|
+
const aqMethod = ajax.afterQuery;
|
|
1130
|
+
const qsMethod = ajax.querySuccess;
|
|
1131
|
+
const qeMethod = ajax.queryError;
|
|
1132
|
+
if (qMethod) {
|
|
1131
1133
|
const isInited = code === 'initial';
|
|
1132
1134
|
const isReload = code === 'reload';
|
|
1133
1135
|
if (!isInited && reactData.tableLoading) {
|
|
@@ -1215,80 +1217,105 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1215
1217
|
sorts: sortList,
|
|
1216
1218
|
filters: filterList,
|
|
1217
1219
|
form: formData,
|
|
1218
|
-
options:
|
|
1220
|
+
options: qMethod
|
|
1219
1221
|
};
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
$gantt: null
|
|
1232
|
-
};
|
|
1233
|
-
if (pagerConfig && (0, _utils.isEnableConf)(pagerOpts)) {
|
|
1234
|
-
const totalProp = resConfigs.total;
|
|
1235
|
-
const total = (_xeUtils.default.isFunction(totalProp) ? totalProp(reParams) : _xeUtils.default.get(rest, totalProp || 'page.total')) || 0;
|
|
1236
|
-
tablePage.total = _xeUtils.default.toNumber(total);
|
|
1237
|
-
const resultProp = resConfigs.result;
|
|
1238
|
-
tableData = (_xeUtils.default.isFunction(resultProp) ? resultProp(reParams) : _xeUtils.default.get(rest, resultProp || 'result')) || [];
|
|
1239
|
-
// 检验当前页码,不能超出当前最大页数
|
|
1240
|
-
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
1241
|
-
if (tablePage.currentPage > pageCount) {
|
|
1242
|
-
tablePage.currentPage = pageCount;
|
|
1243
|
-
}
|
|
1222
|
+
const handleQuery = () => {
|
|
1223
|
+
reactData.sortData = sortList;
|
|
1224
|
+
reactData.filterData = filterList;
|
|
1225
|
+
reactData.tableLoading = true;
|
|
1226
|
+
return Promise.all([Promise.resolve((oldBeforeQuery || qMethod)(commitParams, ...args)), operPromise]).then(([rest]) => {
|
|
1227
|
+
reactData.tableLoading = false;
|
|
1228
|
+
if (aqMethod) {
|
|
1229
|
+
aqMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1230
|
+
response: rest,
|
|
1231
|
+
status: 'success'
|
|
1232
|
+
}), ...args);
|
|
1244
1233
|
} else {
|
|
1245
|
-
|
|
1246
|
-
if (
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1234
|
+
let tableData = [];
|
|
1235
|
+
if (rest) {
|
|
1236
|
+
const listProp = resConfigs.list;
|
|
1237
|
+
const resultProp = resConfigs.result;
|
|
1238
|
+
const reParams = {
|
|
1239
|
+
data: rest,
|
|
1240
|
+
$table: $xeTable,
|
|
1241
|
+
$grid: $xeGrid,
|
|
1242
|
+
$gantt: null
|
|
1243
|
+
};
|
|
1244
|
+
if (pagerConfig && (0, _utils.isEnableConf)(pagerOpts)) {
|
|
1245
|
+
const totalProp = resConfigs.total;
|
|
1246
|
+
const total = (_xeUtils.default.isFunction(totalProp) ? totalProp(reParams) : _xeUtils.default.get(rest, totalProp || 'page.total')) || 0;
|
|
1247
|
+
tablePage.total = _xeUtils.default.toNumber(total);
|
|
1248
|
+
tableData = (_xeUtils.default.isFunction(resultProp) ? resultProp(reParams) : _xeUtils.default.get(rest, resultProp || 'result')) || [];
|
|
1249
|
+
// 检验当前页码,不能超出当前最大页数
|
|
1250
|
+
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
1251
|
+
if (tablePage.currentPage > pageCount) {
|
|
1252
|
+
tablePage.currentPage = pageCount;
|
|
1253
|
+
}
|
|
1254
|
+
} else {
|
|
1255
|
+
if (_xeUtils.default.isArray(rest)) {
|
|
1256
|
+
tableData = rest;
|
|
1257
|
+
} else if (listProp) {
|
|
1258
|
+
tableData = (_xeUtils.default.isFunction(listProp) ? listProp(reParams) : _xeUtils.default.get(rest, listProp)) || [];
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
if (showFooter) {
|
|
1262
|
+
const fdProp = resConfigs.footerData;
|
|
1263
|
+
const footerList = fdProp ? _xeUtils.default.isFunction(fdProp) ? fdProp(reParams) : _xeUtils.default.get(rest, fdProp) : [];
|
|
1264
|
+
if (_xeUtils.default.isArray(footerList)) {
|
|
1265
|
+
reactData.footerData = footerList;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1257
1268
|
}
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
if ($xeTable) {
|
|
1261
|
-
$xeTable.loadData(tableData);
|
|
1262
|
-
} else {
|
|
1263
|
-
(0, _vue.nextTick)(() => {
|
|
1264
|
-
const $xeTable = refTable.value;
|
|
1265
1269
|
if ($xeTable) {
|
|
1266
1270
|
$xeTable.loadData(tableData);
|
|
1271
|
+
} else {
|
|
1272
|
+
(0, _vue.nextTick)(() => {
|
|
1273
|
+
const $xeTable = refTable.value;
|
|
1274
|
+
if ($xeTable) {
|
|
1275
|
+
$xeTable.loadData(tableData);
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1267
1278
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1279
|
+
if (oldAfterQuery) {
|
|
1280
|
+
oldAfterQuery(Object.assign(Object.assign({}, commitParams), {
|
|
1281
|
+
response: rest
|
|
1282
|
+
}), ...args);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
if (qsMethod) {
|
|
1286
|
+
qsMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1287
|
+
response: rest
|
|
1288
|
+
}));
|
|
1289
|
+
}
|
|
1290
|
+
return {
|
|
1291
|
+
status: true
|
|
1292
|
+
};
|
|
1293
|
+
}).catch(rest => {
|
|
1294
|
+
reactData.tableLoading = false;
|
|
1295
|
+
if (aqMethod) {
|
|
1296
|
+
aqMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1297
|
+
response: rest,
|
|
1298
|
+
status: 'error'
|
|
1299
|
+
}), ...args);
|
|
1300
|
+
}
|
|
1301
|
+
if (qeMethod) {
|
|
1302
|
+
qeMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1303
|
+
response: rest
|
|
1304
|
+
}));
|
|
1305
|
+
}
|
|
1306
|
+
return {
|
|
1307
|
+
status: false
|
|
1308
|
+
};
|
|
1309
|
+
});
|
|
1310
|
+
};
|
|
1311
|
+
if (bqMethod) {
|
|
1312
|
+
return Promise.resolve(bqMethod(commitParams, ...args)).then(status => {
|
|
1313
|
+
if (status !== false) {
|
|
1314
|
+
return handleQuery();
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
return handleQuery();
|
|
1292
1319
|
} else {
|
|
1293
1320
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
|
|
1294
1321
|
}
|
|
@@ -1296,47 +1323,81 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1296
1323
|
}
|
|
1297
1324
|
case 'queryFooter':
|
|
1298
1325
|
{
|
|
1299
|
-
const
|
|
1300
|
-
const
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1326
|
+
const bqfMethod = ajax.beforeQueryFooter;
|
|
1327
|
+
const qfMethod = ajax.queryFooter;
|
|
1328
|
+
const aqfMethod = ajax.afterQueryFooter;
|
|
1329
|
+
const qfSuccessMethod = ajax.queryFooterSuccess;
|
|
1330
|
+
const qfErrorMethod = ajax.queryFooterError;
|
|
1331
|
+
if (qfMethod) {
|
|
1303
1332
|
let filterList = [];
|
|
1304
1333
|
if ($xeTable) {
|
|
1305
1334
|
filterList = $xeTable.getCheckedFilters();
|
|
1306
1335
|
}
|
|
1336
|
+
let pageParams = {};
|
|
1337
|
+
if (pagerConfig) {
|
|
1338
|
+
if ((0, _utils.isEnableConf)(pagerOpts)) {
|
|
1339
|
+
pageParams = Object.assign({}, tablePage);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1307
1342
|
const commitParams = {
|
|
1308
1343
|
$table: $xeTable,
|
|
1309
1344
|
$grid: $xeGrid,
|
|
1310
1345
|
$gantt: null,
|
|
1311
1346
|
code,
|
|
1312
1347
|
button,
|
|
1348
|
+
page: pageParams,
|
|
1313
1349
|
filters: filterList,
|
|
1314
1350
|
form: formData,
|
|
1315
|
-
options:
|
|
1351
|
+
options: qfMethod
|
|
1316
1352
|
};
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1353
|
+
const handleQueryFooter = () => {
|
|
1354
|
+
return Promise.resolve((oldBeforeQueryFooter || qfMethod)(commitParams, ...args)).then(rest => {
|
|
1355
|
+
if (aqfMethod) {
|
|
1356
|
+
aqfMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1357
|
+
response: rest,
|
|
1358
|
+
status: 'success'
|
|
1359
|
+
}), ...args);
|
|
1360
|
+
} else {
|
|
1361
|
+
reactData.footerData = _xeUtils.default.isArray(rest) ? rest : [];
|
|
1362
|
+
if (oldAfterQueryFooter) {
|
|
1363
|
+
oldAfterQueryFooter(Object.assign(Object.assign({}, commitParams), {
|
|
1364
|
+
response: rest
|
|
1365
|
+
}), ...args);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
if (qfSuccessMethod) {
|
|
1369
|
+
qfSuccessMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1370
|
+
response: rest
|
|
1371
|
+
}));
|
|
1372
|
+
}
|
|
1373
|
+
return {
|
|
1374
|
+
status: true
|
|
1375
|
+
};
|
|
1376
|
+
}).catch(rest => {
|
|
1377
|
+
if (aqfMethod) {
|
|
1378
|
+
aqfMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1379
|
+
response: rest,
|
|
1380
|
+
status: 'error'
|
|
1381
|
+
}), ...args);
|
|
1382
|
+
}
|
|
1383
|
+
if (qfErrorMethod) {
|
|
1384
|
+
qfErrorMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1385
|
+
response: rest
|
|
1386
|
+
}));
|
|
1387
|
+
}
|
|
1388
|
+
return {
|
|
1389
|
+
status: false
|
|
1390
|
+
};
|
|
1391
|
+
});
|
|
1392
|
+
};
|
|
1393
|
+
if (bqfMethod) {
|
|
1394
|
+
return Promise.resolve(bqfMethod(commitParams, ...args)).then(status => {
|
|
1395
|
+
if (status !== false) {
|
|
1396
|
+
return handleQueryFooter();
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
return handleQueryFooter();
|
|
1340
1401
|
} else {
|
|
1341
1402
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter']);
|
|
1342
1403
|
}
|
|
@@ -1344,10 +1405,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1344
1405
|
}
|
|
1345
1406
|
case 'delete':
|
|
1346
1407
|
{
|
|
1347
|
-
const
|
|
1408
|
+
const bdMethod = ajax.beforeDelete;
|
|
1409
|
+
const dMethod = ajax.delete;
|
|
1410
|
+
const adMethod = ajax.afterDelete;
|
|
1348
1411
|
const deleteSuccessMethods = ajax.deleteSuccess;
|
|
1349
1412
|
const deleteErrorMethods = ajax.deleteError;
|
|
1350
|
-
if (
|
|
1413
|
+
if (dMethod) {
|
|
1351
1414
|
const selectRecords = $xeGrid.getCheckboxRecords();
|
|
1352
1415
|
const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row));
|
|
1353
1416
|
const body = {
|
|
@@ -1361,61 +1424,87 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1361
1424
|
button,
|
|
1362
1425
|
body,
|
|
1363
1426
|
form: formData,
|
|
1364
|
-
options:
|
|
1427
|
+
options: dMethod
|
|
1365
1428
|
};
|
|
1366
1429
|
if (selectRecords.length) {
|
|
1367
1430
|
return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
1368
1431
|
if (!removeRecords.length) {
|
|
1369
1432
|
return $xeTable.remove(selectRecords);
|
|
1370
1433
|
}
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
content: getRespMsg(rest, 'vxe.grid.delSuccess'),
|
|
1434
|
+
const handleDelete = () => {
|
|
1435
|
+
reactData.tableLoading = true;
|
|
1436
|
+
return Promise.resolve((oldBeforeDelete || dMethod)(commitParams, ...args)).then(rest => {
|
|
1437
|
+
reactData.tableLoading = false;
|
|
1438
|
+
if (adMethod) {
|
|
1439
|
+
adMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1440
|
+
response: rest,
|
|
1379
1441
|
status: 'success'
|
|
1380
|
-
});
|
|
1442
|
+
}), ...args);
|
|
1443
|
+
} else {
|
|
1444
|
+
$xeTable.setPendingRow(removeRecords, false);
|
|
1445
|
+
if (isRespMsg) {
|
|
1446
|
+
if (_ui.VxeUI.modal) {
|
|
1447
|
+
_ui.VxeUI.modal.message({
|
|
1448
|
+
content: getRespMsg(rest, 'vxe.grid.delSuccess'),
|
|
1449
|
+
status: 'success'
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
if (oldAfterDelete) {
|
|
1454
|
+
oldAfterDelete(Object.assign(Object.assign({}, commitParams), {
|
|
1455
|
+
response: rest
|
|
1456
|
+
}), ...args);
|
|
1457
|
+
} else {
|
|
1458
|
+
internalData.uFoot = true;
|
|
1459
|
+
$xeGrid.commitProxy('query');
|
|
1460
|
+
internalData.uFoot = false;
|
|
1461
|
+
updateQueryFooter();
|
|
1462
|
+
}
|
|
1381
1463
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
}
|
|
1396
|
-
return {
|
|
1397
|
-
status: true
|
|
1398
|
-
};
|
|
1399
|
-
}).catch(rest => {
|
|
1400
|
-
reactData.tableLoading = false;
|
|
1401
|
-
if (isRespMsg) {
|
|
1402
|
-
if (_ui.VxeUI.modal) {
|
|
1403
|
-
_ui.VxeUI.modal.message({
|
|
1404
|
-
id: code,
|
|
1405
|
-
content: getRespMsg(rest, 'vxe.grid.operError'),
|
|
1464
|
+
if (deleteSuccessMethods) {
|
|
1465
|
+
deleteSuccessMethods(Object.assign(Object.assign({}, commitParams), {
|
|
1466
|
+
response: rest
|
|
1467
|
+
}));
|
|
1468
|
+
}
|
|
1469
|
+
return {
|
|
1470
|
+
status: true
|
|
1471
|
+
};
|
|
1472
|
+
}).catch(rest => {
|
|
1473
|
+
reactData.tableLoading = false;
|
|
1474
|
+
if (adMethod) {
|
|
1475
|
+
adMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1476
|
+
response: rest,
|
|
1406
1477
|
status: 'error'
|
|
1407
|
-
});
|
|
1478
|
+
}), ...args);
|
|
1479
|
+
} else {
|
|
1480
|
+
if (isRespMsg) {
|
|
1481
|
+
if (_ui.VxeUI.modal) {
|
|
1482
|
+
_ui.VxeUI.modal.message({
|
|
1483
|
+
id: code,
|
|
1484
|
+
content: getRespMsg(rest, 'vxe.grid.operError'),
|
|
1485
|
+
status: 'error'
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1408
1489
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
};
|
|
1418
|
-
}
|
|
1490
|
+
if (deleteErrorMethods) {
|
|
1491
|
+
deleteErrorMethods(Object.assign(Object.assign({}, commitParams), {
|
|
1492
|
+
response: rest
|
|
1493
|
+
}));
|
|
1494
|
+
}
|
|
1495
|
+
return {
|
|
1496
|
+
status: false
|
|
1497
|
+
};
|
|
1498
|
+
});
|
|
1499
|
+
};
|
|
1500
|
+
if (bdMethod) {
|
|
1501
|
+
return Promise.resolve(bdMethod(commitParams, ...args)).then(status => {
|
|
1502
|
+
if (status !== false) {
|
|
1503
|
+
return handleDelete();
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
return handleDelete();
|
|
1419
1508
|
});
|
|
1420
1509
|
} else {
|
|
1421
1510
|
if (isActiveMsg) {
|
|
@@ -1435,10 +1524,12 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1435
1524
|
}
|
|
1436
1525
|
case 'save':
|
|
1437
1526
|
{
|
|
1438
|
-
const
|
|
1439
|
-
const
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1527
|
+
const bSaveMethod = ajax.beforeSave;
|
|
1528
|
+
const sMethod = ajax.save;
|
|
1529
|
+
const aSaveMethod = ajax.afterSave;
|
|
1530
|
+
const sSuccessMethod = ajax.saveSuccess;
|
|
1531
|
+
const sErrorMethod = ajax.saveError;
|
|
1532
|
+
if (sMethod) {
|
|
1442
1533
|
const body = $xeTable.getRecordset();
|
|
1443
1534
|
const {
|
|
1444
1535
|
insertRecords,
|
|
@@ -1454,7 +1545,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1454
1545
|
button,
|
|
1455
1546
|
body,
|
|
1456
1547
|
form: formData,
|
|
1457
|
-
options:
|
|
1548
|
+
options: sMethod
|
|
1458
1549
|
};
|
|
1459
1550
|
// 排除掉新增且标记为删除的数据
|
|
1460
1551
|
if (insertRecords.length) {
|
|
@@ -1475,54 +1566,80 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
1475
1566
|
return;
|
|
1476
1567
|
}
|
|
1477
1568
|
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
content: getRespMsg(rest, 'vxe.grid.saveSuccess'),
|
|
1569
|
+
const handleSave = () => {
|
|
1570
|
+
reactData.tableLoading = true;
|
|
1571
|
+
return Promise.resolve((oldBeforeSave || sMethod)(commitParams, ...args)).then(rest => {
|
|
1572
|
+
reactData.tableLoading = false;
|
|
1573
|
+
if (aSaveMethod) {
|
|
1574
|
+
aSaveMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1575
|
+
response: rest,
|
|
1486
1576
|
status: 'success'
|
|
1487
|
-
});
|
|
1577
|
+
}), ...args);
|
|
1578
|
+
} else {
|
|
1579
|
+
$xeTable.clearPendingRow();
|
|
1580
|
+
if (isRespMsg) {
|
|
1581
|
+
if (_ui.VxeUI.modal) {
|
|
1582
|
+
_ui.VxeUI.modal.message({
|
|
1583
|
+
content: getRespMsg(rest, 'vxe.grid.saveSuccess'),
|
|
1584
|
+
status: 'success'
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
if (oldAfterSave) {
|
|
1589
|
+
oldAfterSave(Object.assign(Object.assign({}, commitParams), {
|
|
1590
|
+
response: rest
|
|
1591
|
+
}), ...args);
|
|
1592
|
+
} else {
|
|
1593
|
+
internalData.uFoot = true;
|
|
1594
|
+
$xeGrid.commitProxy('query');
|
|
1595
|
+
internalData.uFoot = false;
|
|
1596
|
+
updateQueryFooter();
|
|
1597
|
+
}
|
|
1488
1598
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
}
|
|
1503
|
-
return {
|
|
1504
|
-
status: true
|
|
1505
|
-
};
|
|
1506
|
-
}).catch(rest => {
|
|
1507
|
-
reactData.tableLoading = false;
|
|
1508
|
-
if (isRespMsg) {
|
|
1509
|
-
if (_ui.VxeUI.modal) {
|
|
1510
|
-
_ui.VxeUI.modal.message({
|
|
1511
|
-
id: code,
|
|
1512
|
-
content: getRespMsg(rest, 'vxe.grid.operError'),
|
|
1599
|
+
if (sSuccessMethod) {
|
|
1600
|
+
sSuccessMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1601
|
+
response: rest
|
|
1602
|
+
}));
|
|
1603
|
+
}
|
|
1604
|
+
return {
|
|
1605
|
+
status: true
|
|
1606
|
+
};
|
|
1607
|
+
}).catch(rest => {
|
|
1608
|
+
reactData.tableLoading = false;
|
|
1609
|
+
if (aSaveMethod) {
|
|
1610
|
+
aSaveMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1611
|
+
response: rest,
|
|
1513
1612
|
status: 'error'
|
|
1514
|
-
});
|
|
1613
|
+
}), ...args);
|
|
1614
|
+
} else {
|
|
1615
|
+
if (isRespMsg) {
|
|
1616
|
+
if (_ui.VxeUI.modal) {
|
|
1617
|
+
_ui.VxeUI.modal.message({
|
|
1618
|
+
id: code,
|
|
1619
|
+
content: getRespMsg(rest, 'vxe.grid.operError'),
|
|
1620
|
+
status: 'error'
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1515
1624
|
}
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
};
|
|
1525
|
-
}
|
|
1625
|
+
if (sErrorMethod) {
|
|
1626
|
+
sErrorMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1627
|
+
response: rest
|
|
1628
|
+
}));
|
|
1629
|
+
}
|
|
1630
|
+
return {
|
|
1631
|
+
status: false
|
|
1632
|
+
};
|
|
1633
|
+
});
|
|
1634
|
+
};
|
|
1635
|
+
if (bSaveMethod) {
|
|
1636
|
+
return Promise.resolve(bSaveMethod(commitParams, ...args)).then(status => {
|
|
1637
|
+
if (status !== false) {
|
|
1638
|
+
return handleSave();
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
return handleSave();
|
|
1526
1643
|
} else {
|
|
1527
1644
|
if (isActiveMsg) {
|
|
1528
1645
|
if (_ui.VxeUI.modal) {
|