vxe-gantt 3.6.4 → 3.6.6
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/es/gantt/src/gantt.js +273 -186
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/gantt.js +353 -246
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +424 -314
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/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/package.json +3 -3
- package/packages/gantt/src/gantt.ts +262 -178
- package/styles/theme/base.scss +1 -1
package/es/gantt/src/gantt.js
CHANGED
|
@@ -1043,9 +1043,9 @@ export default {
|
|
|
1043
1043
|
return $xeGantt.$refs.refElem;
|
|
1044
1044
|
},
|
|
1045
1045
|
/**
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1046
|
+
* 提交指令,支持 code 或 button
|
|
1047
|
+
* @param {String/Object} code 字符串或对象
|
|
1048
|
+
*/
|
|
1049
1049
|
commitProxy(proxyTarget, ...args) {
|
|
1050
1050
|
const $xeGantt = this;
|
|
1051
1051
|
const props = $xeGantt;
|
|
@@ -1063,7 +1063,7 @@ export default {
|
|
|
1063
1063
|
const proxyOpts = $xeGantt.computeProxyOpts;
|
|
1064
1064
|
const pagerOpts = $xeGantt.computePagerOpts;
|
|
1065
1065
|
const toolbarOpts = $xeGantt.computeToolbarOpts;
|
|
1066
|
-
const { beforeQuery, afterQuery, beforeQueryFooter, afterQueryFooter, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts;
|
|
1066
|
+
const { beforeQuery: oldBeforeQuery, afterQuery: oldAfterQuery, beforeQueryFooter: oldBeforeQueryFooter, afterQueryFooter: oldAfterQueryFooter, beforeDelete: oldBeforeDelete, afterDelete: oldAfterDelete, beforeSave: oldBeforeSave, afterSave: oldAfterSave, ajax = {} } = proxyOpts;
|
|
1067
1067
|
const resConfigs = (proxyOpts.response || proxyOpts.props || {});
|
|
1068
1068
|
const $xeTable = $xeGantt.$refs.refTable;
|
|
1069
1069
|
let formData = $xeGantt.getFormData();
|
|
@@ -1112,10 +1112,12 @@ export default {
|
|
|
1112
1112
|
case 'initial':
|
|
1113
1113
|
case 'reload':
|
|
1114
1114
|
case 'query': {
|
|
1115
|
-
const
|
|
1116
|
-
const
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1115
|
+
const bqMethod = ajax.beforeQuery;
|
|
1116
|
+
const qMethod = ajax.query;
|
|
1117
|
+
const aqMethod = ajax.afterQuery;
|
|
1118
|
+
const qsMethod = ajax.querySuccess;
|
|
1119
|
+
const qeMethod = ajax.queryError;
|
|
1120
|
+
if (qMethod) {
|
|
1119
1121
|
const isInited = code === 'initial';
|
|
1120
1122
|
const isReload = code === 'reload';
|
|
1121
1123
|
if (!isInited && reactData.tableLoading) {
|
|
@@ -1127,10 +1129,9 @@ export default {
|
|
|
1127
1129
|
let pageParams = {};
|
|
1128
1130
|
if (pagerConfig) {
|
|
1129
1131
|
if (isInited || isReload) {
|
|
1130
|
-
// 重置分页
|
|
1131
1132
|
tablePage.currentPage = 1;
|
|
1132
1133
|
}
|
|
1133
|
-
if (isEnableConf(
|
|
1134
|
+
if (isEnableConf(pagerConfig)) {
|
|
1134
1135
|
pageParams = Object.assign({}, tablePage);
|
|
1135
1136
|
}
|
|
1136
1137
|
}
|
|
@@ -1196,73 +1197,91 @@ export default {
|
|
|
1196
1197
|
sorts: sortList,
|
|
1197
1198
|
filters: filterList,
|
|
1198
1199
|
form: formData,
|
|
1199
|
-
options:
|
|
1200
|
+
options: qMethod
|
|
1200
1201
|
};
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
Promise.
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1213
|
-
const totalProp = resConfigs.total;
|
|
1214
|
-
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
|
|
1215
|
-
tablePage.total = XEUtils.toNumber(total);
|
|
1216
|
-
const resultProp = resConfigs.result;
|
|
1217
|
-
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || [];
|
|
1218
|
-
// 检验当前页码,不能超出当前最大页数
|
|
1219
|
-
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
1220
|
-
if (tablePage.currentPage > pageCount) {
|
|
1221
|
-
tablePage.currentPage = pageCount;
|
|
1222
|
-
}
|
|
1202
|
+
const handleQuery = () => {
|
|
1203
|
+
reactData.sortData = sortList;
|
|
1204
|
+
reactData.filterData = filterList;
|
|
1205
|
+
reactData.tableLoading = true;
|
|
1206
|
+
return Promise.all([
|
|
1207
|
+
Promise.resolve((oldBeforeQuery || qMethod)(commitParams, ...args)),
|
|
1208
|
+
operPromise
|
|
1209
|
+
]).then(([rest]) => {
|
|
1210
|
+
reactData.tableLoading = false;
|
|
1211
|
+
if (aqMethod) {
|
|
1212
|
+
aqMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
|
|
1223
1213
|
}
|
|
1224
1214
|
else {
|
|
1225
|
-
|
|
1226
|
-
if (
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1215
|
+
let tableData = [];
|
|
1216
|
+
if (rest) {
|
|
1217
|
+
const reParams = { data: rest, $grid: null, $table: $xeTable, $gantt: $xeGantt };
|
|
1218
|
+
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1219
|
+
const totalProp = resConfigs.total;
|
|
1220
|
+
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
|
|
1221
|
+
tablePage.total = XEUtils.toNumber(total);
|
|
1222
|
+
const resultProp = resConfigs.result;
|
|
1223
|
+
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || [];
|
|
1224
|
+
// 检验当前页码,不能超出当前最大页数
|
|
1225
|
+
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
1226
|
+
if (tablePage.currentPage > pageCount) {
|
|
1227
|
+
tablePage.currentPage = pageCount;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
else {
|
|
1231
|
+
const listProp = resConfigs.list;
|
|
1232
|
+
if (XEUtils.isArray(rest)) {
|
|
1233
|
+
tableData = rest;
|
|
1234
|
+
}
|
|
1235
|
+
else if (listProp) {
|
|
1236
|
+
tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || [];
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (showFooter) {
|
|
1240
|
+
const fdProp = resConfigs.footerData;
|
|
1241
|
+
const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : [];
|
|
1242
|
+
if (XEUtils.isArray(footerList)) {
|
|
1243
|
+
reactData.footerData = footerList;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1238
1246
|
}
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
if ($xeTable) {
|
|
1242
|
-
$xeTable.loadData(tableData);
|
|
1243
|
-
}
|
|
1244
|
-
else {
|
|
1245
|
-
$xeGantt.$nextTick(() => {
|
|
1246
|
-
const $xeTable = $xeGantt.$refs.refTable;
|
|
1247
1247
|
if ($xeTable) {
|
|
1248
1248
|
$xeTable.loadData(tableData);
|
|
1249
1249
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1250
|
+
else {
|
|
1251
|
+
$xeGantt.$nextTick(() => {
|
|
1252
|
+
const $xeTable = $xeGantt.$refs.refTable;
|
|
1253
|
+
if ($xeTable) {
|
|
1254
|
+
$xeTable.loadData(tableData);
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
if (oldAfterQuery) {
|
|
1259
|
+
oldAfterQuery(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
if (qsMethod) {
|
|
1263
|
+
qsMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1264
|
+
}
|
|
1265
|
+
return { status: true };
|
|
1266
|
+
}).catch((rest) => {
|
|
1267
|
+
reactData.tableLoading = false;
|
|
1268
|
+
if (aqMethod) {
|
|
1269
|
+
aqMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
|
|
1270
|
+
}
|
|
1271
|
+
if (qeMethod) {
|
|
1272
|
+
qeMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1273
|
+
}
|
|
1274
|
+
return { status: false };
|
|
1275
|
+
});
|
|
1276
|
+
};
|
|
1277
|
+
if (bqMethod) {
|
|
1278
|
+
return Promise.resolve(bqMethod(commitParams, ...args)).then(status => {
|
|
1279
|
+
if (status !== false) {
|
|
1280
|
+
return handleQuery();
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
return handleQuery();
|
|
1266
1285
|
}
|
|
1267
1286
|
else {
|
|
1268
1287
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
|
|
@@ -1270,39 +1289,66 @@ export default {
|
|
|
1270
1289
|
break;
|
|
1271
1290
|
}
|
|
1272
1291
|
case 'queryFooter': {
|
|
1273
|
-
const
|
|
1274
|
-
const
|
|
1275
|
-
const
|
|
1276
|
-
|
|
1292
|
+
const bqfMethod = ajax.beforeQueryFooter;
|
|
1293
|
+
const qfMethod = ajax.queryFooter;
|
|
1294
|
+
const aqfMethod = ajax.afterQueryFooter;
|
|
1295
|
+
const qfSuccessMethod = ajax.queryFooterSuccess;
|
|
1296
|
+
const qfErrorMethod = ajax.queryFooterError;
|
|
1297
|
+
if (qfMethod) {
|
|
1277
1298
|
let filterList = [];
|
|
1278
1299
|
if ($xeTable) {
|
|
1279
1300
|
filterList = $xeTable.getCheckedFilters();
|
|
1280
1301
|
}
|
|
1302
|
+
let pageParams = {};
|
|
1303
|
+
if (pagerConfig) {
|
|
1304
|
+
if (isEnableConf(pagerConfig)) {
|
|
1305
|
+
pageParams = Object.assign({}, tablePage);
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1281
1308
|
const commitParams = {
|
|
1282
1309
|
$table: $xeTable,
|
|
1283
1310
|
$grid: null,
|
|
1284
1311
|
$gantt: $xeGantt,
|
|
1285
1312
|
code,
|
|
1286
1313
|
button,
|
|
1314
|
+
page: pageParams,
|
|
1287
1315
|
filters: filterList,
|
|
1288
1316
|
form: formData,
|
|
1289
|
-
options:
|
|
1317
|
+
options: qfMethod
|
|
1290
1318
|
};
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1319
|
+
const handleQueryFooter = () => {
|
|
1320
|
+
return Promise.resolve((oldBeforeQueryFooter || qfMethod)(commitParams, ...args)).then(rest => {
|
|
1321
|
+
if (aqfMethod) {
|
|
1322
|
+
aqfMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
|
|
1323
|
+
}
|
|
1324
|
+
else {
|
|
1325
|
+
reactData.footerData = XEUtils.isArray(rest) ? rest : [];
|
|
1326
|
+
if (oldAfterQueryFooter) {
|
|
1327
|
+
oldAfterQueryFooter(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
if (qfSuccessMethod) {
|
|
1331
|
+
qfSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1332
|
+
}
|
|
1333
|
+
return { status: true };
|
|
1334
|
+
}).catch((rest) => {
|
|
1335
|
+
if (aqfMethod) {
|
|
1336
|
+
aqfMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
|
|
1337
|
+
}
|
|
1338
|
+
if (qfErrorMethod) {
|
|
1339
|
+
qfErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1340
|
+
}
|
|
1341
|
+
return { status: false };
|
|
1342
|
+
});
|
|
1343
|
+
};
|
|
1344
|
+
if (bqfMethod) {
|
|
1345
|
+
return Promise.resolve(bqfMethod(commitParams, ...args)).then(status => {
|
|
1346
|
+
if (status !== false) {
|
|
1347
|
+
return handleQueryFooter();
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
handleQueryFooter();
|
|
1306
1352
|
}
|
|
1307
1353
|
else {
|
|
1308
1354
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter']);
|
|
@@ -1310,10 +1356,12 @@ export default {
|
|
|
1310
1356
|
break;
|
|
1311
1357
|
}
|
|
1312
1358
|
case 'delete': {
|
|
1313
|
-
const
|
|
1314
|
-
const
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1359
|
+
const bdMethod = ajax.beforeDelete;
|
|
1360
|
+
const dMethod = ajax.delete;
|
|
1361
|
+
const adMethod = ajax.afterDelete;
|
|
1362
|
+
const deleteSuccessMethod = ajax.deleteSuccess;
|
|
1363
|
+
const deleteErrorMethod = ajax.deleteError;
|
|
1364
|
+
if (dMethod) {
|
|
1317
1365
|
const selectRecords = $xeTable.getCheckboxRecords();
|
|
1318
1366
|
const removeRecords = selectRecords.filter((row) => !$xeTable.isInsertByRow(row));
|
|
1319
1367
|
const body = { removeRecords };
|
|
@@ -1325,63 +1373,76 @@ export default {
|
|
|
1325
1373
|
button,
|
|
1326
1374
|
body,
|
|
1327
1375
|
form: formData,
|
|
1328
|
-
options:
|
|
1376
|
+
options: dMethod
|
|
1329
1377
|
};
|
|
1330
|
-
const applyArgs = [commitParams].concat(args);
|
|
1331
1378
|
if (selectRecords.length) {
|
|
1332
1379
|
return $xeGantt.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
1333
1380
|
if (!removeRecords.length) {
|
|
1334
1381
|
return $xeTable.remove(selectRecords);
|
|
1335
1382
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
.
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
if (!VxeUI.modal) {
|
|
1344
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
1383
|
+
const handleDelete = () => {
|
|
1384
|
+
reactData.tableLoading = true;
|
|
1385
|
+
return Promise.resolve((oldBeforeDelete || dMethod)(commitParams, ...args))
|
|
1386
|
+
.then(rest => {
|
|
1387
|
+
reactData.tableLoading = false;
|
|
1388
|
+
if (adMethod) {
|
|
1389
|
+
adMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
|
|
1345
1390
|
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
.catch(rest => {
|
|
1363
|
-
reactData.tableLoading = false;
|
|
1364
|
-
if (isRespMsg) {
|
|
1365
|
-
// 检测弹窗模块
|
|
1366
|
-
if (!VxeUI.modal) {
|
|
1367
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
1391
|
+
else {
|
|
1392
|
+
$xeTable.setPendingRow(removeRecords, false);
|
|
1393
|
+
if (isRespMsg) {
|
|
1394
|
+
if (VxeUI.modal) {
|
|
1395
|
+
VxeUI.modal.message({ content: $xeGantt.getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' });
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
if (oldAfterDelete) {
|
|
1399
|
+
oldAfterDelete(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
|
|
1400
|
+
}
|
|
1401
|
+
else {
|
|
1402
|
+
internalData.uFoot = true;
|
|
1403
|
+
$xeGantt.commitProxy('query');
|
|
1404
|
+
internalData.uFoot = false;
|
|
1405
|
+
$xeGantt.updateQueryFooter();
|
|
1406
|
+
}
|
|
1368
1407
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1408
|
+
if (deleteSuccessMethod) {
|
|
1409
|
+
deleteSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1410
|
+
}
|
|
1411
|
+
return { status: true };
|
|
1412
|
+
})
|
|
1413
|
+
.catch(rest => {
|
|
1414
|
+
reactData.tableLoading = false;
|
|
1415
|
+
if (adMethod) {
|
|
1416
|
+
adMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
|
|
1417
|
+
}
|
|
1418
|
+
else {
|
|
1419
|
+
if (isRespMsg) {
|
|
1420
|
+
if (VxeUI.modal) {
|
|
1421
|
+
VxeUI.modal.message({ id: code, content: $xeGantt.getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
if (deleteErrorMethod) {
|
|
1426
|
+
deleteErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1427
|
+
}
|
|
1428
|
+
return { status: false };
|
|
1429
|
+
});
|
|
1430
|
+
};
|
|
1431
|
+
if (bdMethod) {
|
|
1432
|
+
return Promise.resolve(bdMethod(commitParams, ...args)).then(status => {
|
|
1433
|
+
if (status !== false) {
|
|
1434
|
+
return handleDelete();
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
return handleDelete();
|
|
1376
1439
|
});
|
|
1377
1440
|
}
|
|
1378
1441
|
else {
|
|
1379
1442
|
if (isActiveMsg) {
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
1443
|
+
if (VxeUI.modal) {
|
|
1444
|
+
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.selectOneRecord'), status: 'warning' });
|
|
1383
1445
|
}
|
|
1384
|
-
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.selectOneRecord'), status: 'warning' });
|
|
1385
1446
|
}
|
|
1386
1447
|
}
|
|
1387
1448
|
}
|
|
@@ -1391,10 +1452,12 @@ export default {
|
|
|
1391
1452
|
break;
|
|
1392
1453
|
}
|
|
1393
1454
|
case 'save': {
|
|
1394
|
-
const
|
|
1395
|
-
const
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1455
|
+
const bSaveMethod = ajax.beforeSave;
|
|
1456
|
+
const sMethod = ajax.save;
|
|
1457
|
+
const aSaveMethod = ajax.afterSave;
|
|
1458
|
+
const sSuccessMethod = ajax.saveSuccess;
|
|
1459
|
+
const sErrorMethod = ajax.saveError;
|
|
1460
|
+
if (sMethod) {
|
|
1398
1461
|
const body = $xeGantt.getRecordset();
|
|
1399
1462
|
const { insertRecords, removeRecords, updateRecords, pendingRecords } = body;
|
|
1400
1463
|
const commitParams = {
|
|
@@ -1405,9 +1468,8 @@ export default {
|
|
|
1405
1468
|
button,
|
|
1406
1469
|
body,
|
|
1407
1470
|
form: formData,
|
|
1408
|
-
options:
|
|
1471
|
+
options: sMethod
|
|
1409
1472
|
};
|
|
1410
|
-
const applyArgs = [commitParams].concat(args);
|
|
1411
1473
|
// 排除掉新增且标记为删除的数据
|
|
1412
1474
|
if (insertRecords.length) {
|
|
1413
1475
|
body.pendingRecords = pendingRecords.filter((row) => insertRecords.indexOf(row) === -1);
|
|
@@ -1427,54 +1489,65 @@ export default {
|
|
|
1427
1489
|
return;
|
|
1428
1490
|
}
|
|
1429
1491
|
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
.
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1492
|
+
const handleSave = () => {
|
|
1493
|
+
reactData.tableLoading = true;
|
|
1494
|
+
return Promise.resolve((oldBeforeSave || sMethod)(commitParams, ...args))
|
|
1495
|
+
.then(rest => {
|
|
1496
|
+
reactData.tableLoading = false;
|
|
1497
|
+
if (aSaveMethod) {
|
|
1498
|
+
$xeTable.clearPendingRow();
|
|
1499
|
+
if (isRespMsg) {
|
|
1500
|
+
if (VxeUI.modal) {
|
|
1501
|
+
VxeUI.modal.message({ content: $xeGantt.getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' });
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
if (oldAfterSave) {
|
|
1505
|
+
oldAfterSave(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
|
|
1506
|
+
}
|
|
1507
|
+
else {
|
|
1508
|
+
internalData.uFoot = true;
|
|
1509
|
+
$xeGantt.commitProxy('query');
|
|
1510
|
+
internalData.uFoot = false;
|
|
1511
|
+
$xeGantt.updateQueryFooter();
|
|
1512
|
+
}
|
|
1439
1513
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
if (afterSave) {
|
|
1443
|
-
afterSave(...applyArgs);
|
|
1444
|
-
}
|
|
1445
|
-
else {
|
|
1446
|
-
internalData.uFoot = true;
|
|
1447
|
-
$xeGantt.commitProxy('query');
|
|
1448
|
-
internalData.uFoot = false;
|
|
1449
|
-
$xeGantt.updateQueryFooter();
|
|
1450
|
-
}
|
|
1451
|
-
if (saveSuccessMethods) {
|
|
1452
|
-
saveSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1453
|
-
}
|
|
1454
|
-
return { status: true };
|
|
1455
|
-
})
|
|
1456
|
-
.catch(rest => {
|
|
1457
|
-
reactData.tableLoading = false;
|
|
1458
|
-
if (isRespMsg) {
|
|
1459
|
-
// 检测弹窗模块
|
|
1460
|
-
if (!VxeUI.modal) {
|
|
1461
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
1514
|
+
if (sSuccessMethod) {
|
|
1515
|
+
sSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1462
1516
|
}
|
|
1463
|
-
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1517
|
+
return { status: true };
|
|
1518
|
+
})
|
|
1519
|
+
.catch(rest => {
|
|
1520
|
+
reactData.tableLoading = false;
|
|
1521
|
+
if (aSaveMethod) {
|
|
1522
|
+
aSaveMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
|
|
1523
|
+
}
|
|
1524
|
+
else {
|
|
1525
|
+
if (isRespMsg) {
|
|
1526
|
+
if (VxeUI.modal) {
|
|
1527
|
+
VxeUI.modal.message({ id: code, content: $xeGantt.getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
if (sErrorMethod) {
|
|
1532
|
+
sErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1533
|
+
}
|
|
1534
|
+
return { status: false };
|
|
1535
|
+
});
|
|
1536
|
+
};
|
|
1537
|
+
if (bSaveMethod) {
|
|
1538
|
+
return Promise.resolve(bSaveMethod(commitParams, ...args)).then(status => {
|
|
1539
|
+
if (status !== false) {
|
|
1540
|
+
return handleSave();
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
return handleSave();
|
|
1470
1545
|
}
|
|
1471
1546
|
else {
|
|
1472
1547
|
if (isActiveMsg) {
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
errLog('vxe.error.reqModule', ['Modal']);
|
|
1548
|
+
if (VxeUI.modal) {
|
|
1549
|
+
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.dataUnchanged'), status: 'info' });
|
|
1476
1550
|
}
|
|
1477
|
-
VxeUI.modal.message({ id: code, content: getI18n('vxe.grid.dataUnchanged'), status: 'info' });
|
|
1478
1551
|
}
|
|
1479
1552
|
}
|
|
1480
1553
|
});
|
|
@@ -1668,6 +1741,20 @@ export default {
|
|
|
1668
1741
|
}
|
|
1669
1742
|
return null;
|
|
1670
1743
|
},
|
|
1744
|
+
getCustomPagerData() {
|
|
1745
|
+
const $xeGrid = this;
|
|
1746
|
+
const props = $xeGrid;
|
|
1747
|
+
const reactData = $xeGrid.reactData;
|
|
1748
|
+
const { pagerConfig } = props;
|
|
1749
|
+
const { tablePage } = reactData;
|
|
1750
|
+
const pagerOpts = $xeGrid.computePagerOpts;
|
|
1751
|
+
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1752
|
+
return {
|
|
1753
|
+
pSize: tablePage.pageSize
|
|
1754
|
+
};
|
|
1755
|
+
}
|
|
1756
|
+
return {};
|
|
1757
|
+
},
|
|
1671
1758
|
refreshTaskView() {
|
|
1672
1759
|
const $xeGantt = this;
|
|
1673
1760
|
const $ganttView = $xeGantt.$refs.refGanttView;
|