web-component-gallery 2.2.37 → 2.2.40
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/dist/js.umd.js +1 -1
- package/lib/amap-draw/style/index.less +2 -2
- package/lib/search/index.vue +1 -1
- package/lib/table/index.vue +33 -22
- package/package.json +1 -1
- package/utils/Filter.js +20 -30
package/lib/search/index.vue
CHANGED
package/lib/table/index.vue
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<!-- 表格容器,根据tableStyle动态设置样式类 -->
|
|
3
3
|
<div :class="[tableStyle, 'WebComponentTable']" ref="Table">
|
|
4
4
|
<!-- 表格头部插槽 -->
|
|
5
|
+
{{ $slots.ATableHead }}
|
|
5
6
|
<div v-if="$slots.ATableHead" class="WebComponentTable__Head" ref="TableHead">
|
|
6
7
|
<slot name="ATableHead" />
|
|
7
8
|
</div>
|
|
@@ -206,12 +207,12 @@ export default {
|
|
|
206
207
|
}
|
|
207
208
|
},
|
|
208
209
|
mounted() {
|
|
210
|
+
this.pagination = { ...this.pagination, ...this.paginationParams }
|
|
211
|
+
// 监听父级高度
|
|
209
212
|
this.initResizeObserver()
|
|
210
|
-
this
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
this.$bus.$onWindow(this, 'resize', this.getTableBodyHeight)
|
|
214
|
-
},
|
|
213
|
+
setTimeout(this.getScrollBodyH, 300)
|
|
214
|
+
this.$bus.$onWindow(this, 'resize', this.getScrollBodyH)
|
|
215
|
+
},
|
|
215
216
|
beforeDestroy() {
|
|
216
217
|
if (this.resizeObserver) {
|
|
217
218
|
this.resizeObserver.disconnect()
|
|
@@ -219,29 +220,39 @@ export default {
|
|
|
219
220
|
}
|
|
220
221
|
},
|
|
221
222
|
methods: {
|
|
223
|
+
// 初始化尺寸观察器
|
|
222
224
|
initResizeObserver() {
|
|
223
|
-
if (typeof ResizeObserver !== 'undefined'
|
|
225
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
224
226
|
this.resizeObserver = new ResizeObserver(() => {
|
|
225
|
-
this.
|
|
227
|
+
this.getScrollBodyH()
|
|
226
228
|
})
|
|
227
229
|
this.resizeObserver.observe(this.$refs.Table)
|
|
228
230
|
}
|
|
229
231
|
},
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
232
|
+
/** 根据内容高度计算滚动长度 */
|
|
233
|
+
getScrollBodyH() {
|
|
234
|
+
if (!this.$refs.Table) return
|
|
235
|
+
|
|
236
|
+
const { Table, TableHead, TableListTitle, TablePagination } = this.$refs
|
|
237
|
+
const tableHeader = Table.querySelector('.ant-table-thead')
|
|
238
|
+
|
|
239
|
+
// 获取各部分高度
|
|
240
|
+
const clientHeight = Table.clientHeight
|
|
241
|
+
const headerHeight = TableHead?.offsetHeight || 0
|
|
242
|
+
const tableHeaderHeight = tableHeader?.offsetHeight || 0
|
|
243
|
+
const tableTitleHeight = TableListTitle?.offsetHeight || 0
|
|
244
|
+
const paginationHeight = TablePagination?.offsetHeight || 0
|
|
245
|
+
|
|
246
|
+
// 计算滚动区域高度
|
|
247
|
+
const baseSpacing = 16
|
|
248
|
+
const bufferSpace = 24
|
|
249
|
+
this.tableScrollBody = clientHeight -
|
|
250
|
+
headerHeight -
|
|
251
|
+
tableHeaderHeight -
|
|
252
|
+
tableTitleHeight -
|
|
253
|
+
paginationHeight -
|
|
254
|
+
baseSpacing -
|
|
255
|
+
bufferSpace
|
|
245
256
|
},
|
|
246
257
|
handleCheckFile(record, props) {
|
|
247
258
|
this.$postM({
|
package/package.json
CHANGED
package/utils/Filter.js
CHANGED
|
@@ -5,40 +5,30 @@
|
|
|
5
5
|
* 距离现在n天前的日期
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export function getDay(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let targetday_milliseconds=today.getTime() + 1000*60*60*24*day;
|
|
12
|
-
|
|
13
|
-
today.setTime(targetday_milliseconds); //注意,这行是关键代码
|
|
14
|
-
|
|
15
|
-
let tYear = today.getFullYear();
|
|
16
|
-
|
|
17
|
-
let tMonth = today.getMonth();
|
|
18
|
-
|
|
19
|
-
let tDate = today.getDate();
|
|
20
|
-
|
|
21
|
-
tMonth = doHandleMonth(tMonth + 1);
|
|
22
|
-
|
|
23
|
-
tDate = doHandleMonth(tDate);
|
|
24
|
-
|
|
25
|
-
return tYear+"-"+tMonth+"-"+tDate;
|
|
8
|
+
export function getDay(day) {
|
|
9
|
+
return getNDaysBefore(day, "{y}-{m}-{d}")
|
|
26
10
|
}
|
|
27
11
|
|
|
12
|
+
// 获取n天前的时间
|
|
13
|
+
export function getNDaysBefore(n, baseTime = null, cFormat) {
|
|
14
|
+
const base = baseTime ? new Date(baseTime) : new Date()
|
|
15
|
+
const targetTime = new Date(base.getTime() - n * 24 * 60 * 60 * 1000)
|
|
16
|
+
return formatDate(targetTime, cFormat)
|
|
17
|
+
}
|
|
28
18
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
m = "0" + month;
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return m;
|
|
19
|
+
// 获取n小时前的时间
|
|
20
|
+
export function getNHoursBefore(n, baseTime = null, cFormat) {
|
|
21
|
+
const base = baseTime ? new Date(baseTime) : new Date()
|
|
22
|
+
const targetTime = new Date(base.getTime() - n * 60 * 60 * 1000)
|
|
23
|
+
return formatDate(targetTime, cFormat)
|
|
24
|
+
}
|
|
40
25
|
|
|
41
|
-
|
|
26
|
+
// 获取n分钟前的时间
|
|
27
|
+
export function getNMinutesBefore(n, baseTime = null, cFormat) {
|
|
28
|
+
const base = baseTime ? new Date(baseTime) : new Date()
|
|
29
|
+
const targetTime = new Date(base.getTime() - n * 60 * 1000)
|
|
30
|
+
return formatDate(targetTime, cFormat)
|
|
31
|
+
}
|
|
42
32
|
|
|
43
33
|
|
|
44
34
|
/**
|