ct-component-plus 0.0.27 → 0.0.28
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/package.json
CHANGED
|
@@ -117,6 +117,14 @@ export default {
|
|
|
117
117
|
state.pageNo = 1;
|
|
118
118
|
getPageData();
|
|
119
119
|
};
|
|
120
|
+
const setTableProps = (data) => {
|
|
121
|
+
const { total, tableData, columnData, list } = data;
|
|
122
|
+
state.total = total || 0;
|
|
123
|
+
if (columnData) {
|
|
124
|
+
tableProps.columnData = columnData;
|
|
125
|
+
}
|
|
126
|
+
tableProps.tableData = tableData || list || [];
|
|
127
|
+
};
|
|
120
128
|
const getPageData = async (download = false) => {
|
|
121
129
|
let dataP = {
|
|
122
130
|
...state.searchParams,
|
|
@@ -128,7 +136,14 @@ export default {
|
|
|
128
136
|
state.pageError = false;
|
|
129
137
|
state.pageLoading = true;
|
|
130
138
|
if (isFunction(props.cbs.doSearch)) {
|
|
131
|
-
await props.cbs.doSearch(dataP);
|
|
139
|
+
const res = await props.cbs.doSearch(dataP);
|
|
140
|
+
if (res) {
|
|
141
|
+
if (Array.isArray(res)) {
|
|
142
|
+
tableProps.tableData = res;
|
|
143
|
+
} else if (typeof res === "object") {
|
|
144
|
+
setTableProps(res);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
132
147
|
state.pageLoading = false;
|
|
133
148
|
return;
|
|
134
149
|
}
|
|
@@ -152,12 +167,7 @@ export default {
|
|
|
152
167
|
const dataHandle = await props.cbs.afterSearch(data);
|
|
153
168
|
if (dataHandle) data = dataHandle;
|
|
154
169
|
}
|
|
155
|
-
|
|
156
|
-
state.total = total || 0;
|
|
157
|
-
if (columnData) {
|
|
158
|
-
tableProps.columnData = columnData;
|
|
159
|
-
}
|
|
160
|
-
tableProps.tableData = tableData || list || [];
|
|
170
|
+
setTableProps(data);
|
|
161
171
|
})
|
|
162
172
|
.catch(() => {
|
|
163
173
|
state.pageError = true;
|