vxe-table 3.22.9 → 3.22.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/es/grid/src/grid.js +251 -165
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +3 -3
- package/es/table/module/export/mixin.js +53 -33
- package/es/table/render/index.js +12 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +319 -209
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +436 -261
- 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/mixin.js +67 -40
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/render/index.js +24 -2
- package/lib/table/render/index.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 +239 -157
- package/packages/table/module/custom/panel.ts +3 -3
- package/packages/table/module/export/mixin.ts +51 -30
- package/packages/table/render/index.ts +12 -2
- /package/es/{iconfont.1785242725062.ttf → iconfont.1785940479746.ttf} +0 -0
- /package/es/{iconfont.1785242725062.woff → iconfont.1785940479746.woff} +0 -0
- /package/es/{iconfont.1785242725062.woff2 → iconfont.1785940479746.woff2} +0 -0
- /package/lib/{iconfont.1785242725062.ttf → iconfont.1785940479746.ttf} +0 -0
- /package/lib/{iconfont.1785242725062.woff → iconfont.1785940479746.woff} +0 -0
- /package/lib/{iconfont.1785242725062.woff2 → iconfont.1785940479746.woff2} +0 -0
package/lib/grid/src/grid.js
CHANGED
|
@@ -678,14 +678,14 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
678
678
|
const pagerOpts = $xeGrid.computePagerOpts;
|
|
679
679
|
const toolbarOpts = $xeGrid.computeToolbarOpts;
|
|
680
680
|
const {
|
|
681
|
-
beforeQuery,
|
|
682
|
-
afterQuery,
|
|
683
|
-
beforeQueryFooter,
|
|
684
|
-
afterQueryFooter,
|
|
685
|
-
beforeDelete,
|
|
686
|
-
afterDelete,
|
|
687
|
-
beforeSave,
|
|
688
|
-
afterSave,
|
|
681
|
+
beforeQuery: oldBeforeQuery,
|
|
682
|
+
afterQuery: oldAfterQuery,
|
|
683
|
+
beforeQueryFooter: oldBeforeQueryFooter,
|
|
684
|
+
afterQueryFooter: oldAfterQueryFooter,
|
|
685
|
+
beforeDelete: oldBeforeDelete,
|
|
686
|
+
afterDelete: oldAfterDelete,
|
|
687
|
+
beforeSave: oldBeforeSave,
|
|
688
|
+
afterSave: oldAfterSave,
|
|
689
689
|
ajax = {}
|
|
690
690
|
} = proxyOpts;
|
|
691
691
|
const resConfigs = proxyOpts.response || proxyOpts.props || {};
|
|
@@ -744,10 +744,12 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
744
744
|
case 'reload':
|
|
745
745
|
case 'query':
|
|
746
746
|
{
|
|
747
|
-
const
|
|
748
|
-
const
|
|
749
|
-
const
|
|
750
|
-
|
|
747
|
+
const bqMethod = ajax.beforeQuery;
|
|
748
|
+
const qMethod = ajax.query;
|
|
749
|
+
const aqMethod = ajax.afterQuery;
|
|
750
|
+
const qsMethod = ajax.querySuccess;
|
|
751
|
+
const qeMethod = ajax.queryError;
|
|
752
|
+
if (qMethod) {
|
|
751
753
|
const isInited = code === 'initial';
|
|
752
754
|
const isReload = code === 'reload';
|
|
753
755
|
if (!isInited && reactData.tableLoading) {
|
|
@@ -831,80 +833,105 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
831
833
|
sorts: sortList,
|
|
832
834
|
filters: filterList,
|
|
833
835
|
form: formData,
|
|
834
|
-
options:
|
|
836
|
+
options: qMethod
|
|
835
837
|
};
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
$gantt: null
|
|
848
|
-
};
|
|
849
|
-
if (pagerConfig && (0, _utils.isEnableConf)(pagerOpts)) {
|
|
850
|
-
const totalProp = resConfigs.total;
|
|
851
|
-
const total = (_xeUtils.default.isFunction(totalProp) ? totalProp(reParams) : _xeUtils.default.get(rest, totalProp || 'page.total')) || 0;
|
|
852
|
-
tablePage.total = _xeUtils.default.toNumber(total);
|
|
853
|
-
const resultProp = resConfigs.result;
|
|
854
|
-
tableData = (_xeUtils.default.isFunction(resultProp) ? resultProp(reParams) : _xeUtils.default.get(rest, resultProp || 'result')) || [];
|
|
855
|
-
// 检验当前页码,不能超出当前最大页数
|
|
856
|
-
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
857
|
-
if (tablePage.currentPage > pageCount) {
|
|
858
|
-
tablePage.currentPage = pageCount;
|
|
859
|
-
}
|
|
838
|
+
const handleQuery = () => {
|
|
839
|
+
reactData.sortData = sortList;
|
|
840
|
+
reactData.filterData = filterList;
|
|
841
|
+
reactData.tableLoading = true;
|
|
842
|
+
return Promise.all([Promise.resolve((oldBeforeQuery || qMethod)(commitParams, ...args)), operPromise]).then(([rest]) => {
|
|
843
|
+
reactData.tableLoading = false;
|
|
844
|
+
if (aqMethod) {
|
|
845
|
+
aqMethod(Object.assign(Object.assign({}, commitParams), {
|
|
846
|
+
response: rest,
|
|
847
|
+
status: 'success'
|
|
848
|
+
}), ...args);
|
|
860
849
|
} else {
|
|
861
|
-
|
|
862
|
-
if (
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
850
|
+
let tableData = [];
|
|
851
|
+
if (rest) {
|
|
852
|
+
const reParams = {
|
|
853
|
+
data: rest,
|
|
854
|
+
$table: $xeTable,
|
|
855
|
+
$grid: $xeGrid,
|
|
856
|
+
$gantt: null
|
|
857
|
+
};
|
|
858
|
+
if (pagerConfig && (0, _utils.isEnableConf)(pagerOpts)) {
|
|
859
|
+
const totalProp = resConfigs.total;
|
|
860
|
+
const total = (_xeUtils.default.isFunction(totalProp) ? totalProp(reParams) : _xeUtils.default.get(rest, totalProp || 'page.total')) || 0;
|
|
861
|
+
tablePage.total = _xeUtils.default.toNumber(total);
|
|
862
|
+
const resultProp = resConfigs.result;
|
|
863
|
+
tableData = (_xeUtils.default.isFunction(resultProp) ? resultProp(reParams) : _xeUtils.default.get(rest, resultProp || 'result')) || [];
|
|
864
|
+
// 检验当前页码,不能超出当前最大页数
|
|
865
|
+
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
|
|
866
|
+
if (tablePage.currentPage > pageCount) {
|
|
867
|
+
tablePage.currentPage = pageCount;
|
|
868
|
+
}
|
|
869
|
+
} else {
|
|
870
|
+
const listProp = resConfigs.list;
|
|
871
|
+
if (_xeUtils.default.isArray(rest)) {
|
|
872
|
+
tableData = rest;
|
|
873
|
+
} else if (listProp) {
|
|
874
|
+
tableData = (_xeUtils.default.isFunction(listProp) ? listProp(reParams) : _xeUtils.default.get(rest, listProp)) || [];
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
if (showFooter) {
|
|
878
|
+
const fdProp = resConfigs.footerData;
|
|
879
|
+
const footerList = fdProp ? _xeUtils.default.isFunction(fdProp) ? fdProp(reParams) : _xeUtils.default.get(rest, fdProp) : [];
|
|
880
|
+
if (_xeUtils.default.isArray(footerList)) {
|
|
881
|
+
reactData.footerData = footerList;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
873
884
|
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
if ($xeTable) {
|
|
877
|
-
$xeTable.loadData(tableData);
|
|
878
|
-
} else {
|
|
879
|
-
$xeGrid.$nextTick(() => {
|
|
880
|
-
const $xeTable = $xeGrid.$refs.refTable;
|
|
881
885
|
if ($xeTable) {
|
|
882
886
|
$xeTable.loadData(tableData);
|
|
887
|
+
} else {
|
|
888
|
+
$xeGrid.$nextTick(() => {
|
|
889
|
+
const $xeTable = $xeGrid.$refs.refTable;
|
|
890
|
+
if ($xeTable) {
|
|
891
|
+
$xeTable.loadData(tableData);
|
|
892
|
+
}
|
|
893
|
+
});
|
|
883
894
|
}
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
895
|
+
if (oldAfterQuery) {
|
|
896
|
+
oldAfterQuery(Object.assign(Object.assign({}, commitParams), {
|
|
897
|
+
response: rest
|
|
898
|
+
}), ...args);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
if (qsMethod) {
|
|
902
|
+
qsMethod(Object.assign(Object.assign({}, commitParams), {
|
|
903
|
+
response: rest
|
|
904
|
+
}));
|
|
905
|
+
}
|
|
906
|
+
return {
|
|
907
|
+
status: true
|
|
908
|
+
};
|
|
909
|
+
}).catch(rest => {
|
|
910
|
+
reactData.tableLoading = false;
|
|
911
|
+
if (aqMethod) {
|
|
912
|
+
aqMethod(Object.assign(Object.assign({}, commitParams), {
|
|
913
|
+
response: rest,
|
|
914
|
+
status: 'error'
|
|
915
|
+
}), ...args);
|
|
916
|
+
}
|
|
917
|
+
if (qeMethod) {
|
|
918
|
+
qeMethod(Object.assign(Object.assign({}, commitParams), {
|
|
919
|
+
response: rest
|
|
920
|
+
}));
|
|
921
|
+
}
|
|
922
|
+
return {
|
|
923
|
+
status: false
|
|
924
|
+
};
|
|
925
|
+
});
|
|
926
|
+
};
|
|
927
|
+
if (bqMethod) {
|
|
928
|
+
return Promise.resolve(bqMethod(commitParams, ...args)).then(status => {
|
|
929
|
+
if (status !== false) {
|
|
930
|
+
return handleQuery();
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
return handleQuery();
|
|
908
935
|
} else {
|
|
909
936
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
|
|
910
937
|
}
|
|
@@ -912,47 +939,81 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
912
939
|
}
|
|
913
940
|
case 'queryFooter':
|
|
914
941
|
{
|
|
915
|
-
const
|
|
916
|
-
const
|
|
917
|
-
const
|
|
918
|
-
|
|
942
|
+
const bqfMethod = ajax.beforeQueryFooter;
|
|
943
|
+
const qfMethod = ajax.queryFooter;
|
|
944
|
+
const aqfMethod = ajax.afterQueryFooter;
|
|
945
|
+
const qfSuccessMethod = ajax.queryFooterSuccess;
|
|
946
|
+
const qfErrorMethod = ajax.queryFooterError;
|
|
947
|
+
if (qfMethod) {
|
|
919
948
|
let filterList = [];
|
|
920
949
|
if ($xeTable) {
|
|
921
950
|
filterList = $xeTable.getCheckedFilters();
|
|
922
951
|
}
|
|
952
|
+
let pageParams = {};
|
|
953
|
+
if (pagerConfig) {
|
|
954
|
+
if ((0, _utils.isEnableConf)(pagerConfig)) {
|
|
955
|
+
pageParams = Object.assign({}, tablePage);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
923
958
|
const commitParams = {
|
|
924
959
|
$table: $xeTable,
|
|
925
960
|
$grid: $xeGrid,
|
|
926
961
|
$gantt: null,
|
|
927
962
|
code,
|
|
928
963
|
button,
|
|
964
|
+
page: pageParams,
|
|
929
965
|
filters: filterList,
|
|
930
966
|
form: formData,
|
|
931
|
-
options:
|
|
967
|
+
options: qfMethod
|
|
932
968
|
};
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
969
|
+
const handleQueryFooter = () => {
|
|
970
|
+
return Promise.resolve((oldBeforeQueryFooter || qfMethod)(commitParams, ...args)).then(rest => {
|
|
971
|
+
if (aqfMethod) {
|
|
972
|
+
aqfMethod(Object.assign(Object.assign({}, commitParams), {
|
|
973
|
+
response: rest,
|
|
974
|
+
status: 'success'
|
|
975
|
+
}), ...args);
|
|
976
|
+
} else {
|
|
977
|
+
reactData.footerData = _xeUtils.default.isArray(rest) ? rest : [];
|
|
978
|
+
if (oldAfterQueryFooter) {
|
|
979
|
+
oldAfterQueryFooter(Object.assign(Object.assign({}, commitParams), {
|
|
980
|
+
response: rest
|
|
981
|
+
}), ...args);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
if (qfSuccessMethod) {
|
|
985
|
+
qfSuccessMethod(Object.assign(Object.assign({}, commitParams), {
|
|
986
|
+
response: rest
|
|
987
|
+
}));
|
|
988
|
+
}
|
|
989
|
+
return {
|
|
990
|
+
status: true
|
|
991
|
+
};
|
|
992
|
+
}).catch(rest => {
|
|
993
|
+
if (aqfMethod) {
|
|
994
|
+
aqfMethod(Object.assign(Object.assign({}, commitParams), {
|
|
995
|
+
response: rest,
|
|
996
|
+
status: 'error'
|
|
997
|
+
}), ...args);
|
|
998
|
+
}
|
|
999
|
+
if (qfErrorMethod) {
|
|
1000
|
+
qfErrorMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1001
|
+
response: rest
|
|
1002
|
+
}));
|
|
1003
|
+
}
|
|
1004
|
+
return {
|
|
1005
|
+
status: false
|
|
1006
|
+
};
|
|
1007
|
+
});
|
|
1008
|
+
};
|
|
1009
|
+
if (bqfMethod) {
|
|
1010
|
+
return Promise.resolve(bqfMethod(commitParams, ...args)).then(status => {
|
|
1011
|
+
if (status !== false) {
|
|
1012
|
+
return handleQueryFooter();
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
return handleQueryFooter();
|
|
956
1017
|
} else {
|
|
957
1018
|
errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter']);
|
|
958
1019
|
}
|
|
@@ -960,10 +1021,12 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
960
1021
|
}
|
|
961
1022
|
case 'delete':
|
|
962
1023
|
{
|
|
963
|
-
const
|
|
964
|
-
const
|
|
965
|
-
const
|
|
966
|
-
|
|
1024
|
+
const bdMethod = ajax.beforeDelete;
|
|
1025
|
+
const dMethod = ajax.delete;
|
|
1026
|
+
const adMethod = ajax.afterDelete;
|
|
1027
|
+
const deleteSuccessMethod = ajax.deleteSuccess;
|
|
1028
|
+
const deleteErrorMethod = ajax.deleteError;
|
|
1029
|
+
if (dMethod) {
|
|
967
1030
|
const selectRecords = $xeTable.getCheckboxRecords();
|
|
968
1031
|
const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row));
|
|
969
1032
|
const body = {
|
|
@@ -977,62 +1040,87 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
977
1040
|
button,
|
|
978
1041
|
body,
|
|
979
1042
|
form: formData,
|
|
980
|
-
options:
|
|
1043
|
+
options: dMethod
|
|
981
1044
|
};
|
|
982
|
-
const applyArgs = [commitParams].concat(args);
|
|
983
1045
|
if (selectRecords.length) {
|
|
984
1046
|
return $xeGrid.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
985
1047
|
if (!removeRecords.length) {
|
|
986
1048
|
return $xeTable.remove(selectRecords);
|
|
987
1049
|
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
content: $xeGrid.getRespMsg(rest, 'vxe.grid.delSuccess'),
|
|
1050
|
+
const handleDelete = () => {
|
|
1051
|
+
reactData.tableLoading = true;
|
|
1052
|
+
return Promise.resolve((oldBeforeDelete || dMethod)(commitParams, ...args)).then(rest => {
|
|
1053
|
+
reactData.tableLoading = false;
|
|
1054
|
+
if (adMethod) {
|
|
1055
|
+
adMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1056
|
+
response: rest,
|
|
996
1057
|
status: 'success'
|
|
997
|
-
});
|
|
1058
|
+
}), ...args);
|
|
1059
|
+
} else {
|
|
1060
|
+
$xeTable.setPendingRow(removeRecords, false);
|
|
1061
|
+
if (isRespMsg) {
|
|
1062
|
+
if (_ui.VxeUI.modal) {
|
|
1063
|
+
_ui.VxeUI.modal.message({
|
|
1064
|
+
content: $xeGrid.getRespMsg(rest, 'vxe.grid.delSuccess'),
|
|
1065
|
+
status: 'success'
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
if (oldAfterDelete) {
|
|
1070
|
+
oldAfterDelete(Object.assign(Object.assign({}, commitParams), {
|
|
1071
|
+
response: rest
|
|
1072
|
+
}), ...args);
|
|
1073
|
+
} else {
|
|
1074
|
+
internalData.uFoot = true;
|
|
1075
|
+
$xeGrid.commitProxy('query');
|
|
1076
|
+
internalData.uFoot = false;
|
|
1077
|
+
$xeGrid.updateQueryFooter();
|
|
1078
|
+
}
|
|
998
1079
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
}
|
|
1013
|
-
return {
|
|
1014
|
-
status: true
|
|
1015
|
-
};
|
|
1016
|
-
}).catch(rest => {
|
|
1017
|
-
reactData.tableLoading = false;
|
|
1018
|
-
if (isRespMsg) {
|
|
1019
|
-
if (_ui.VxeUI.modal) {
|
|
1020
|
-
_ui.VxeUI.modal.message({
|
|
1021
|
-
id: code,
|
|
1022
|
-
content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
|
|
1080
|
+
if (deleteSuccessMethod) {
|
|
1081
|
+
deleteSuccessMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1082
|
+
response: rest
|
|
1083
|
+
}));
|
|
1084
|
+
}
|
|
1085
|
+
return {
|
|
1086
|
+
status: true
|
|
1087
|
+
};
|
|
1088
|
+
}).catch(rest => {
|
|
1089
|
+
reactData.tableLoading = false;
|
|
1090
|
+
if (adMethod) {
|
|
1091
|
+
adMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1092
|
+
response: rest,
|
|
1023
1093
|
status: 'error'
|
|
1024
|
-
});
|
|
1094
|
+
}), ...args);
|
|
1095
|
+
} else {
|
|
1096
|
+
if (isRespMsg) {
|
|
1097
|
+
if (_ui.VxeUI.modal) {
|
|
1098
|
+
_ui.VxeUI.modal.message({
|
|
1099
|
+
id: code,
|
|
1100
|
+
content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
|
|
1101
|
+
status: 'error'
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1025
1105
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
};
|
|
1035
|
-
}
|
|
1106
|
+
if (deleteErrorMethod) {
|
|
1107
|
+
deleteErrorMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1108
|
+
response: rest
|
|
1109
|
+
}));
|
|
1110
|
+
}
|
|
1111
|
+
return {
|
|
1112
|
+
status: false
|
|
1113
|
+
};
|
|
1114
|
+
});
|
|
1115
|
+
};
|
|
1116
|
+
if (bdMethod) {
|
|
1117
|
+
return Promise.resolve(bdMethod(commitParams, ...args)).then(status => {
|
|
1118
|
+
if (status !== false) {
|
|
1119
|
+
return handleDelete();
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
return handleDelete();
|
|
1036
1124
|
});
|
|
1037
1125
|
} else {
|
|
1038
1126
|
if (isActiveMsg) {
|
|
@@ -1052,10 +1140,12 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
1052
1140
|
}
|
|
1053
1141
|
case 'save':
|
|
1054
1142
|
{
|
|
1055
|
-
const
|
|
1056
|
-
const
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1143
|
+
const bSaveMethod = ajax.beforeSave;
|
|
1144
|
+
const sMethod = ajax.save;
|
|
1145
|
+
const aSaveMethod = ajax.afterSave;
|
|
1146
|
+
const sSuccessMethod = ajax.saveSuccess;
|
|
1147
|
+
const sErrorMethod = ajax.saveError;
|
|
1148
|
+
if (sMethod) {
|
|
1059
1149
|
const body = $xeGrid.getRecordset();
|
|
1060
1150
|
const {
|
|
1061
1151
|
insertRecords,
|
|
@@ -1071,9 +1161,8 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
1071
1161
|
button,
|
|
1072
1162
|
body,
|
|
1073
1163
|
form: formData,
|
|
1074
|
-
options:
|
|
1164
|
+
options: sMethod
|
|
1075
1165
|
};
|
|
1076
|
-
const applyArgs = [commitParams].concat(args);
|
|
1077
1166
|
// 排除掉新增且标记为删除的数据
|
|
1078
1167
|
if (insertRecords.length) {
|
|
1079
1168
|
body.pendingRecords = pendingRecords.filter(row => insertRecords.indexOf(row) === -1);
|
|
@@ -1093,54 +1182,75 @@ var _default = exports.default = /* define-vxe-component start */(0, _comp.defin
|
|
|
1093
1182
|
return;
|
|
1094
1183
|
}
|
|
1095
1184
|
if (body.insertRecords.length || removeRecords.length || updateRecords.length || body.pendingRecords.length) {
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1185
|
+
const handleSave = () => {
|
|
1186
|
+
reactData.tableLoading = true;
|
|
1187
|
+
return Promise.resolve((oldBeforeSave || sMethod)(commitParams, ...args)).then(rest => {
|
|
1188
|
+
reactData.tableLoading = false;
|
|
1189
|
+
if (aSaveMethod) {
|
|
1190
|
+
$xeTable.clearPendingRow();
|
|
1191
|
+
if (isRespMsg) {
|
|
1192
|
+
if (_ui.VxeUI.modal) {
|
|
1193
|
+
_ui.VxeUI.modal.message({
|
|
1194
|
+
content: $xeGrid.getRespMsg(rest, 'vxe.grid.saveSuccess'),
|
|
1195
|
+
status: 'success'
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
if (oldAfterSave) {
|
|
1200
|
+
oldAfterSave(Object.assign(Object.assign({}, commitParams), {
|
|
1201
|
+
response: rest
|
|
1202
|
+
}), ...args);
|
|
1203
|
+
} else {
|
|
1204
|
+
internalData.uFoot = true;
|
|
1205
|
+
$xeGrid.commitProxy('query');
|
|
1206
|
+
internalData.uFoot = false;
|
|
1207
|
+
$xeGrid.updateQueryFooter();
|
|
1208
|
+
}
|
|
1106
1209
|
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1121
|
-
return {
|
|
1122
|
-
status: true
|
|
1123
|
-
};
|
|
1124
|
-
}).catch(rest => {
|
|
1125
|
-
reactData.tableLoading = false;
|
|
1126
|
-
if (isRespMsg) {
|
|
1127
|
-
if (_ui.VxeUI.modal) {
|
|
1128
|
-
_ui.VxeUI.modal.message({
|
|
1129
|
-
id: code,
|
|
1130
|
-
content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
|
|
1210
|
+
if (sSuccessMethod) {
|
|
1211
|
+
sSuccessMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1212
|
+
response: rest
|
|
1213
|
+
}));
|
|
1214
|
+
}
|
|
1215
|
+
return {
|
|
1216
|
+
status: true
|
|
1217
|
+
};
|
|
1218
|
+
}).catch(rest => {
|
|
1219
|
+
reactData.tableLoading = false;
|
|
1220
|
+
if (aSaveMethod) {
|
|
1221
|
+
aSaveMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1222
|
+
response: rest,
|
|
1131
1223
|
status: 'error'
|
|
1132
|
-
});
|
|
1224
|
+
}), ...args);
|
|
1225
|
+
} else {
|
|
1226
|
+
if (isRespMsg) {
|
|
1227
|
+
if (_ui.VxeUI.modal) {
|
|
1228
|
+
_ui.VxeUI.modal.message({
|
|
1229
|
+
id: code,
|
|
1230
|
+
content: $xeGrid.getRespMsg(rest, 'vxe.grid.operError'),
|
|
1231
|
+
status: 'error'
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1133
1235
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
};
|
|
1143
|
-
}
|
|
1236
|
+
if (sErrorMethod) {
|
|
1237
|
+
sErrorMethod(Object.assign(Object.assign({}, commitParams), {
|
|
1238
|
+
response: rest
|
|
1239
|
+
}));
|
|
1240
|
+
}
|
|
1241
|
+
return {
|
|
1242
|
+
status: false
|
|
1243
|
+
};
|
|
1244
|
+
});
|
|
1245
|
+
};
|
|
1246
|
+
if (bSaveMethod) {
|
|
1247
|
+
return Promise.resolve(bSaveMethod(commitParams, ...args)).then(status => {
|
|
1248
|
+
if (status !== false) {
|
|
1249
|
+
return handleSave();
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
return handleSave();
|
|
1144
1254
|
} else {
|
|
1145
1255
|
if (isActiveMsg) {
|
|
1146
1256
|
if (_ui.VxeUI.modal) {
|