ct-component-plus 0.0.25 → 0.0.26
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
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { useNamespace } from "../../../hooks";
|
|
13
13
|
import SearchBox from "../../search-box";
|
|
14
14
|
import TableBox from "../../table";
|
|
15
|
+
import CtEmpty from "../../empty";
|
|
15
16
|
import CtPagination from "../../pagination";
|
|
16
17
|
import CtLoading from "../../loading";
|
|
17
18
|
import TableTitle from "./modules/TableTitle.vue";
|
|
@@ -70,6 +71,12 @@ export default {
|
|
|
70
71
|
return {};
|
|
71
72
|
},
|
|
72
73
|
},
|
|
74
|
+
pageProps: {
|
|
75
|
+
type: Object,
|
|
76
|
+
default: () => {
|
|
77
|
+
return {};
|
|
78
|
+
},
|
|
79
|
+
},
|
|
73
80
|
},
|
|
74
81
|
setup(props, { emit, slots, expose }) {
|
|
75
82
|
const baseDao = inject("$ctBaseDao");
|
|
@@ -88,6 +95,7 @@ export default {
|
|
|
88
95
|
searchParams: {},
|
|
89
96
|
pageLoading: false,
|
|
90
97
|
downloadLoading: false,
|
|
98
|
+
pageError: false,
|
|
91
99
|
});
|
|
92
100
|
const downloadLoading = ref(false);
|
|
93
101
|
provide("downloadLoading", downloadLoading);
|
|
@@ -117,6 +125,7 @@ export default {
|
|
|
117
125
|
dataP.pageSize = props.pageSize;
|
|
118
126
|
dataP.pageNo = state.pageNo;
|
|
119
127
|
}
|
|
128
|
+
state.pageError = false;
|
|
120
129
|
state.pageLoading = true;
|
|
121
130
|
if (isFunction(props.cbs.doSearch)) {
|
|
122
131
|
await props.cbs.doSearch(dataP);
|
|
@@ -150,8 +159,8 @@ export default {
|
|
|
150
159
|
}
|
|
151
160
|
tableProps.tableData = tableData || list || [];
|
|
152
161
|
})
|
|
153
|
-
.
|
|
154
|
-
state.
|
|
162
|
+
.catch(() => {
|
|
163
|
+
state.pageError = true;
|
|
155
164
|
});
|
|
156
165
|
state.pageLoading = false;
|
|
157
166
|
};
|
|
@@ -163,10 +172,10 @@ export default {
|
|
|
163
172
|
const tableProps = reactive({
|
|
164
173
|
columnData: props.tableProps.columnData || [],
|
|
165
174
|
tableData: [
|
|
166
|
-
{ index: 1, result: 3, status: "暂未处理" },
|
|
167
|
-
{ index: 2, result: 0, status: "无需处理" },
|
|
168
|
-
{ index: 3, result: 3, status: "处理中" },
|
|
169
|
-
{ index: 4, result: 0, status: "处理完成" },
|
|
175
|
+
// { index: 1, result: 3, status: "暂未处理" },
|
|
176
|
+
// { index: 2, result: 0, status: "无需处理" },
|
|
177
|
+
// { index: 3, result: 3, status: "处理中" },
|
|
178
|
+
// { index: 4, result: 0, status: "处理完成" },
|
|
170
179
|
],
|
|
171
180
|
});
|
|
172
181
|
const sortList = computed(() => {
|
|
@@ -247,58 +256,64 @@ export default {
|
|
|
247
256
|
slots.content
|
|
248
257
|
? slots.content()
|
|
249
258
|
: h("div", { class: ns.em("content", "default") }, [
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
259
|
+
state.pageError
|
|
260
|
+
? h(CtEmpty, {
|
|
261
|
+
class: ns.e("error-empty"),
|
|
262
|
+
innerText:
|
|
263
|
+
props.pageProps?.pageErrorText || "接口请求错误",
|
|
264
|
+
})
|
|
265
|
+
: h(
|
|
266
|
+
CtLoading,
|
|
267
|
+
{ "is-load": state.pageLoading, ...props.loadProps },
|
|
268
|
+
{
|
|
269
|
+
default: () => [
|
|
270
|
+
slots.contentBefore ? slots.contentBefore() : null,
|
|
271
|
+
slots.tableTop
|
|
272
|
+
? slots.tableTitle()
|
|
273
|
+
: h(
|
|
274
|
+
TableTitle,
|
|
275
|
+
{
|
|
276
|
+
total: state.total,
|
|
277
|
+
pageSize: state.pageSize,
|
|
278
|
+
handleList: props.tableHandleList,
|
|
279
|
+
sortList: sortList.value,
|
|
280
|
+
sortObj: state.sortObj,
|
|
281
|
+
"onUpdate:sortObj": (val) => {
|
|
282
|
+
state.sortObj = val;
|
|
283
|
+
},
|
|
284
|
+
onChangeSort: changeSort,
|
|
285
|
+
onDownload: doDownload,
|
|
286
|
+
ref: tableTitleRef,
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
tableTitle: slots.tableTitle,
|
|
290
|
+
tableDesc: slots.tableDesc,
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
h("div", { class: ns.e("table") }, [
|
|
294
|
+
h(
|
|
295
|
+
TableBox,
|
|
296
|
+
{
|
|
297
|
+
"table-props": tableProps,
|
|
298
|
+
...props.tableProps,
|
|
299
|
+
ref: tableRef,
|
|
268
300
|
},
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
},
|
|
286
|
-
{ ...getSelfSlots("table") }
|
|
287
|
-
),
|
|
288
|
-
h(CtPagination, {
|
|
289
|
-
class: ns.e("pagination"),
|
|
290
|
-
pageSize: state.pageSize,
|
|
291
|
-
total: state.total,
|
|
292
|
-
"current-page": state.pageNo,
|
|
293
|
-
"onUpdate:current-page": changePageNo,
|
|
294
|
-
...props.paginationProps,
|
|
295
|
-
ref: paginationRef,
|
|
296
|
-
}),
|
|
297
|
-
]),
|
|
298
|
-
slots.contentAfter ? slots.contentAfter() : null,
|
|
299
|
-
],
|
|
300
|
-
}
|
|
301
|
-
),
|
|
301
|
+
{ ...getSelfSlots("table") }
|
|
302
|
+
),
|
|
303
|
+
h(CtPagination, {
|
|
304
|
+
class: ns.e("pagination"),
|
|
305
|
+
pageSize: state.pageSize,
|
|
306
|
+
total: state.total,
|
|
307
|
+
"current-page": state.pageNo,
|
|
308
|
+
"onUpdate:current-page": changePageNo,
|
|
309
|
+
...props.paginationProps,
|
|
310
|
+
ref: paginationRef,
|
|
311
|
+
}),
|
|
312
|
+
]),
|
|
313
|
+
slots.contentAfter ? slots.contentAfter() : null,
|
|
314
|
+
],
|
|
315
|
+
}
|
|
316
|
+
),
|
|
302
317
|
]),
|
|
303
318
|
]),
|
|
304
319
|
]),
|