ct-component-plus 0.0.26 → 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;
|
|
@@ -321,7 +331,7 @@ export default {
|
|
|
321
331
|
},
|
|
322
332
|
};
|
|
323
333
|
</script>
|
|
324
|
-
<style lang=
|
|
334
|
+
<style lang="less">
|
|
325
335
|
.ct-page-component {
|
|
326
336
|
--content-spacing-horizontal: 20px;
|
|
327
337
|
&__header {
|
|
@@ -329,7 +339,7 @@ export default {
|
|
|
329
339
|
padding: var(--content-spacing-horizontal);
|
|
330
340
|
margin-bottom: 16px;
|
|
331
341
|
border-radius: var(--ct-border-radius);
|
|
332
|
-
|
|
342
|
+
.ct-search-box {
|
|
333
343
|
margin-bottom: 0;
|
|
334
344
|
}
|
|
335
345
|
}
|
|
@@ -338,7 +348,7 @@ export default {
|
|
|
338
348
|
padding: 0 var(--content-spacing-horizontal)
|
|
339
349
|
var(--content-spacing-horizontal);
|
|
340
350
|
border-radius: var(--ct-border-radius);
|
|
341
|
-
|
|
351
|
+
.ct-table-box {
|
|
342
352
|
margin-bottom: 0;
|
|
343
353
|
}
|
|
344
354
|
}
|
|
@@ -348,4 +358,4 @@ export default {
|
|
|
348
358
|
margin-bottom: 0;
|
|
349
359
|
}
|
|
350
360
|
}
|
|
351
|
-
</style>
|
|
361
|
+
</style>
|