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/es/grid/src/grid.js
CHANGED
|
@@ -899,7 +899,7 @@ export default defineVxeComponent({
|
|
|
899
899
|
const proxyOpts = computeProxyOpts.value;
|
|
900
900
|
const pagerOpts = computePagerOpts.value;
|
|
901
901
|
const toolbarOpts = computeToolbarOpts.value;
|
|
902
|
-
const { beforeQuery, afterQuery, beforeQueryFooter, afterQueryFooter, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts;
|
|
902
|
+
const { beforeQuery: oldBeforeQuery, afterQuery: oldAfterQuery, beforeQueryFooter: oldBeforeQueryFooter, afterQueryFooter: oldAfterQueryFooter, beforeDelete: oldBeforeDelete, afterDelete: oldAfterDelete, beforeSave: oldBeforeSave, afterSave: oldAfterSave, ajax = {} } = proxyOpts;
|
|
903
903
|
const resConfigs = (proxyOpts.response || proxyOpts.props || {});
|
|
904
904
|
const $xeTable = refTable.value;
|
|
905
905
|
if (!$xeTable) {
|
|
@@ -950,10 +950,12 @@ export default defineVxeComponent({
|
|
|
950
950
|
case 'initial':
|
|
951
951
|
case 'reload':
|
|
952
952
|
case 'query': {
|
|
953
|
-
const
|
|
954
|
-
const
|
|
955
|
-
const
|
|
956
|
-
|
|
953
|
+
const bqMethod = ajax.beforeQuery;
|
|
954
|
+
const qMethod = ajax.query;
|
|
955
|
+
const aqMethod = ajax.afterQuery;
|
|
956
|
+
const qsMethod = ajax.querySuccess;
|
|
957
|
+
const qeMethod = ajax.queryError;
|
|
958
|
+
if (qMethod) {
|
|
957
959
|
const isInited = code === 'initial';
|
|
958
960
|
const isReload = code === 'reload';
|
|
959
961
|
if (!isInited && reactData.tableLoading) {
|
|
@@ -1035,73 +1037,91 @@ export default defineVxeComponent({
|
|
|
1035
1037
|
sorts: sortList,
|
|
1036
1038
|
filters: filterList,
|
|
1037
1039
|
form: formData,
|
|
1038
|
-
options:
|
|
1040
|
+
options: qMethod
|
|
1039
1041
|
};
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
Promise.
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1052
|
-
const totalProp = resConfigs.total;
|
|
1053
|
-
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
|
|
1054
|
-
tablePage.total = XEUtils.toNumber(total);
|
|
1055
|
-
const resultProp = resConfigs.result;
|
|
1056
|
-
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || [];
|
|
1057
|
-
// 检验当前页码,不能超出当前最大页数
|
|
1058
|
-
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
1059
|
-
if (tablePage.currentPage > pageCount) {
|
|
1060
|
-
tablePage.currentPage = pageCount;
|
|
1061
|
-
}
|
|
1042
|
+
const handleQuery = () => {
|
|
1043
|
+
reactData.sortData = sortList;
|
|
1044
|
+
reactData.filterData = filterList;
|
|
1045
|
+
reactData.tableLoading = true;
|
|
1046
|
+
return Promise.all([
|
|
1047
|
+
Promise.resolve((oldBeforeQuery || qMethod)(commitParams, ...args)),
|
|
1048
|
+
operPromise
|
|
1049
|
+
]).then(([rest]) => {
|
|
1050
|
+
reactData.tableLoading = false;
|
|
1051
|
+
if (aqMethod) {
|
|
1052
|
+
aqMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
|
|
1062
1053
|
}
|
|
1063
1054
|
else {
|
|
1064
|
-
|
|
1065
|
-
if (
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1055
|
+
let tableData = [];
|
|
1056
|
+
if (rest) {
|
|
1057
|
+
const reParams = { data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null };
|
|
1058
|
+
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1059
|
+
const totalProp = resConfigs.total;
|
|
1060
|
+
const total = (XEUtils.isFunction(totalProp) ? totalProp(reParams) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
|
|
1061
|
+
tablePage.total = XEUtils.toNumber(total);
|
|
1062
|
+
const resultProp = resConfigs.result;
|
|
1063
|
+
tableData = (XEUtils.isFunction(resultProp) ? resultProp(reParams) : XEUtils.get(rest, resultProp || 'result')) || [];
|
|
1064
|
+
// 检验当前页码,不能超出当前最大页数
|
|
1065
|
+
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
1066
|
+
if (tablePage.currentPage > pageCount) {
|
|
1067
|
+
tablePage.currentPage = pageCount;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
else {
|
|
1071
|
+
const listProp = resConfigs.list;
|
|
1072
|
+
if (XEUtils.isArray(rest)) {
|
|
1073
|
+
tableData = rest;
|
|
1074
|
+
}
|
|
1075
|
+
else if (listProp) {
|
|
1076
|
+
tableData = (XEUtils.isFunction(listProp) ? listProp(reParams) : XEUtils.get(rest, listProp)) || [];
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
if (showFooter) {
|
|
1080
|
+
const fdProp = resConfigs.footerData;
|
|
1081
|
+
const footerList = fdProp ? (XEUtils.isFunction(fdProp) ? fdProp(reParams) : XEUtils.get(rest, fdProp)) : [];
|
|
1082
|
+
if (XEUtils.isArray(footerList)) {
|
|
1083
|
+
reactData.footerData = footerList;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1077
1086
|
}
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
if ($xeTable) {
|
|
1081
|
-
$xeTable.loadData(tableData);
|
|
1082
|
-
}
|
|
1083
|
-
else {
|
|
1084
|
-
nextTick(() => {
|
|
1085
|
-
const $xeTable = refTable.value;
|
|
1086
1087
|
if ($xeTable) {
|
|
1087
1088
|
$xeTable.loadData(tableData);
|
|
1088
1089
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1090
|
+
else {
|
|
1091
|
+
nextTick(() => {
|
|
1092
|
+
const $xeTable = refTable.value;
|
|
1093
|
+
if ($xeTable) {
|
|
1094
|
+
$xeTable.loadData(tableData);
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
if (oldAfterQuery) {
|
|
1099
|
+
oldAfterQuery(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
if (qsMethod) {
|
|
1103
|
+
qsMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1104
|
+
}
|
|
1105
|
+
return { status: true };
|
|
1106
|
+
}).catch((rest) => {
|
|
1107
|
+
reactData.tableLoading = false;
|
|
1108
|
+
if (aqMethod) {
|
|
1109
|
+
aqMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
|
|
1110
|
+
}
|
|
1111
|
+
if (qeMethod) {
|
|
1112
|
+
qeMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1113
|
+
}
|
|
1114
|
+
return { status: false };
|
|
1115
|
+
});
|
|
1116
|
+
};
|
|
1117
|
+
if (bqMethod) {
|
|
1118
|
+
return Promise.resolve(bqMethod(commitParams, ...args)).then(status => {
|
|
1119
|
+
if (status !== false) {
|
|
1120
|
+
return handleQuery();
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
return handleQuery();
|
|
1105
1125
|
}
|
|
1106
1126
|
else {
|
|
1107
1127
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
|
|
@@ -1109,39 +1129,66 @@ export default defineVxeComponent({
|
|
|
1109
1129
|
break;
|
|
1110
1130
|
}
|
|
1111
1131
|
case 'queryFooter': {
|
|
1112
|
-
const
|
|
1113
|
-
const
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1132
|
+
const bqfMethod = ajax.beforeQueryFooter;
|
|
1133
|
+
const qfMethod = ajax.queryFooter;
|
|
1134
|
+
const aqfMethod = ajax.afterQueryFooter;
|
|
1135
|
+
const qfSuccessMethod = ajax.queryFooterSuccess;
|
|
1136
|
+
const qfErrorMethod = ajax.queryFooterError;
|
|
1137
|
+
if (qfMethod) {
|
|
1116
1138
|
let filterList = [];
|
|
1117
1139
|
if ($xeTable) {
|
|
1118
1140
|
filterList = $xeTable.getCheckedFilters();
|
|
1119
1141
|
}
|
|
1142
|
+
let pageParams = {};
|
|
1143
|
+
if (pagerConfig) {
|
|
1144
|
+
if (isEnableConf(pagerOpts)) {
|
|
1145
|
+
pageParams = Object.assign({}, tablePage);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1120
1148
|
const commitParams = {
|
|
1121
1149
|
$table: $xeTable,
|
|
1122
1150
|
$grid: $xeGrid,
|
|
1123
1151
|
$gantt: null,
|
|
1124
1152
|
code,
|
|
1125
1153
|
button,
|
|
1154
|
+
page: pageParams,
|
|
1126
1155
|
filters: filterList,
|
|
1127
1156
|
form: formData,
|
|
1128
|
-
options:
|
|
1157
|
+
options: qfMethod
|
|
1129
1158
|
};
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1159
|
+
const handleQueryFooter = () => {
|
|
1160
|
+
return Promise.resolve((oldBeforeQueryFooter || qfMethod)(commitParams, ...args)).then(rest => {
|
|
1161
|
+
if (aqfMethod) {
|
|
1162
|
+
aqfMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
|
|
1163
|
+
}
|
|
1164
|
+
else {
|
|
1165
|
+
reactData.footerData = XEUtils.isArray(rest) ? rest : [];
|
|
1166
|
+
if (oldAfterQueryFooter) {
|
|
1167
|
+
oldAfterQueryFooter(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
if (qfSuccessMethod) {
|
|
1171
|
+
qfSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1172
|
+
}
|
|
1173
|
+
return { status: true };
|
|
1174
|
+
}).catch((rest) => {
|
|
1175
|
+
if (aqfMethod) {
|
|
1176
|
+
aqfMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
|
|
1177
|
+
}
|
|
1178
|
+
if (qfErrorMethod) {
|
|
1179
|
+
qfErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1180
|
+
}
|
|
1181
|
+
return { status: false };
|
|
1182
|
+
});
|
|
1183
|
+
};
|
|
1184
|
+
if (bqfMethod) {
|
|
1185
|
+
return Promise.resolve(bqfMethod(commitParams, ...args)).then(status => {
|
|
1186
|
+
if (status !== false) {
|
|
1187
|
+
return handleQueryFooter();
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
return handleQueryFooter();
|
|
1145
1192
|
}
|
|
1146
1193
|
else {
|
|
1147
1194
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter']);
|
|
@@ -1149,10 +1196,12 @@ export default defineVxeComponent({
|
|
|
1149
1196
|
break;
|
|
1150
1197
|
}
|
|
1151
1198
|
case 'delete': {
|
|
1152
|
-
const
|
|
1199
|
+
const bdMethod = ajax.beforeDelete;
|
|
1200
|
+
const dMethod = ajax.delete;
|
|
1201
|
+
const adMethod = ajax.afterDelete;
|
|
1153
1202
|
const deleteSuccessMethods = ajax.deleteSuccess;
|
|
1154
1203
|
const deleteErrorMethods = ajax.deleteError;
|
|
1155
|
-
if (
|
|
1204
|
+
if (dMethod) {
|
|
1156
1205
|
const selectRecords = $xeGrid.getCheckboxRecords();
|
|
1157
1206
|
const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row));
|
|
1158
1207
|
const body = { removeRecords };
|
|
@@ -1164,49 +1213,69 @@ export default defineVxeComponent({
|
|
|
1164
1213
|
button,
|
|
1165
1214
|
body,
|
|
1166
1215
|
form: formData,
|
|
1167
|
-
options:
|
|
1216
|
+
options: dMethod
|
|
1168
1217
|
};
|
|
1169
1218
|
if (selectRecords.length) {
|
|
1170
1219
|
return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
1171
1220
|
if (!removeRecords.length) {
|
|
1172
1221
|
return $xeTable.remove(selectRecords);
|
|
1173
1222
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
.
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' });
|
|
1223
|
+
const handleDelete = () => {
|
|
1224
|
+
reactData.tableLoading = true;
|
|
1225
|
+
return Promise.resolve((oldBeforeDelete || dMethod)(commitParams, ...args))
|
|
1226
|
+
.then(rest => {
|
|
1227
|
+
reactData.tableLoading = false;
|
|
1228
|
+
if (adMethod) {
|
|
1229
|
+
adMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
|
|
1182
1230
|
}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
reactData.tableLoading = false;
|
|
1200
|
-
if (isRespMsg) {
|
|
1201
|
-
if (VxeUI.modal) {
|
|
1202
|
-
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
|
|
1231
|
+
else {
|
|
1232
|
+
$xeTable.setPendingRow(removeRecords, false);
|
|
1233
|
+
if (isRespMsg) {
|
|
1234
|
+
if (VxeUI.modal) {
|
|
1235
|
+
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.delSuccess'), status: 'success' });
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
if (oldAfterDelete) {
|
|
1239
|
+
oldAfterDelete(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
|
|
1240
|
+
}
|
|
1241
|
+
else {
|
|
1242
|
+
internalData.uFoot = true;
|
|
1243
|
+
$xeGrid.commitProxy('query');
|
|
1244
|
+
internalData.uFoot = false;
|
|
1245
|
+
updateQueryFooter();
|
|
1246
|
+
}
|
|
1203
1247
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1248
|
+
if (deleteSuccessMethods) {
|
|
1249
|
+
deleteSuccessMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1250
|
+
}
|
|
1251
|
+
return { status: true };
|
|
1252
|
+
})
|
|
1253
|
+
.catch(rest => {
|
|
1254
|
+
reactData.tableLoading = false;
|
|
1255
|
+
if (adMethod) {
|
|
1256
|
+
adMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
|
|
1257
|
+
}
|
|
1258
|
+
else {
|
|
1259
|
+
if (isRespMsg) {
|
|
1260
|
+
if (VxeUI.modal) {
|
|
1261
|
+
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
if (deleteErrorMethods) {
|
|
1266
|
+
deleteErrorMethods(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1267
|
+
}
|
|
1268
|
+
return { status: false };
|
|
1269
|
+
});
|
|
1270
|
+
};
|
|
1271
|
+
if (bdMethod) {
|
|
1272
|
+
return Promise.resolve(bdMethod(commitParams, ...args)).then(status => {
|
|
1273
|
+
if (status !== false) {
|
|
1274
|
+
return handleDelete();
|
|
1275
|
+
}
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
return handleDelete();
|
|
1210
1279
|
});
|
|
1211
1280
|
}
|
|
1212
1281
|
else {
|
|
@@ -1223,10 +1292,12 @@ export default defineVxeComponent({
|
|
|
1223
1292
|
break;
|
|
1224
1293
|
}
|
|
1225
1294
|
case 'save': {
|
|
1226
|
-
const
|
|
1227
|
-
const
|
|
1228
|
-
const
|
|
1229
|
-
|
|
1295
|
+
const bSaveMethod = ajax.beforeSave;
|
|
1296
|
+
const sMethod = ajax.save;
|
|
1297
|
+
const aSaveMethod = ajax.afterSave;
|
|
1298
|
+
const sSuccessMethod = ajax.saveSuccess;
|
|
1299
|
+
const sErrorMethod = ajax.saveError;
|
|
1300
|
+
if (sMethod) {
|
|
1230
1301
|
const body = $xeTable.getRecordset();
|
|
1231
1302
|
const { insertRecords, removeRecords, updateRecords, pendingRecords } = body;
|
|
1232
1303
|
const commitParams = {
|
|
@@ -1237,7 +1308,7 @@ export default defineVxeComponent({
|
|
|
1237
1308
|
button,
|
|
1238
1309
|
body,
|
|
1239
1310
|
form: formData,
|
|
1240
|
-
options:
|
|
1311
|
+
options: sMethod
|
|
1241
1312
|
};
|
|
1242
1313
|
// 排除掉新增且标记为删除的数据
|
|
1243
1314
|
if (insertRecords.length) {
|
|
@@ -1258,42 +1329,62 @@ export default defineVxeComponent({
|
|
|
1258
1329
|
return;
|
|
1259
1330
|
}
|
|
1260
1331
|
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
.
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' });
|
|
1332
|
+
const handleSave = () => {
|
|
1333
|
+
reactData.tableLoading = true;
|
|
1334
|
+
return Promise.resolve((oldBeforeSave || sMethod)(commitParams, ...args))
|
|
1335
|
+
.then(rest => {
|
|
1336
|
+
reactData.tableLoading = false;
|
|
1337
|
+
if (aSaveMethod) {
|
|
1338
|
+
aSaveMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'success' }), ...args);
|
|
1269
1339
|
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
reactData.tableLoading = false;
|
|
1287
|
-
if (isRespMsg) {
|
|
1288
|
-
if (VxeUI.modal) {
|
|
1289
|
-
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
|
|
1340
|
+
else {
|
|
1341
|
+
$xeTable.clearPendingRow();
|
|
1342
|
+
if (isRespMsg) {
|
|
1343
|
+
if (VxeUI.modal) {
|
|
1344
|
+
VxeUI.modal.message({ content: getRespMsg(rest, 'vxe.grid.saveSuccess'), status: 'success' });
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
if (oldAfterSave) {
|
|
1348
|
+
oldAfterSave(Object.assign(Object.assign({}, commitParams), { response: rest }), ...args);
|
|
1349
|
+
}
|
|
1350
|
+
else {
|
|
1351
|
+
internalData.uFoot = true;
|
|
1352
|
+
$xeGrid.commitProxy('query');
|
|
1353
|
+
internalData.uFoot = false;
|
|
1354
|
+
updateQueryFooter();
|
|
1355
|
+
}
|
|
1290
1356
|
}
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1357
|
+
if (sSuccessMethod) {
|
|
1358
|
+
sSuccessMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1359
|
+
}
|
|
1360
|
+
return { status: true };
|
|
1361
|
+
})
|
|
1362
|
+
.catch(rest => {
|
|
1363
|
+
reactData.tableLoading = false;
|
|
1364
|
+
if (aSaveMethod) {
|
|
1365
|
+
aSaveMethod(Object.assign(Object.assign({}, commitParams), { response: rest, status: 'error' }), ...args);
|
|
1366
|
+
}
|
|
1367
|
+
else {
|
|
1368
|
+
if (isRespMsg) {
|
|
1369
|
+
if (VxeUI.modal) {
|
|
1370
|
+
VxeUI.modal.message({ id: code, content: getRespMsg(rest, 'vxe.grid.operError'), status: 'error' });
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
if (sErrorMethod) {
|
|
1375
|
+
sErrorMethod(Object.assign(Object.assign({}, commitParams), { response: rest }));
|
|
1376
|
+
}
|
|
1377
|
+
return { status: false };
|
|
1378
|
+
});
|
|
1379
|
+
};
|
|
1380
|
+
if (bSaveMethod) {
|
|
1381
|
+
return Promise.resolve(bSaveMethod(commitParams, ...args)).then(status => {
|
|
1382
|
+
if (status !== false) {
|
|
1383
|
+
return handleSave();
|
|
1384
|
+
}
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
return handleSave();
|
|
1297
1388
|
}
|
|
1298
1389
|
else {
|
|
1299
1390
|
if (isActiveMsg) {
|