n20-common-lib 2.2.4 → 2.2.6
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
|
@@ -19,10 +19,14 @@
|
|
|
19
19
|
<script>
|
|
20
20
|
import { $lc } from '../../utils/i18n/index'
|
|
21
21
|
let disabledDate_1 = (t) => {
|
|
22
|
-
|
|
22
|
+
let now = new Date()
|
|
23
|
+
now.setHours(0, 0, -1)
|
|
24
|
+
return t < now
|
|
23
25
|
}
|
|
24
26
|
let disabledDate_2 = (t) => {
|
|
25
|
-
|
|
27
|
+
let now = new Date()
|
|
28
|
+
now.setHours(23, 59, 59)
|
|
29
|
+
return t > now
|
|
26
30
|
}
|
|
27
31
|
let shortcuts_1 = [
|
|
28
32
|
{
|
|
@@ -120,10 +124,6 @@ export default {
|
|
|
120
124
|
type: [String, Number, Date],
|
|
121
125
|
default: undefined
|
|
122
126
|
},
|
|
123
|
-
valueFormat: {
|
|
124
|
-
type: String,
|
|
125
|
-
default: 'yyyy-MM-dd'
|
|
126
|
-
},
|
|
127
127
|
startDate: {
|
|
128
128
|
type: [String, Number, Date],
|
|
129
129
|
default: null
|
|
@@ -132,6 +132,10 @@ export default {
|
|
|
132
132
|
type: [String, Number, Date],
|
|
133
133
|
default: null
|
|
134
134
|
},
|
|
135
|
+
valueFormat: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: 'yyyy-MM-dd'
|
|
138
|
+
},
|
|
135
139
|
minNow: {
|
|
136
140
|
type: Boolean,
|
|
137
141
|
default: false
|
|
@@ -140,7 +144,7 @@ export default {
|
|
|
140
144
|
type: Boolean,
|
|
141
145
|
default: false
|
|
142
146
|
},
|
|
143
|
-
|
|
147
|
+
shortcuts: {
|
|
144
148
|
type: Boolean,
|
|
145
149
|
default: true
|
|
146
150
|
},
|
|
@@ -155,8 +159,8 @@ export default {
|
|
|
155
159
|
},
|
|
156
160
|
data() {
|
|
157
161
|
let shortcuts = undefined
|
|
158
|
-
if (['date', 'datetime'].includes(this.type)) shortcuts = shortcuts_1
|
|
159
|
-
if (['daterange', 'datetimerange'].includes(this.type)) shortcuts = shortcuts_2
|
|
162
|
+
if (this.shortcuts && ['date', 'datetime'].includes(this.type)) shortcuts = shortcuts_1
|
|
163
|
+
if (this.shortcuts && ['daterange', 'datetimerange'].includes(this.type)) shortcuts = shortcuts_2
|
|
160
164
|
|
|
161
165
|
this.pickerOptionsAs = Object.assign(
|
|
162
166
|
{
|
|
@@ -184,9 +188,30 @@ export default {
|
|
|
184
188
|
},
|
|
185
189
|
set(val) {
|
|
186
190
|
if (['daterange', 'monthrange', 'datetimerange'].includes(this.type)) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
191
|
+
if (val && val[0]) {
|
|
192
|
+
if (this.type === 'monthrange' && ['yyyy-MM-dd', 'yyyy-MM-dd HH:mm:ss'].includes(this.valueFormat)) {
|
|
193
|
+
let end = new Date(val[1])
|
|
194
|
+
end.setMonth(end.getMonth() + 1)
|
|
195
|
+
end.setDate(0)
|
|
196
|
+
let Y = end.getFullYear()
|
|
197
|
+
let M = end.getMonth() + 1
|
|
198
|
+
let D = end.getDate()
|
|
199
|
+
let str = `${Y}-${M > 9 ? M : '0' + M}-${D > 9 ? D : '0' + D}`
|
|
200
|
+
if (this.valueFormat === 'yyyy-MM-dd HH:mm:ss') str = str + ' 23:59:59'
|
|
201
|
+
|
|
202
|
+
this.$emit('update:start-date', val[0])
|
|
203
|
+
this.$emit('update:end-date', str)
|
|
204
|
+
this.$emit('change', [val[0], str])
|
|
205
|
+
} else {
|
|
206
|
+
this.$emit('update:start-date', val[0])
|
|
207
|
+
this.$emit('update:end-date', val[1])
|
|
208
|
+
this.$emit('change', val)
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
this.$emit('update:start-date', null)
|
|
212
|
+
this.$emit('update:end-date', null)
|
|
213
|
+
this.$emit('change', val)
|
|
214
|
+
}
|
|
190
215
|
} else {
|
|
191
216
|
this.$emit('input', val)
|
|
192
217
|
this.$emit('change', val)
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
</template>
|
|
56
56
|
|
|
57
57
|
<script>
|
|
58
|
+
// TODO: 双休绑定数值格式不统一
|
|
58
59
|
import datePicker from '../DatePicker/index.vue'
|
|
59
60
|
import quarterDatePicker from './quarterDatePicker'
|
|
60
61
|
import dayjs from 'dayjs'
|
|
@@ -108,7 +109,6 @@ export default {
|
|
|
108
109
|
break
|
|
109
110
|
case '月':
|
|
110
111
|
this.month = dayjs(this.value.startDate).format('YYYY-MM')
|
|
111
|
-
console.log(this.month)
|
|
112
112
|
break
|
|
113
113
|
case '季':
|
|
114
114
|
this.quarter = this.value
|
|
@@ -63,6 +63,9 @@ export default {
|
|
|
63
63
|
if (updateActiveCache && originName === 'main' && targetName === '*' && this.$router.mode !== 'abstract') {
|
|
64
64
|
this.updateActiveCache()
|
|
65
65
|
} else if (activatedMicroRouter && activatedMicroRouter === this.$route.path.replace(/^\//, routerBase)) {
|
|
66
|
+
window._tab_route_key[activatedMicroRouter] = window._tab_route_key[activatedMicroRouter]
|
|
67
|
+
? window._tab_route_key[activatedMicroRouter] + 1
|
|
68
|
+
: 1
|
|
66
69
|
this.updateActiveCache()
|
|
67
70
|
}
|
|
68
71
|
},
|