ct-component-plus 0.0.36 → 0.0.38
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
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
:clear-icon="clearIcon"
|
|
8
8
|
:prefix-icon="prefixIcon"
|
|
9
9
|
:unlink-panels="unlinkPanels"
|
|
10
|
-
v-bind="rawAttr"
|
|
11
|
-
>
|
|
10
|
+
v-bind="rawAttr">
|
|
12
11
|
<template #default="cell">
|
|
13
12
|
<slot v-bind="cell"></slot>
|
|
14
13
|
</template>
|
|
@@ -32,10 +31,13 @@ const showValue = computed({
|
|
|
32
31
|
set(newValue) {
|
|
33
32
|
let val = newValue;
|
|
34
33
|
const defaultCount = 24 * 60 * 60 * 1000 - 1000;
|
|
34
|
+
const rawType = props.rawAttr?.type || attr.type;
|
|
35
35
|
try {
|
|
36
36
|
if (props.valueFormat === "x") {
|
|
37
37
|
if (isFunction(props.addTimestamp)) {
|
|
38
38
|
val = props.addTimestamp(val);
|
|
39
|
+
} else if (rawType?.includes && rawType.includes("time")) {
|
|
40
|
+
// 包含自己选时间的情况,不需要添加默认的时间戳
|
|
39
41
|
} else if (isArray(val)) {
|
|
40
42
|
if (isArray(props.addTimestamp)) {
|
|
41
43
|
val = val.map((item, index) => {
|
|
@@ -72,5 +74,4 @@ useBuriedParams(props, emit, {
|
|
|
72
74
|
});
|
|
73
75
|
onMounted(() => {});
|
|
74
76
|
</script>
|
|
75
|
-
<style lang=
|
|
76
|
-
</style>
|
|
77
|
+
<style lang="less"></style>
|
|
@@ -237,6 +237,7 @@ export default {
|
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
const ns = useNamespace("page-component");
|
|
240
|
+
console.log(slots);
|
|
240
241
|
expose({
|
|
241
242
|
searchMethod,
|
|
242
243
|
searchRef,
|
|
@@ -257,7 +258,7 @@ export default {
|
|
|
257
258
|
slots.header
|
|
258
259
|
? slots.header()
|
|
259
260
|
: h("div", { class: ns.em("header", "default") }, [
|
|
260
|
-
slots
|
|
261
|
+
slots["header-before"] ? slots["header-before"]() : null,
|
|
261
262
|
h("div", { class: ns.e("search") }, [
|
|
262
263
|
h(
|
|
263
264
|
SearchBox,
|
|
@@ -269,7 +270,7 @@ export default {
|
|
|
269
270
|
{ ...getSelfSlots("search") }
|
|
270
271
|
),
|
|
271
272
|
]),
|
|
272
|
-
slots
|
|
273
|
+
slots["header-after"] ? slots["header-after"]() : null,
|
|
273
274
|
]),
|
|
274
275
|
]),
|
|
275
276
|
h("div", { class: ns.e("content") }, [
|
|
@@ -287,9 +288,11 @@ export default {
|
|
|
287
288
|
{ "is-load": state.pageLoading, ...props.loadProps },
|
|
288
289
|
{
|
|
289
290
|
default: () => [
|
|
290
|
-
slots
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
slots["content-before"]
|
|
292
|
+
? slots["content-before"]()
|
|
293
|
+
: null,
|
|
294
|
+
slots["table-top"]
|
|
295
|
+
? slots["table-top"]()
|
|
293
296
|
: h(
|
|
294
297
|
TableTitle,
|
|
295
298
|
{
|
|
@@ -306,8 +309,13 @@ export default {
|
|
|
306
309
|
ref: tableTitleRef,
|
|
307
310
|
},
|
|
308
311
|
{
|
|
309
|
-
|
|
310
|
-
|
|
312
|
+
"table-title": slots["table-title"],
|
|
313
|
+
"table-desc": slots["table-desc"],
|
|
314
|
+
"table-handle": slots["table-handle"],
|
|
315
|
+
"table-handle-before":
|
|
316
|
+
slots["table-handle-before"],
|
|
317
|
+
"table-handle-after":
|
|
318
|
+
slots["table-handle-after"],
|
|
311
319
|
}
|
|
312
320
|
),
|
|
313
321
|
h("div", { class: ns.e("table") }, [
|
|
@@ -330,7 +338,9 @@ export default {
|
|
|
330
338
|
ref: paginationRef,
|
|
331
339
|
}),
|
|
332
340
|
]),
|
|
333
|
-
slots
|
|
341
|
+
slots["content-after"]
|
|
342
|
+
? slots["content-after"]()
|
|
343
|
+
: null,
|
|
334
344
|
],
|
|
335
345
|
}
|
|
336
346
|
),
|
|
@@ -36,12 +36,12 @@ export const tableProps = {
|
|
|
36
36
|
type: Object,
|
|
37
37
|
default: () => {
|
|
38
38
|
return {
|
|
39
|
-
width:'88'
|
|
39
|
+
width: '88'
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
teleportDom: {
|
|
44
|
-
type:[String, Node],
|
|
44
|
+
type: [String, Node],
|
|
45
45
|
},
|
|
46
46
|
defaultSort: {
|
|
47
47
|
type: Object,
|
|
@@ -56,4 +56,5 @@ export const tableProps = {
|
|
|
56
56
|
type: String,
|
|
57
57
|
default: "暂无数据",
|
|
58
58
|
},
|
|
59
|
+
mergeList: Array,
|
|
59
60
|
}
|
|
@@ -8,15 +8,13 @@
|
|
|
8
8
|
:span-method="spanMethod"
|
|
9
9
|
@selection-change="handleSelectChange"
|
|
10
10
|
row-key="rowKey"
|
|
11
|
-
v-bind="$attrs"
|
|
12
|
-
>
|
|
11
|
+
v-bind="$attrs">
|
|
13
12
|
<el-table-column
|
|
14
13
|
v-if="isMultiSelect"
|
|
15
14
|
type="selection"
|
|
16
15
|
width="88"
|
|
17
16
|
v-bind="multiSelectAttr"
|
|
18
|
-
:reserve-selection="true"
|
|
19
|
-
></el-table-column>
|
|
17
|
+
:reserve-selection="true"></el-table-column>
|
|
20
18
|
<el-table-column
|
|
21
19
|
v-for="(column, index) in columnData"
|
|
22
20
|
:key="column.value + '-' + column.label"
|
|
@@ -29,16 +27,14 @@
|
|
|
29
27
|
:align="column.align || 'center'"
|
|
30
28
|
:fixed="column.fixed || false"
|
|
31
29
|
show-overflow-tooltip
|
|
32
|
-
v-bind="column.rawAttr || {}"
|
|
33
|
-
>
|
|
30
|
+
v-bind="column.rawAttr || {}">
|
|
34
31
|
<template #header="scope" v-if="column.slotHeader">
|
|
35
32
|
<slot
|
|
36
33
|
:name="column.value + 'Header'"
|
|
37
34
|
v-bind="scope"
|
|
38
35
|
:column="column"
|
|
39
36
|
:label="column.label"
|
|
40
|
-
:value="column.value"
|
|
41
|
-
>
|
|
37
|
+
:value="column.value">
|
|
42
38
|
</slot>
|
|
43
39
|
</template>
|
|
44
40
|
<template #default="scope">
|
|
@@ -46,8 +42,7 @@
|
|
|
46
42
|
:name="column.value"
|
|
47
43
|
:value="scope.row[column.value]"
|
|
48
44
|
v-bind="scope"
|
|
49
|
-
:column="column"
|
|
50
|
-
>
|
|
45
|
+
:column="column">
|
|
51
46
|
<span>{{ scope.row[column.value] }}</span>
|
|
52
47
|
</slot>
|
|
53
48
|
<el-table-column
|
|
@@ -62,15 +57,13 @@
|
|
|
62
57
|
:align="column1.align || 'center'"
|
|
63
58
|
:fixed="column1.fixed || false"
|
|
64
59
|
show-overflow-tooltip
|
|
65
|
-
v-bind="column1.rawAttr || {}"
|
|
66
|
-
>
|
|
60
|
+
v-bind="column1.rawAttr || {}">
|
|
67
61
|
<template #default="scope">
|
|
68
62
|
<slot
|
|
69
63
|
:name="column1.value"
|
|
70
64
|
:value="scope.row[column1.value]"
|
|
71
65
|
v-bind="scope"
|
|
72
|
-
:column="column1"
|
|
73
|
-
>
|
|
66
|
+
:column="column1">
|
|
74
67
|
<span>{{ scope.row[column1.value] }}</span>
|
|
75
68
|
</slot>
|
|
76
69
|
</template>
|
|
@@ -82,8 +75,7 @@
|
|
|
82
75
|
<component
|
|
83
76
|
:is="tableEmptyDom"
|
|
84
77
|
v-if="tableEmptyDom"
|
|
85
|
-
:text="emptyText"
|
|
86
|
-
>
|
|
78
|
+
:text="emptyText">
|
|
87
79
|
</component>
|
|
88
80
|
<span v-else>{{ emptyText }}</span>
|
|
89
81
|
</slot>
|
|
@@ -95,8 +87,7 @@
|
|
|
95
87
|
:total="total"
|
|
96
88
|
:current-page="pageNo"
|
|
97
89
|
v-if="pageSize"
|
|
98
|
-
@current-change="handleCurrentChange"
|
|
99
|
-
></ct-pagination>
|
|
90
|
+
@current-change="handleCurrentChange"></ct-pagination>
|
|
100
91
|
</div>
|
|
101
92
|
<Teleport :to="`#${teleportDom}`" v-if="teleportDom && teleportStatus">
|
|
102
93
|
<table-sort v-model:sort-obj="sortObj" :sort-list="sortList"></table-sort>
|
|
@@ -174,7 +165,16 @@ let spanObj = {};
|
|
|
174
165
|
watch(
|
|
175
166
|
() => props.mergeList,
|
|
176
167
|
(newVal, oldVal) => {
|
|
177
|
-
|
|
168
|
+
/**
|
|
169
|
+
* 将数组型的合并单元格数据转换成对象型,转换示例如下:
|
|
170
|
+
* {row: 1, col: 1, span: [2, 2]} =>
|
|
171
|
+
* {
|
|
172
|
+
* 1: { 1: [2,2], 2: [0,0] },
|
|
173
|
+
* 2: { 1: [0,0], 2: [0,0] }
|
|
174
|
+
* }
|
|
175
|
+
* 这里的合并数据对象的第一层的key表示对应的行,第二层的key对应的是列, 行和列都是从1开始的索引
|
|
176
|
+
*/
|
|
177
|
+
let spanObjRes = {};
|
|
178
178
|
if (Array.isArray(newVal)) {
|
|
179
179
|
newVal.forEach((item) => {
|
|
180
180
|
const { row, col, span } = item;
|
|
@@ -187,10 +187,10 @@ watch(
|
|
|
187
187
|
let res = i === 1 && j === 1 ? span : [0, 0];
|
|
188
188
|
const rowKey = row + i - 1;
|
|
189
189
|
const colKey = col + j - 1;
|
|
190
|
-
if (
|
|
191
|
-
|
|
190
|
+
if (spanObjRes[rowKey]) {
|
|
191
|
+
spanObjRes[rowKey][colKey] = res;
|
|
192
192
|
} else {
|
|
193
|
-
|
|
193
|
+
spanObjRes[rowKey] = {
|
|
194
194
|
[colKey]: res,
|
|
195
195
|
};
|
|
196
196
|
}
|
|
@@ -198,7 +198,7 @@ watch(
|
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
spanObj =
|
|
201
|
+
spanObj = spanObjRes;
|
|
202
202
|
},
|
|
203
203
|
{ immediate: true }
|
|
204
204
|
);
|
|
@@ -252,7 +252,7 @@ onMounted(() => {
|
|
|
252
252
|
|
|
253
253
|
defineExpose({ tableRef });
|
|
254
254
|
</script>
|
|
255
|
-
<style lang=
|
|
255
|
+
<style lang="less" scoped>
|
|
256
256
|
.ct-table__body {
|
|
257
257
|
width: 100%;
|
|
258
258
|
}
|
|
@@ -262,4 +262,4 @@ defineExpose({ tableRef });
|
|
|
262
262
|
display: flex;
|
|
263
263
|
justify-content: flex-end;
|
|
264
264
|
}
|
|
265
|
-
</style>
|
|
265
|
+
</style>
|