n20-common-lib 2.2.10 → 2.2.11

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
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.2.10",
3
+ "version": "2.2.11",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -130,10 +130,14 @@ export default {
130
130
  this.$emit('selectChange', val)
131
131
  },
132
132
 
133
- dayChange(val) {
134
- console.log(val)
135
- this.$emit('input', val)
136
- this.$emit('change', { startDate: val[0], endDate: val[1] })
133
+ dayChange(value) {
134
+ if (value) {
135
+ this.$emit('input', value)
136
+ this.$emit('change', { startDate: value[0], endDate: value[1] })
137
+ } else {
138
+ this.$emit('input', '')
139
+ this.$emit('change', { startDate: '', endDate: '' })
140
+ }
137
141
  },
138
142
  timestampToTime(timestamp) {
139
143
  var date = new Date(timestamp) // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
@@ -143,7 +147,6 @@ export default {
143
147
  return Y + M + D
144
148
  },
145
149
  weekChange(val) {
146
- console.log(val)
147
150
  let todayDay = val ? new Date(val) : new Date()
148
151
  let todayOfWeek = todayDay.getDay()
149
152
  let spendDay = 1
@@ -164,21 +167,38 @@ export default {
164
167
  this.$emit('change', weekTime)
165
168
  },
166
169
  monthChange(val) {
167
- console.log(val)
168
- let IMonth = {
169
- startDate: dayjs(val).startOf('month').format('YYYY-MM-DD'),
170
- endDate: dayjs(val).endOf('month').format('YYYY-MM-DD')
170
+ if (val) {
171
+ let IMonth = {
172
+ startDate: dayjs(val).startOf('month').format('YYYY-MM-DD'),
173
+ endDate: dayjs(val).endOf('month').format('YYYY-MM-DD')
174
+ }
175
+ this.$emit('input', val)
176
+ this.$emit('change', IMonth)
177
+ } else {
178
+ let IMonth = {
179
+ startDate: '',
180
+ endDate: ''
181
+ }
182
+ this.$emit('input', val)
183
+ this.$emit('change', IMonth)
171
184
  }
172
- this.$emit('input', val)
173
- this.$emit('change', IMonth)
174
185
  },
175
186
  yearChange(val) {
176
- let iYear = {
177
- startDate: dayjs(val).startOf('year').format('YYYY-MM-DD'),
178
- endDate: dayjs(val).endOf('year').format('YYYY-MM-DD')
187
+ if (val) {
188
+ let iYear = {
189
+ startDate: dayjs(val).startOf('year').format('YYYY-MM-DD'),
190
+ endDate: dayjs(val).endOf('year').format('YYYY-MM-DD')
191
+ }
192
+ this.$emit('input', val)
193
+ this.$emit('change', iYear)
194
+ } else {
195
+ let iYear = {
196
+ startDate: '',
197
+ endDate: ''
198
+ }
199
+ this.$emit('input', val)
200
+ this.$emit('change', iYear)
179
201
  }
180
- this.$emit('input', val)
181
- this.$emit('change', iYear)
182
202
  },
183
203
  handleChange(val) {
184
204
  this.$emit('input', val)