zydx-plus 1.35.587 → 1.35.589
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<teleport to="body">
|
|
3
|
-
<div class="cale" :style="{top: y + 'px', left: x + 'px'}">
|
|
3
|
+
<div ref="caleRef" v-if="isOpen" class="cale" :style="{top: y + 'px', left: x + 'px'}">
|
|
4
4
|
<div class="cale-cont">
|
|
5
5
|
<div class='calendar-Time-header under_line'>
|
|
6
6
|
<span class='calendar-lastY' @click="subYear">《</span>
|
|
@@ -206,6 +206,10 @@ export default {
|
|
|
206
206
|
domeElement: {
|
|
207
207
|
type: Object,
|
|
208
208
|
default: null
|
|
209
|
+
},
|
|
210
|
+
open: {
|
|
211
|
+
type: Boolean,
|
|
212
|
+
default: false
|
|
209
213
|
}
|
|
210
214
|
},
|
|
211
215
|
created() {
|
|
@@ -235,12 +239,32 @@ export default {
|
|
|
235
239
|
minute: '00', // 选择的分钟
|
|
236
240
|
dayChange: undefined, // 选择的日期
|
|
237
241
|
x: 22,
|
|
238
|
-
y: 0
|
|
242
|
+
y: 0,
|
|
243
|
+
isOpen: false
|
|
239
244
|
};
|
|
240
245
|
},
|
|
241
246
|
methods: {
|
|
247
|
+
init() {
|
|
248
|
+
this.$nextTick(() => {
|
|
249
|
+
if(this.domeElement) {
|
|
250
|
+
let el = this.domeElement.$el
|
|
251
|
+
if(!el) el = this.domeElement
|
|
252
|
+
const height = document.documentElement.clientHeight || document.body.clientHeight;
|
|
253
|
+
const dome = el.getBoundingClientRect()
|
|
254
|
+
const hei = this.$refs.caleRef.getBoundingClientRect()
|
|
255
|
+
this.x = dome.left
|
|
256
|
+
if((dome.top + hei.height - height) > 0) {
|
|
257
|
+
this.y = dome.top - hei.height
|
|
258
|
+
}else {
|
|
259
|
+
this.y = dome.top + dome.height
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
})
|
|
263
|
+
},
|
|
242
264
|
cancel() {
|
|
265
|
+
this.isOpen = false
|
|
243
266
|
this.$emit('cancel')
|
|
267
|
+
this.$emit('update:open', this.isOpen)
|
|
244
268
|
},
|
|
245
269
|
confirm() {
|
|
246
270
|
let date = {start: this.dayChange}
|
|
@@ -298,12 +322,6 @@ export default {
|
|
|
298
322
|
that.render(str);
|
|
299
323
|
},
|
|
300
324
|
render(setTimeStr) { //初始化
|
|
301
|
-
if(this.domeElement) {
|
|
302
|
-
const dome = this.domeElement.$el.getBoundingClientRect()
|
|
303
|
-
this.x = dome.left
|
|
304
|
-
this.y = dome.top + dome.height
|
|
305
|
-
}
|
|
306
|
-
|
|
307
325
|
let that = this;
|
|
308
326
|
let currentTimeStr = setTimeStr ? setTimeStr : that.currentTime;
|
|
309
327
|
let timeObj = this.toDateByStr(currentTimeStr); //当前选定的时间
|
|
@@ -660,20 +678,35 @@ export default {
|
|
|
660
678
|
|
|
661
679
|
if (type == 1) { //上限值
|
|
662
680
|
let _dateEnd = that.toDateByStr1(that.dateEnd);
|
|
663
|
-
|
|
664
|
-
return true;
|
|
665
|
-
} else
|
|
666
|
-
return false;
|
|
681
|
+
return firstD <= _dateEnd && _dateEnd <= lastD;
|
|
667
682
|
} else { //下限值
|
|
668
683
|
let _dateStart = that.toDateByStr1(that.dateStart);
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
684
|
+
return firstD <= _dateStart && _dateStart <= lastD;
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
handler() {
|
|
688
|
+
if (this.isOpen) {
|
|
689
|
+
setTimeout(() => {
|
|
690
|
+
this.isOpen = false
|
|
691
|
+
this.$emit('update:open', this.isOpen)
|
|
692
|
+
}, 100)
|
|
673
693
|
}
|
|
674
694
|
},
|
|
675
695
|
},
|
|
676
696
|
watch: {
|
|
697
|
+
open: {
|
|
698
|
+
handler: function (v) {
|
|
699
|
+
this.isOpen = v
|
|
700
|
+
if(v) {
|
|
701
|
+
this.init()
|
|
702
|
+
window.addEventListener('scroll', this.handler)
|
|
703
|
+
}else {
|
|
704
|
+
window.removeEventListener('scroll', this.handler)
|
|
705
|
+
}
|
|
706
|
+
},
|
|
707
|
+
immediate: true,
|
|
708
|
+
deep: true
|
|
709
|
+
},
|
|
677
710
|
currentTime: function (val, oldVal) { //时间改变
|
|
678
711
|
let dateNew = this.toDateByStr1(val);
|
|
679
712
|
if (dateNew.getFullYear() === this.year && (dateNew.getMonth() + 1) === this.month) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
2
|
+
<teleport to="body">
|
|
3
|
+
<div ref="yearRef" v-if="isOpen" class="year" :style="{top: y + 'px', left: x + 'px'}">
|
|
3
4
|
<div class="year-cont">
|
|
4
5
|
<div class='calendar-Time-header under_line'>
|
|
5
6
|
<span class='calendar-lastMonth' @click="last">{{ lastText }}</span>
|
|
@@ -15,7 +16,8 @@
|
|
|
15
16
|
</div>
|
|
16
17
|
</div>
|
|
17
18
|
</div>
|
|
18
|
-
|
|
19
|
+
</div>
|
|
20
|
+
</teleport>
|
|
19
21
|
</template>
|
|
20
22
|
|
|
21
23
|
<script>
|
|
@@ -38,6 +40,14 @@ export default {
|
|
|
38
40
|
type: String,
|
|
39
41
|
default: '2100'
|
|
40
42
|
},
|
|
43
|
+
domeElement: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: null
|
|
46
|
+
},
|
|
47
|
+
open: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
}
|
|
41
51
|
},
|
|
42
52
|
data() {
|
|
43
53
|
return {
|
|
@@ -45,13 +55,57 @@ export default {
|
|
|
45
55
|
yearList: [],
|
|
46
56
|
min: 0,
|
|
47
57
|
max: 0,
|
|
48
|
-
timeObj: 0
|
|
58
|
+
timeObj: 0,
|
|
59
|
+
x: 0,
|
|
60
|
+
y: 0,
|
|
61
|
+
isOpen: false
|
|
49
62
|
}
|
|
50
63
|
},
|
|
51
64
|
created() {
|
|
52
65
|
this.render();
|
|
53
66
|
},
|
|
67
|
+
watch: {
|
|
68
|
+
open: {
|
|
69
|
+
handler: function (v) {
|
|
70
|
+
this.isOpen = v
|
|
71
|
+
if(v) {
|
|
72
|
+
this.init()
|
|
73
|
+
window.addEventListener('scroll', this.handler)
|
|
74
|
+
}else {
|
|
75
|
+
window.removeEventListener('scroll', this.handler)
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
immediate: true,
|
|
79
|
+
deep: true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
54
82
|
methods: {
|
|
83
|
+
init() {
|
|
84
|
+
this.$nextTick(() => {
|
|
85
|
+
if(this.domeElement) {
|
|
86
|
+
let el = this.domeElement.$el
|
|
87
|
+
if(!el) el = this.domeElement
|
|
88
|
+
const height = document.documentElement.clientHeight || document.body.clientHeight;
|
|
89
|
+
const dome = el.getBoundingClientRect()
|
|
90
|
+
const hei = this.$refs.yearRef.getBoundingClientRect()
|
|
91
|
+
this.x = dome.left
|
|
92
|
+
if((dome.top + hei.height - height) > 0) {
|
|
93
|
+
this.y = dome.top - hei.height
|
|
94
|
+
}else {
|
|
95
|
+
console.log(dome)
|
|
96
|
+
this.y = dome.top + dome.height
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
handler() {
|
|
102
|
+
if (this.isOpen) {
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
this.isOpen = false
|
|
105
|
+
this.$emit('update:open', this.isOpen)
|
|
106
|
+
}, 100)
|
|
107
|
+
}
|
|
108
|
+
},
|
|
55
109
|
render() {
|
|
56
110
|
this.timeObj = new Date().getFullYear();
|
|
57
111
|
this.min = this.timeObj - 5
|
|
@@ -92,9 +146,7 @@ export default {
|
|
|
92
146
|
|
|
93
147
|
<style scoped>
|
|
94
148
|
.year{
|
|
95
|
-
position:
|
|
96
|
-
top: 22px;
|
|
97
|
-
right: 0;
|
|
149
|
+
position: fixed;
|
|
98
150
|
width: 300px;
|
|
99
151
|
z-index: 100;
|
|
100
152
|
background-color: #fff;
|