xt-element-ui 2.1.22 → 2.1.72

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.
Files changed (79) hide show
  1. package/docs/components/base/xt-badge.md +0 -2
  2. package/docs/components/base/xt-bar.md +5 -32
  3. package/docs/components/base/xt-button.md +0 -2
  4. package/docs/components/base/xt-card-item.md +0 -2
  5. package/docs/components/base/xt-card.md +17 -19
  6. package/docs/components/base/xt-chart.md +5 -31
  7. package/docs/components/base/xt-config-provider.md +0 -2
  8. package/docs/components/base/xt-date-picker.md +185 -28
  9. package/docs/components/base/xt-flex-box.md +25 -25
  10. package/docs/components/base/xt-form-schema.md +356 -0
  11. package/docs/components/base/xt-grid-box.md +4 -6
  12. package/docs/components/base/xt-icon.md +0 -2
  13. package/docs/components/base/xt-input.md +204 -44
  14. package/docs/components/base/xt-line.md +4 -30
  15. package/docs/components/base/xt-list.md +456 -458
  16. package/docs/components/base/xt-map-provider.md +0 -2
  17. package/docs/components/base/xt-map.md +0 -2
  18. package/docs/components/base/xt-multi.md +5 -44
  19. package/docs/components/base/xt-page.md +17 -6
  20. package/docs/components/base/xt-pie.md +5 -30
  21. package/docs/components/base/xt-progress.md +0 -2
  22. package/docs/components/base/xt-scroll-arrow.md +0 -2
  23. package/docs/components/base/xt-select-tree.md +0 -2
  24. package/docs/components/base/xt-step-price.md +3 -4
  25. package/docs/components/base/xt-table.md +2 -2
  26. package/docs/components/base/xt-tabs.md +0 -2
  27. package/docs/components/base/xt-text.md +1 -2
  28. package/docs/components/base/xt-time.md +0 -2
  29. package/docs/components/base/xt-transfer-tree.md +270 -0
  30. package/docs/components/base/xt-upload.md +11 -8
  31. package/docs/components/utils/config.md +285 -0
  32. package/docs/components/utils/format.md +445 -0
  33. package/lib/index.common.js +98163 -117565
  34. package/lib/index.css +1 -1
  35. package/lib/index.umd.js +98166 -117568
  36. package/lib/index.umd.min.js +1 -34
  37. package/package.json +9 -6
  38. package/src/components/xt-badge/style/index.scss +0 -22
  39. package/src/components/xt-button/index.vue +2 -1
  40. package/src/components/xt-button/style/index.scss +2 -2
  41. package/src/components/xt-card/style/index.scss +2 -2
  42. package/src/components/xt-card-item/style/index.scss +5 -40
  43. package/src/components/xt-chart/XtBar.vue +0 -3
  44. package/src/components/xt-date-picker/component/Picker.vue +196 -0
  45. package/src/components/xt-date-picker/component/RangeDate.vue +136 -0
  46. package/src/components/xt-date-picker/index.vue +220 -80
  47. package/src/components/xt-flex-box/index.vue +1 -1
  48. package/src/components/xt-form-schema/index.js +8 -0
  49. package/src/components/xt-form-schema/index.vue +328 -0
  50. package/src/components/xt-grid-item/index.vue +2 -2
  51. package/src/components/xt-input/index.vue +224 -28
  52. package/src/components/xt-input/style/index.scss +10 -0
  53. package/src/components/xt-layout/ExFieldset.vue +4 -4
  54. package/src/components/xt-list/index.js +7 -7
  55. package/src/components/xt-list/index.vue +885 -885
  56. package/src/components/xt-page/index.vue +148 -75
  57. package/src/components/xt-progress/style/index.scss +0 -14
  58. package/src/components/xt-step-price/style/index.scss +0 -4
  59. package/src/components/xt-step-price-item/index.vue +1 -1
  60. package/src/components/xt-tab-pane/index.js +10 -0
  61. package/src/components/{xt-tabs/TabPane.vue → xt-tab-pane/index.vue} +14 -1
  62. package/src/components/xt-table/XtTableCell.vue +2 -2
  63. package/src/components/xt-table/index.vue +17 -10
  64. package/src/components/xt-tabs/index.js +1 -3
  65. package/src/components/xt-tabs/index.vue +303 -44
  66. package/src/components/xt-tabs/style/index.scss +0 -40
  67. package/src/components/xt-text/index.vue +16 -4
  68. package/src/components/xt-text/style/index.scss +0 -15
  69. package/src/components/xt-transfer-tree/index.js +8 -0
  70. package/src/components/xt-transfer-tree/index.vue +494 -0
  71. package/src/components/xt-upload/index.vue +12 -6
  72. package/src/index.js +10 -2
  73. package/src/styles/theme/colors.scss +0 -44
  74. package/src/styles/theme/dark-variables.scss +0 -29
  75. package/src/styles/variables-export.scss +0 -72
  76. package/src/utils/index.js +278 -1
  77. package/src/components/xt-date-picker/SearchDate.vue +0 -45
  78. package/src/components/xt-date-picker/quarter.vue +0 -154
  79. package/src/components/xt-table/index copy.vue +0 -663
@@ -11,76 +11,4 @@
11
11
  xtColorDanger: #{$xt-color-danger}; // 危险色 - Element UI 标准红色
12
12
  xtColorInfo: #{$xt-color-info}; // 信息色 - Element UI 标准灰色
13
13
 
14
- // 主色调浅色系列
15
- xtColorPrimaryLight3: #{$xt-color-primary-light-3}; // 主色浅色 30%
16
- xtColorPrimaryLight5: #{$xt-color-primary-light-5}; // 主色浅色 50%
17
- xtColorPrimaryLight7: #{$xt-color-primary-light-7}; // 主色浅色 70%
18
- xtColorPrimaryLight8: #{$xt-color-primary-light-8}; // 主色浅色 80%
19
- xtColorPrimaryLight9: #{$xt-color-primary-light-9}; // 主色浅色 90%
20
-
21
- // ===========================
22
- // 文字颜色
23
- // ===========================
24
- xtColorTextPrimary: #{$xt-color-text-primary}; // 主要文字颜色 - 最深
25
- xtColorTextRegular: #{$xt-color-text-regular}; // 常规文字颜色 - 中等
26
- xtColorTextSecondary: #{$xt-color-text-secondary}; // 次要文字颜色 - 较浅
27
- xtColorTextPlaceholder: #{$xt-color-text-placeholder}; // 占位符文字颜色
28
- xtColorTextDisabled: #{$xt-color-text-disabled}; // 禁用状态文字颜色
29
-
30
- // ===========================
31
- // 背景颜色
32
- // ===========================
33
- xtColorBgPrimary: #{$xt-color-bg-primary}; // 主背景色 - 白色
34
- xtColorBgSecondary: #{$xt-color-bg-secondary}; // 次要背景色 - 浅灰
35
- xtColorBgHover: #{$xt-color-bg-hover}; // 悬停背景色
36
- xtColorBgContainer: #{$xt-color-bg-container}; // 容器背景色
37
- xtColorBgOverlay: #{$xt-color-bg-overlay}; // 浮层背景色
38
-
39
- // ===========================
40
- // 边框颜色
41
- // ===========================
42
- xtColorBorder: #{$xt-color-border}; // 边框颜色 - 标准
43
- xtColorBorderLight: #{$xt-color-border-light}; // 边框浅色
44
- xtColorBorderLighter: #{$xt-color-border-lighter}; // 边框更浅色
45
- xtColorBorderExtraLight: #{$xt-color-border-extra-light}; // 边框极浅色
46
-
47
- // ===========================
48
- // 字体大小
49
- // ===========================
50
- xtFontSizeExtraLarge: #{$xt-font-size-extra-large}; // 特大字体
51
- xtFontSizeLarge: #{$xt-font-size-large}; // 大字体
52
- xtFontSizeMedium: #{$xt-font-size-medium}; // 中等字体
53
- xtFontSizeBase: #{$xt-font-size-small}; // 基准字体
54
- xtFontSizeSmall: #{$xt-font-size-mini}; // 小字体
55
- xtFontSizeExtraSmall: #{$xt-font-size-extra-small}; // 特小字体
56
-
57
- // ===========================
58
- // 间距
59
- // ===========================
60
- xtSpacingXs: #{$xt-spacing-xs}; // 最小间距
61
- xtSpacingSm: #{$xt-spacing-sm}; // 小间距
62
- xtSpacingMd: #{$xt-spacing-md}; // 中间距
63
- xtSpacingLg: #{$xt-spacing-lg}; // 大间距
64
- xtSpacingXl: #{$xt-spacing-xl}; // 特大间距
65
-
66
- // ===========================
67
- // 圆角
68
- // ===========================
69
- xtBorderRadiusBase: #{$xt-border-radius-base}; // 基准圆角
70
- xtBorderRadiusSmall: #{$xt-border-radius-small}; // 小圆角
71
- xtBorderRadiusRound: #{$xt-border-radius-round}; // 圆角(胶囊状)
72
- xtBorderRadiusCircle: #{$xt-border-radius-circle}; // 圆形
73
-
74
- // ===========================
75
- // 阴影
76
- // ===========================
77
- xtShadowSm: #{$xt-shadow-sm}; // 小阴影
78
- xtShadowMd: #{$xt-shadow-md}; // 中等阴影
79
- xtShadowLg: #{$xt-shadow-lg}; // 大阴影
80
-
81
- // ===========================
82
- // 过渡动画
83
- // ===========================
84
- xtTransitionDuration: #{$xt-transition-duration}; // 默认过渡时长
85
- xtTransitionDurationFast: #{$xt-transition-duration-fast}; // 快速过渡时长
86
14
  }
@@ -177,6 +177,272 @@ export const onConfigChange = function(listener) {
177
177
  }
178
178
  }
179
179
 
180
+ // ==================== 数字格式化 ====================
181
+
182
+ export const formatNumber = function(value, options) {
183
+ if (value === null || value === undefined || value === '') {
184
+ return ''
185
+ }
186
+
187
+ const num = typeof value === 'string' ? parseFloat(value) : value
188
+ if (isNaN(num)) {
189
+ return String(value)
190
+ }
191
+
192
+ const opts = Object.assign({
193
+ decimals: 2,
194
+ thousand: true,
195
+ prefix: '',
196
+ suffix: '',
197
+ showSign: false
198
+ }, options || {})
199
+
200
+ let result = num.toFixed(opts.decimals)
201
+
202
+ if (opts.thousand) {
203
+ const parts = result.split('.')
204
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
205
+ result = parts.join('.')
206
+ }
207
+
208
+ if (opts.showSign && num > 0) {
209
+ result = '+' + result
210
+ }
211
+
212
+ return opts.prefix + result + opts.suffix
213
+ }
214
+
215
+ export const formatThousand = function(value, decimals) {
216
+ return formatNumber(value, {
217
+ decimals: decimals != null ? decimals : 2,
218
+ thousand: true
219
+ })
220
+ }
221
+
222
+ export const formatPercent = function(value, decimals) {
223
+ if (value === null || value === undefined || value === '') {
224
+ return ''
225
+ }
226
+ const num = typeof value === 'string' ? parseFloat(value) : value
227
+ if (isNaN(num)) {
228
+ return String(value)
229
+ }
230
+ return formatNumber(num * 100, {
231
+ decimals: decimals != null ? decimals : 2,
232
+ thousand: true,
233
+ suffix: '%'
234
+ })
235
+ }
236
+
237
+ // ==================== 日期格式化 ====================
238
+
239
+ function padZero(num, len) {
240
+ len = len || 2
241
+ return String(num).padStart(len, '0')
242
+ }
243
+
244
+ export const formatDate = function(date, format) {
245
+ if (!date) {
246
+ return ''
247
+ }
248
+
249
+ let d
250
+ if (date instanceof Date) {
251
+ d = date
252
+ } else if (typeof date === 'number') {
253
+ d = new Date(date.toString().length === 10 ? date * 1000 : date)
254
+ } else if (typeof date === 'string') {
255
+ date = date.trim()
256
+ if (/^\d+$/.test(date)) {
257
+ d = new Date(date.length === 10 ? parseInt(date) * 1000 : parseInt(date))
258
+ } else {
259
+ d = new Date(date.replace(/-/g, '/'))
260
+ }
261
+ } else {
262
+ return ''
263
+ }
264
+
265
+ if (isNaN(d.getTime())) {
266
+ return ''
267
+ }
268
+
269
+ const fmt = format || 'yyyy-MM-dd'
270
+ const year = d.getFullYear()
271
+ const month = d.getMonth() + 1
272
+ const day = d.getDate()
273
+ const hour = d.getHours()
274
+ const minute = d.getMinutes()
275
+ const second = d.getSeconds()
276
+ const week = d.getDay()
277
+
278
+ const weekMap = ['日', '一', '二', '三', '四', '五', '六']
279
+
280
+ return fmt
281
+ .replace('yyyy', year)
282
+ .replace('MM', padZero(month))
283
+ .replace('M', month)
284
+ .replace('dd', padZero(day))
285
+ .replace('d', day)
286
+ .replace('HH', padZero(hour))
287
+ .replace('H', hour)
288
+ .replace('hh', padZero(hour % 12 || 12))
289
+ .replace('h', hour % 12 || 12)
290
+ .replace('mm', padZero(minute))
291
+ .replace('m', minute)
292
+ .replace('ss', padZero(second))
293
+ .replace('s', second)
294
+ .replace('w', weekMap[week])
295
+ .replace('W', '星期' + weekMap[week])
296
+ }
297
+
298
+ export const formatDateTime = function(date, format) {
299
+ return formatDate(date, format || 'yyyy-MM-dd HH:mm:ss')
300
+ }
301
+
302
+ export const formatTime = function(date, format) {
303
+ return formatDate(date, format || 'HH:mm:ss')
304
+ }
305
+
306
+ export const formatRelativeTime = function(date) {
307
+ if (!date) {
308
+ return ''
309
+ }
310
+
311
+ let d
312
+ if (date instanceof Date) {
313
+ d = date
314
+ } else if (typeof date === 'number') {
315
+ d = new Date(date.toString().length === 10 ? date * 1000 : date)
316
+ } else if (typeof date === 'string') {
317
+ date = date.trim()
318
+ if (/^\d+$/.test(date)) {
319
+ d = new Date(date.length === 10 ? parseInt(date) * 1000 : parseInt(date))
320
+ } else {
321
+ d = new Date(date.replace(/-/g, '/'))
322
+ }
323
+ } else {
324
+ return ''
325
+ }
326
+
327
+ if (isNaN(d.getTime())) {
328
+ return ''
329
+ }
330
+
331
+ const now = new Date()
332
+ const diff = now.getTime() - d.getTime()
333
+ const minute = 60 * 1000
334
+ const hour = 60 * minute
335
+ const day = 24 * hour
336
+ const week = 7 * day
337
+ const month = 30 * day
338
+ const year = 365 * day
339
+
340
+ if (diff < minute) {
341
+ return '刚刚'
342
+ } else if (diff < hour) {
343
+ return Math.floor(diff / minute) + '分钟前'
344
+ } else if (diff < day) {
345
+ return Math.floor(diff / hour) + '小时前'
346
+ } else if (diff < week) {
347
+ return Math.floor(diff / day) + '天前'
348
+ } else if (diff < month) {
349
+ return Math.floor(diff / week) + '周前'
350
+ } else if (diff < year) {
351
+ return Math.floor(diff / month) + '个月前'
352
+ } else {
353
+ return Math.floor(diff / year) + '年前'
354
+ }
355
+ }
356
+
357
+ // ==================== 金额格式化 ====================
358
+
359
+ export const formatMoney = function(value, options) {
360
+ if (value === null || value === undefined || value === '') {
361
+ return ''
362
+ }
363
+
364
+ const num = typeof value === 'string' ? parseFloat(value) : value
365
+ if (isNaN(num)) {
366
+ return String(value)
367
+ }
368
+
369
+ const opts = Object.assign({
370
+ currency: 'CNY',
371
+ decimals: 2,
372
+ prefix: '',
373
+ suffix: '',
374
+ showSign: false
375
+ }, options || {})
376
+
377
+ const currencySymbols = {
378
+ CNY: '¥',
379
+ USD: '$',
380
+ EUR: '€',
381
+ JPY: '¥',
382
+ GBP: '£',
383
+ AUD: 'A$',
384
+ CAD: 'C$'
385
+ }
386
+
387
+ let symbol = currencySymbols[opts.currency] || ''
388
+ let formatted = num.toFixed(opts.decimals)
389
+
390
+ const parts = formatted.split('.')
391
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')
392
+ formatted = parts.join('.')
393
+
394
+ if (opts.showSign && num > 0) {
395
+ formatted = '+' + formatted
396
+ }
397
+
398
+ if (opts.prefix) {
399
+ formatted = opts.prefix + formatted
400
+ }
401
+
402
+ if (opts.suffix) {
403
+ formatted = formatted + opts.suffix
404
+ }
405
+
406
+ return symbol + formatted
407
+ }
408
+
409
+ export const formatCNY = function(value, decimals) {
410
+ return formatMoney(value, {
411
+ currency: 'CNY',
412
+ decimals: decimals != null ? decimals : 2
413
+ })
414
+ }
415
+
416
+ export const formatUSD = function(value, decimals) {
417
+ return formatMoney(value, {
418
+ currency: 'USD',
419
+ decimals: decimals != null ? decimals : 2
420
+ })
421
+ }
422
+
423
+ // ==================== 文件大小格式化 ====================
424
+
425
+ export const formatFileSize = function(bytes) {
426
+ if (bytes === null || bytes === undefined || bytes === '') {
427
+ return ''
428
+ }
429
+
430
+ const num = typeof bytes === 'string' ? parseFloat(bytes) : bytes
431
+ if (isNaN(num)) {
432
+ return String(bytes)
433
+ }
434
+
435
+ if (num === 0) {
436
+ return '0 B'
437
+ }
438
+
439
+ const k = 1024
440
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB']
441
+ const i = Math.floor(Math.log(num) / Math.log(k))
442
+
443
+ return parseFloat((num / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
444
+ }
445
+
180
446
  export default {
181
447
  setTheme,
182
448
  setSize,
@@ -187,5 +453,16 @@ export default {
187
453
  getSize,
188
454
  getPrimaryColor,
189
455
  resetConfig,
190
- onConfigChange
456
+ onConfigChange,
457
+ formatNumber,
458
+ formatThousand,
459
+ formatPercent,
460
+ formatDate,
461
+ formatDateTime,
462
+ formatTime,
463
+ formatRelativeTime,
464
+ formatMoney,
465
+ formatCNY,
466
+ formatUSD,
467
+ formatFileSize
191
468
  }
@@ -1,45 +0,0 @@
1
- <template>
2
- <el-form-item label="日期类型">
3
- <el-select v-model="params.SearchCondition" style="width:120px;">
4
- <el-option label="建档日期" value="建档日期"></el-option>
5
- <el-option label="更新日期" value="更新日期"></el-option>
6
- </el-select>
7
- <el-select v-model="params.SearchType" style="width:120px;">
8
- <el-option v-for="item in searchList" :key="item.value" :label="item.name" :value="item.value"></el-option>
9
- </el-select>
10
- <el-date-picker v-model="params.SearchValue" :style="'width:'+txtInputWidth+'px;'" value-format="yyyy-MM-dd" placeholder=""></el-date-picker>
11
- </el-form-item>
12
- </template>
13
- <script>
14
- export default {
15
- name: "SearchDate",
16
- props: {
17
- searchList: {
18
- type: Array,
19
- default() {
20
- return [];
21
- }
22
- },
23
- params: {
24
- type: Object,
25
- default() {
26
- return {
27
- SearchType: "",
28
- SearchCondition: "建档日期",
29
- SearchValue: ""
30
- };
31
- }
32
- },
33
- /** 查询文本输入框宽度 */
34
- txtInputWidth: {
35
- type: Number,
36
- default: 130
37
- }
38
- },
39
- created() {
40
- if (this.searchList.length > 0 && !this.params.SearchType) {
41
- this.params.SearchType = this.searchList[0].value;
42
- }
43
- }
44
- };
45
- </script>
@@ -1,154 +0,0 @@
1
-
2
-
3
- <template>
4
- <el-popover v-model="popoverVisible" trigger="click" :disabled="disabled" transition="el-zoom-in-top" :placement="placement" :width="popoverWidth" @hide="handleBlur">
5
- <div class="quarter-wrapper">
6
- <BaseFlexBox content="between">
7
- <i class="el-icon-d-arrow-left" @click="prev"></i>
8
- <span>{{ selectYear }}</span>
9
- <i class="el-icon-d-arrow-right" @click="after"></i>
10
- </BaseFlexBox>
11
- <BaseFlexBox content="between" style="margin-top: 10px">
12
- <el-button v-for="item in quarterList" :key="item.value" :disabled="getDisable(item)" :type="currentyear==selectYear&&item.value == currentQuarter ?'primary':''" size="mini" round @click="setCurrent(item)">{{ item.label }}</el-button>
13
- </BaseFlexBox>
14
- </div>
15
- <el-input slot="reference" ref="reference" size="small" :value="quarterLabel" readonly :title="value" :placeholder="placeholder" prefix-icon="el-icon-date" clearable />
16
- </el-popover>
17
- </template>
18
-
19
- <script>
20
- import BaseFlexBox from "../xt-flex-box/index.vue";
21
- import dateFns from "date-fns";
22
- export default {
23
- name: "DateQuarter",
24
- components: {
25
- BaseFlexBox
26
- },
27
- model: {
28
- props: "value",
29
- event: "change"
30
- },
31
- props: {
32
- value: {},
33
- quarterType: { // value绑定值类型 1.quarter为时返回当前时间 2.quarter-start时返回季的开始时间 3. quarter-end时返回季的结束时间
34
- type: String,
35
- default: "quarter"
36
- },
37
- placement: {
38
- type: String,
39
- default: "bottom-start"
40
- },
41
- // valueFormat: {
42
- // type: String,
43
- // default: "yyyy-Qq"
44
- // },
45
- format: { // 同时支持字符串 "yyyy-Qq" 使用小写q进行格式化数据
46
- type: String,
47
- default: "yy-Qq"
48
- },
49
- popoverWidth: Number,
50
- placeholder: {},
51
- pickerOptions: {
52
- type: Object,
53
- default: () => {
54
- return {
55
- disabledDate: () => {
56
- return false;
57
- }
58
- };
59
- }
60
- },
61
- disabled: {}
62
- },
63
- data() {
64
- const dateVal = this.getQuarterDate(this.value);
65
- const currentyear = dateVal ? dateVal.getFullYear() : "";
66
- const month = dateVal ? dateVal.getMonth() : "";
67
- const selectYear = dateVal ? dateVal.getFullYear() : new Date().getFullYear();
68
- return {
69
- dateVal: dateVal,
70
- currentyear: currentyear,
71
- currentQuarter: dateFns.getQuarter(dateVal),
72
- selectYear: selectYear,
73
- currentMonth: month,
74
- popoverVisible: false,
75
- quarterList: [
76
- { label: "Q1", value: 1 },
77
- { label: "Q2", value: 2 },
78
- { label: "Q3", value: 3 },
79
- { label: "Q4", value: 4 }
80
- ]
81
- };
82
- },
83
- computed: {
84
- diffQuarter() {
85
- return (this.selectYear - this.currentyear) * 4 - this.currentQuarter;
86
- },
87
- quarterLabel: {
88
- get() {
89
- if (!this.currentyear || !this.currentQuarter) {
90
- return "";
91
- }
92
- return this.getFormatVal();
93
- }
94
- }
95
- },
96
- methods: {
97
- getQuarterDate(val) {
98
- if (!val) return null;
99
- if (this.quarterType == "quarter-start") {
100
- return dateFns.startOfQuarter(val);
101
- } else if (this.quarterType == "quarter-end") {
102
- return dateFns.endOfQuarter(val);
103
- } else {
104
- const currentQuarter = dateFns.getQuarter(val);
105
- return dateFns.setQuarter(this.value, currentQuarter);
106
- }
107
- },
108
- getDisable(it) {
109
- },
110
- handleChangeVal(v) {
111
- },
112
- getFormatVal() {
113
- if (!this.format) {
114
- return `${this.currentyear}-Q${this.currentQuarter}`;
115
- }
116
- const formatMap = {
117
- y: this.currentyear,
118
- q: this.currentQuarter
119
- };
120
- const val = this.format.replace(/(y|q)+/g, (result, key) => {
121
- const value = formatMap[key];
122
- return value || "";
123
- });
124
- return val;
125
- },
126
- setCurrent(item) {
127
- if (!this.dateVal) {
128
- this.dateVal = new Date();
129
- }
130
- this.dateVal.setFullYear(this.selectYear);
131
- this.dateVal = dateFns.setQuarter(this.dateVal, item.value);
132
- this.$emit("change", this.dateVal);
133
- this.currentQuarter = item.value;
134
- this.currentyear = this.selectYear;
135
- this.popoverVisible = false;
136
- },
137
- after() {
138
- this.dateVal.setFullYear(this.dateVal.getFullYear() + 1);
139
- this.selectYear = this.dateVal.getFullYear();
140
- },
141
- prev() {
142
- this.dateVal.setFullYear(this.dateVal.getFullYear() - 1);
143
- this.selectYear = this.dateVal.getFullYear();
144
- },
145
- handleBlur() {
146
- this.$refs.reference.blur();
147
- }
148
- }
149
- };
150
- </script>
151
-
152
- <style>
153
-
154
- </style>