ai.touchui-vue 1.31.3 → 1.32.0
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/README.md +21 -21
- package/lib/ai.touchui-vue.common.js +1416 -1401
- package/lib/cascader.js +15 -3
- package/lib/chat.js +5 -5
- package/lib/collapse.js +1 -2
- package/lib/color.js +5 -5
- package/lib/date-picker.js +1 -2
- package/lib/date-range.js +16 -15
- package/lib/export.js +3 -3
- package/lib/index.js +1 -1
- package/lib/locale/format.js +10 -10
- package/lib/menu-icon.js +295 -295
- package/lib/mixins/migrating.js +20 -20
- package/lib/mixins/transition.js +14 -14
- package/lib/org.js +1 -2
- package/lib/page.js +1 -2
- package/lib/range.js +3 -3
- package/lib/scroll.js +8 -4
- package/lib/static/{net-mix.dc6e414.svg → net-mix.293a4b6.svg} +7 -7
- package/lib/tab.js +5 -5
- package/lib/table.js +22 -22
- package/lib/theme/css/theme/B-Design.css +1 -1
- package/lib/theme/css/theme/aiplan.css +1 -1
- package/lib/theme/css/theme/aiplangd.css +1 -1
- package/lib/theme/css/theme/chbn.css +1 -1
- package/lib/theme/css/theme/default.css +1 -1
- package/lib/theme/css/theme/dt.css +1 -1
- package/lib/theme/css/theme/ecloud.css +1 -1
- package/lib/theme/css/theme/hongkong.css +1 -1
- package/lib/theme/css/theme/narrow.css +1 -1
- package/lib/theme/css/theme/sdpf.css +1 -1
- package/lib/theme/css/theme/upc.css +1 -1
- package/lib/theme/css/theme/website.css +1 -1
- package/lib/theme/css/theme/zj.css +1 -1
- package/lib/utils/clickoutside.js +11 -11
- package/lib/utils/dom.js +13 -13
- package/lib/utils/filetransfer.js +4 -4
- package/lib/utils/jsencrypt/JSEncrypt.js +77 -77
- package/lib/utils/jsencrypt/JSEncryptRSAKey.js +115 -115
- package/lib/utils/jsencrypt/jselib/asn1js/asn1.js +4 -4
- package/lib/utils/jsencrypt/jselib/jsrsasign/asn1-1.0.js +734 -734
- package/lib/utils/jsencrypt/jselib/jsrsasign/yahoo.js +22 -22
- package/lib/utils/jsencrypt.js +260 -260
- package/lib/utils/md5.js +3 -3
- package/lib/utils/mime.js +2 -2
- package/lib/utils/ratio.js +53 -54
- package/lib/utils/sign.js +12 -12
- package/lib/utils/util.js +3 -3
- package/lib/utils/validate.js +11 -11
- package/package.json +159 -159
- package/packages/.DS_Store +0 -0
- package/packages/affix/index.js +8 -8
- package/packages/affix/src/affix.vue +139 -139
- package/packages/align/index.js +8 -8
- package/packages/align/src/directive.js +29 -29
- package/packages/animation/index.js +8 -8
- package/packages/animation/src/animation.vue +68 -68
- package/packages/article/.DS_Store +0 -0
- package/packages/article/index.js +8 -8
- package/packages/article/src/article.vue +23 -23
- package/packages/box/index.js +8 -8
- package/packages/box/src/box.vue +170 -170
- package/packages/button/index.js +8 -8
- package/packages/button/src/button.vue +162 -162
- package/packages/calendar/index.js +8 -8
- package/packages/calendar/src/calendar.vue +1142 -1142
- package/packages/card/index.js +10 -10
- package/packages/card/src/card-item.vue +92 -92
- package/packages/card/src/card.vue +175 -175
- package/packages/card-item/index.js +8 -8
- package/packages/cascader/index.js +8 -8
- package/packages/cascader/src/cascader.vue +818 -814
- package/packages/center-scroll/index.js +8 -8
- package/packages/center-scroll/src/center-scroll.vue +147 -147
- package/packages/chat/.DS_Store +0 -0
- package/packages/chat/index.js +12 -12
- package/packages/chat/src/.DS_Store +0 -0
- package/packages/chat/src/chat.vue +116 -116
- package/packages/checkbox/index.js +8 -8
- package/packages/checkbox/src/checkbox.vue +262 -262
- package/packages/checkboxes/index.js +8 -8
- package/packages/checkboxes/src/checkboxes.vue +97 -97
- package/packages/collapse/index.js +10 -10
- package/packages/collapse/src/collapse-item.vue +188 -188
- package/packages/collapse/src/collapse.vue +100 -100
- package/packages/color/index.js +8 -8
- package/packages/color/src/directive.js +42 -42
- package/packages/countdown/index.js +8 -8
- package/packages/countdown/src/countdown.vue +128 -128
- package/packages/date-picker/.DS_Store +0 -0
- package/packages/date-picker/index.js +8 -8
- package/packages/date-picker/src/date-picker.vue +438 -438
- package/packages/date-picker/src/picker.vue +342 -342
- package/packages/date-range/index.js +8 -8
- package/packages/date-range/src/date-range.vue +384 -384
- package/packages/dialog/index.js +8 -8
- package/packages/dialog/src/dialog.vue +313 -313
- package/packages/dis/.DS_Store +0 -0
- package/packages/dis/index.js +8 -8
- package/packages/dis/src/directive.js +42 -42
- package/packages/ellipsis/index.js +8 -8
- package/packages/ellipsis/src/ellipsis.vue +306 -306
- package/packages/emote/.DS_Store +0 -0
- package/packages/emote/index.js +8 -8
- package/packages/emote/src/emote.vue +38 -38
- package/packages/export/index.js +8 -8
- package/packages/export/src/ajax.js +73 -73
- package/packages/export/src/export.vue +289 -289
- package/packages/filter/.DS_Store +0 -0
- package/packages/filter/index.js +8 -8
- package/packages/filter/src/.DS_Store +0 -0
- package/packages/filter/src/filter.vue +245 -245
- package/packages/fix/index.js +8 -8
- package/packages/fix/src/fix.vue +221 -221
- package/packages/float/.DS_Store +0 -0
- package/packages/float/index.js +16 -16
- package/packages/float/src/directive.js +20 -20
- package/packages/float/src/main.vue +642 -642
- package/packages/float/src/trigger.vue +31 -31
- package/packages/flow/.DS_Store +0 -0
- package/packages/flow/index.js +8 -8
- package/packages/flow/src/flow.vue +234 -234
- package/packages/flow/src/flowItem.vue +61 -61
- package/packages/flow/src/flowLine.vue +168 -168
- package/packages/form/index.js +10 -10
- package/packages/form/src/form-item.vue +96 -96
- package/packages/form/src/form.vue +184 -184
- package/packages/grid/index.js +10 -10
- package/packages/grid/src/grid-item.vue +65 -65
- package/packages/grid/src/grid.vue +190 -190
- package/packages/grid-item/index.js +8 -8
- package/packages/guider/.DS_Store +0 -0
- package/packages/guider/index.js +8 -8
- package/packages/guider/src/guider.vue +168 -168
- package/packages/header/index.js +8 -8
- package/packages/header/src/header.vue +110 -110
- package/packages/hide/index.js +8 -8
- package/packages/hide/src/directive.js +57 -57
- package/packages/icon/index.js +8 -8
- package/packages/icon/src/icon.vue +79 -79
- package/packages/import/index.js +8 -8
- package/packages/import/src/import.vue +279 -279
- package/packages/input/index.js +8 -8
- package/packages/input/src/calcTextareaHeight.js +104 -104
- package/packages/input/src/input.vue +653 -653
- package/packages/ip/.DS_Store +0 -0
- package/packages/ip/index.js +8 -8
- package/packages/ip/src/ip.vue +143 -143
- package/packages/line/index.js +8 -8
- package/packages/line/src/line.vue +29 -29
- package/packages/loading/index.js +8 -8
- package/packages/loading/src/loading.js +58 -58
- package/packages/longtap/index.js +8 -8
- package/packages/longtap/src/longtap.js +95 -95
- package/packages/menu-icon/index.js +8 -8
- package/packages/menu-icon/src/menu-icon.vue +206 -206
- package/packages/message/index.js +8 -8
- package/packages/message/src/message.vue +9 -9
- package/packages/msg/index.js +8 -8
- package/packages/msg/src/msg.vue +227 -227
- package/packages/org/.DS_Store +0 -0
- package/packages/org/index.js +8 -8
- package/packages/org/src/org.vue +113 -113
- package/packages/org/src/orgItem.vue +63 -63
- package/packages/padding/index.js +8 -8
- package/packages/padding/src/padding.vue +105 -105
- package/packages/page/.DS_Store +0 -0
- package/packages/page/index.js +8 -8
- package/packages/page/src/.DS_Store +0 -0
- package/packages/page/src/page.vue +297 -297
- package/packages/param/index.js +8 -8
- package/packages/param/src/param.vue +226 -226
- package/packages/pic/.DS_Store +0 -0
- package/packages/pic/index.js +8 -8
- package/packages/pic/src/pic-viewer.vue +331 -331
- package/packages/pic/src/pic.vue +144 -144
- package/packages/popup/index.js +12 -12
- package/packages/popup/src/popup-group.vue +47 -47
- package/packages/popup/src/popup-item.vue +163 -163
- package/packages/popup/src/popup.vue +350 -350
- package/packages/progress/index.js +8 -8
- package/packages/progress/src/progress.vue +306 -306
- package/packages/range/index.js +8 -8
- package/packages/range/src/range.vue +612 -612
- package/packages/rate/.DS_Store +0 -0
- package/packages/rate/index.js +8 -8
- package/packages/rate/src/rate.vue +129 -129
- package/packages/reverser/.DS_Store +0 -0
- package/packages/reverser/index.js +8 -8
- package/packages/reverser/src/.DS_Store +0 -0
- package/packages/reverser/src/reverser.vue +49 -49
- package/packages/scroll/index.js +12 -12
- package/packages/scroll/src/scroll-point.vue +24 -24
- package/packages/scroll/src/scroll-sticky.vue +60 -60
- package/packages/scroll/src/scroll.vue +385 -381
- package/packages/segment/.DS_Store +0 -0
- package/packages/segment/index.js +8 -8
- package/packages/segment/src/segment.vue +618 -618
- package/packages/select/index.js +8 -8
- package/packages/select/src/select.vue +1445 -1445
- package/packages/size/index.js +8 -8
- package/packages/size/src/directive.js +33 -33
- package/packages/skeleton/index.js +8 -8
- package/packages/skeleton/src/skeleton.vue +179 -179
- package/packages/slide/.DS_Store +0 -0
- package/packages/slide/index.js +8 -8
- package/packages/slide/src/slide.vue +147 -147
- package/packages/space/index.js +8 -8
- package/packages/space/src/space.vue +53 -53
- package/packages/step/index.js +8 -8
- package/packages/step/src/step.vue +122 -122
- package/packages/submit/index.js +8 -8
- package/packages/submit/src/submit.vue +103 -103
- package/packages/switch/index.js +9 -9
- package/packages/switch/src/component.vue +131 -131
- package/packages/tab/.DS_Store +0 -0
- package/packages/tab/index.js +10 -10
- package/packages/tab/src/tab-item.vue +85 -85
- package/packages/tab/src/tab.vue +599 -599
- package/packages/table/.DS_Store +0 -0
- package/packages/table/index.js +8 -8
- package/packages/table/src/table-body.vue +301 -301
- package/packages/table/src/table-config.vue +139 -139
- package/packages/table/src/table-head.vue +242 -242
- package/packages/table/src/table.vue +1458 -1458
- package/packages/tag/index.js +8 -8
- package/packages/tag/src/tag.vue +129 -129
- package/packages/theme/lib/css/theme/B-Design.css +1 -1
- package/packages/theme/lib/css/theme/aiplan.css +1 -1
- package/packages/theme/lib/css/theme/aiplangd.css +1 -1
- package/packages/theme/lib/css/theme/chbn.css +1 -1
- package/packages/theme/lib/css/theme/default.css +1 -1
- package/packages/theme/lib/css/theme/dt.css +1 -1
- package/packages/theme/lib/css/theme/ecloud.css +1 -1
- package/packages/theme/lib/css/theme/hongkong.css +1 -1
- package/packages/theme/lib/css/theme/narrow.css +1 -1
- package/packages/theme/lib/css/theme/sdpf.css +1 -1
- package/packages/theme/lib/css/theme/upc.css +1 -1
- package/packages/theme/lib/css/theme/website.css +1 -1
- package/packages/theme/lib/css/theme/zj.css +1 -1
- package/packages/theme/package.json +33 -33
- package/packages/theme/src/.DS_Store +0 -0
- package/packages/theme/src/global/mixin.less +416 -416
- package/packages/theme/src/global/reset.less +27 -27
- package/packages/theme/src/img/.DS_Store +0 -0
- package/packages/theme/src/img/emote/.DS_Store +0 -0
- package/packages/theme/src/less/.DS_Store +0 -0
- package/packages/theme/src/less/component/affix.less +8 -8
- package/packages/theme/src/less/component/article-dark.less +6 -6
- package/packages/theme/src/less/component/article.less +39 -39
- package/packages/theme/src/less/component/box-dark.less +85 -85
- package/packages/theme/src/less/component/box.less +272 -272
- package/packages/theme/src/less/component/calendar-dark.less +111 -111
- package/packages/theme/src/less/component/calendar.less +282 -282
- package/packages/theme/src/less/component/card-dark.less +17 -17
- package/packages/theme/src/less/component/card.less +89 -89
- package/packages/theme/src/less/component/chat-dark.less +47 -47
- package/packages/theme/src/less/component/chat.less +71 -71
- package/packages/theme/src/less/component/code-dark.less +41 -41
- package/packages/theme/src/less/component/code.less +33 -33
- package/packages/theme/src/less/component/cover.less +4 -4
- package/packages/theme/src/less/component/dialog-dark.less +54 -54
- package/packages/theme/src/less/component/dialog.less +75 -75
- package/packages/theme/src/less/component/filter-dark.less +31 -31
- package/packages/theme/src/less/component/filter.less +97 -97
- package/packages/theme/src/less/component/float-dark.less +26 -26
- package/packages/theme/src/less/component/float.less +61 -61
- package/packages/theme/src/less/component/form-dark.less +45 -45
- package/packages/theme/src/less/component/form.less +322 -322
- package/packages/theme/src/less/component/gantt-dark.less +44 -44
- package/packages/theme/src/less/component/gantt.less +52 -52
- package/packages/theme/src/less/component/guider-dark.less +6 -6
- package/packages/theme/src/less/component/guider.less +15 -15
- package/packages/theme/src/less/component/header-dark.less +41 -41
- package/packages/theme/src/less/component/header.less +121 -121
- package/packages/theme/src/less/component/keyboard-dark.less +15 -15
- package/packages/theme/src/less/component/keyboard.less +21 -21
- package/packages/theme/src/less/component/line-dark.less +20 -20
- package/packages/theme/src/less/component/line.less +21 -21
- package/packages/theme/src/less/component/msg-dark.less +42 -42
- package/packages/theme/src/less/component/msg.less +102 -102
- package/packages/theme/src/less/component/page-dark.less +26 -26
- package/packages/theme/src/less/component/page.less +26 -26
- package/packages/theme/src/less/component/param-dark.less +31 -31
- package/packages/theme/src/less/component/param.less +136 -136
- package/packages/theme/src/less/component/popup-dark.less +20 -20
- package/packages/theme/src/less/component/popup.less +85 -85
- package/packages/theme/src/less/component/print.less +121 -121
- package/packages/theme/src/less/component/scroll-dark.less +19 -19
- package/packages/theme/src/less/component/scroll.less +47 -47
- package/packages/theme/src/less/component/skeleton-dark.less +29 -29
- package/packages/theme/src/less/component/skeleton.less +78 -78
- package/packages/theme/src/less/component/slide.less +70 -70
- package/packages/theme/src/less/component/space.less +2 -2
- package/packages/theme/src/less/component/step-dark.less +165 -165
- package/packages/theme/src/less/component/step.less +147 -147
- package/packages/theme/src/less/component/submit.less +40 -40
- package/packages/theme/src/less/component/tab-dark.less +221 -221
- package/packages/theme/src/less/component/tab.less +469 -462
- package/packages/theme/src/less/component/table-dark.less +196 -196
- package/packages/theme/src/less/component/table.less +435 -435
- package/packages/theme/src/less/component/timeline-dark.less +13 -13
- package/packages/theme/src/less/component/timeline.less +114 -114
- package/packages/theme/src/less/component/tip-dark.less +76 -76
- package/packages/theme/src/less/component/tip.less +139 -139
- package/packages/theme/src/less/component/tooltip-dark.less +105 -105
- package/packages/theme/src/less/component/tooltip.less +159 -159
- package/packages/theme/src/less/component/tree-dark.less +56 -56
- package/packages/theme/src/less/component/tree.less +148 -148
- package/packages/theme/src/less/element/align.less +32 -32
- package/packages/theme/src/less/element/animation.less +5 -5
- package/packages/theme/src/less/element/button-dark.less +29 -29
- package/packages/theme/src/less/element/button.less +65 -65
- package/packages/theme/src/less/element/center-scroll-dark.less +3 -3
- package/packages/theme/src/less/element/center-scroll.less +6 -6
- package/packages/theme/src/less/element/checkbox-dark.less +68 -68
- package/packages/theme/src/less/element/checkbox.less +73 -73
- package/packages/theme/src/less/element/color-dark.less +15 -15
- package/packages/theme/src/less/element/color.less +33 -33
- package/packages/theme/src/less/element/dis.less +9 -9
- package/packages/theme/src/less/element/ellipsis.less +35 -35
- package/packages/theme/src/less/element/emote.less +5 -5
- package/packages/theme/src/less/element/font-dark.less +9 -9
- package/packages/theme/src/less/element/font.less +8 -8
- package/packages/theme/src/less/element/hide-dark.less +114 -114
- package/packages/theme/src/less/element/hide.less +114 -114
- package/packages/theme/src/less/element/icon.less +297 -297
- package/packages/theme/src/less/element/input-dark.less +205 -205
- package/packages/theme/src/less/element/input.less +405 -405
- package/packages/theme/src/less/element/menu-icon.less +1 -1
- package/packages/theme/src/less/element/pic.less +18 -18
- package/packages/theme/src/less/element/progress-dark.less +37 -37
- package/packages/theme/src/less/element/progress.less +82 -82
- package/packages/theme/src/less/element/radio-dark.less +18 -18
- package/packages/theme/src/less/element/radio.less +11 -11
- package/packages/theme/src/less/element/range-dark.less +24 -24
- package/packages/theme/src/less/element/range.less +56 -56
- package/packages/theme/src/less/element/rate.less +17 -17
- package/packages/theme/src/less/element/segment-dark.less +119 -119
- package/packages/theme/src/less/element/segment.less +197 -197
- package/packages/theme/src/less/element/select-dark.less +167 -167
- package/packages/theme/src/less/element/select.less +431 -431
- package/packages/theme/src/less/element/size.less +10 -10
- package/packages/theme/src/less/element/switch-dark.less +7 -7
- package/packages/theme/src/less/element/switch.less +37 -37
- package/packages/theme/src/less/element/tag-dark.less +115 -115
- package/packages/theme/src/less/element/tag.less +159 -159
- package/packages/theme/src/less/element/upload-dark.less +26 -26
- package/packages/theme/src/less/element/upload.less +64 -64
- package/packages/theme/src/less/layout/fix.less +2 -2
- package/packages/theme/src/less/layout/flow.less +47 -47
- package/packages/theme/src/less/layout/grid-dark.less +28 -28
- package/packages/theme/src/less/layout/grid.less +172 -172
- package/packages/theme/src/less/layout/org-dark.less +2 -2
- package/packages/theme/src/less/layout/org.less +72 -72
- package/packages/theme/src/less/layout/padding.less +1 -1
- package/packages/theme/src/less/layout/reverser.less +8 -8
- package/packages/theme/src/less/theme/.DS_Store +0 -0
- package/packages/theme/src/less/theme/B-Design.less +159 -159
- package/packages/theme/src/less/theme/aiplan.less +159 -159
- package/packages/theme/src/less/theme/aiplangd.less +159 -159
- package/packages/theme/src/less/theme/chbn.less +159 -159
- package/packages/theme/src/less/theme/default.less +160 -160
- package/packages/theme/src/less/theme/dt.less +159 -159
- package/packages/theme/src/less/theme/ecloud.less +159 -159
- package/packages/theme/src/less/theme/hongkong.less +159 -159
- package/packages/theme/src/less/theme/narrow.less +160 -160
- package/packages/theme/src/less/theme/sdpf.less +160 -160
- package/packages/theme/src/less/theme/upc.less +159 -159
- package/packages/theme/src/less/theme/website.less +159 -159
- package/packages/theme/src/less/theme/zj.less +159 -159
- package/packages/timeline/index.js +8 -8
- package/packages/timeline/src/timeline.vue +84 -84
- package/packages/tip/index.js +8 -8
- package/packages/tip/src/tip.vue +226 -226
- package/packages/tooltip/.DS_Store +0 -0
- package/packages/tooltip/index.js +8 -8
- package/packages/tooltip/src/directive.js +180 -180
- package/packages/tooltip/src/tooltip.vue +467 -467
- package/packages/transfer/index.js +8 -8
- package/packages/transfer/src/transfer.vue +293 -293
- package/packages/tree/.DS_Store +0 -0
- package/packages/tree/index.js +8 -8
- package/packages/tree/src/tree.vue +518 -518
- package/packages/tree/src/treeItem.vue +443 -443
- package/packages/upload/.DS_Store +0 -0
- package/packages/upload/index.js +8 -8
- package/packages/upload/src/upload.vue +860 -860
- package/src/.DS_Store +0 -0
- package/src/index.js +207 -207
- package/src/locale/format.js +46 -46
- package/src/locale/index.js +48 -48
- package/src/locale/lang/en.js +207 -207
- package/src/locale/lang/zh-CN.js +207 -207
- package/src/mixins/blur.js +9 -9
- package/src/mixins/emitter.js +33 -33
- package/src/mixins/focus.js +9 -9
- package/src/mixins/locale.js +9 -9
- package/src/mixins/migrating.js +54 -54
- package/src/mixins/tip.js +10 -10
- package/src/mixins/transition.js +130 -130
- package/src/msg/index.js +107 -107
- package/src/svg/.DS_Store +0 -0
- package/src/svg/menu/.DS_Store +0 -0
- package/src/svg/menu/main/abnormal-mix.svg +5 -5
- package/src/svg/menu/main/abnormal.svg +5 -5
- package/src/svg/menu/main/accountManager-mix.svg +5 -5
- package/src/svg/menu/main/accountManager.svg +5 -5
- package/src/svg/menu/main/agreement-mix.svg +7 -7
- package/src/svg/menu/main/agreement.svg +7 -7
- package/src/svg/menu/main/ai-mix.svg +5 -5
- package/src/svg/menu/main/archives-mix.svg +6 -6
- package/src/svg/menu/main/arrearsReport-mix.svg +17 -17
- package/src/svg/menu/main/arrearsReport.svg +17 -17
- package/src/svg/menu/main/bill-mix.svg +13 -13
- package/src/svg/menu/main/bill.svg +13 -13
- package/src/svg/menu/main/box-mix.svg +5 -5
- package/src/svg/menu/main/broadband-mix.svg +4 -4
- package/src/svg/menu/main/broadband.svg +4 -4
- package/src/svg/menu/main/card-mix.svg +5 -5
- package/src/svg/menu/main/card.svg +5 -5
- package/src/svg/menu/main/cash-mix.svg +5 -5
- package/src/svg/menu/main/cash.svg +5 -5
- package/src/svg/menu/main/cloud-mix.svg +4 -4
- package/src/svg/menu/main/cloud.svg +4 -4
- package/src/svg/menu/main/clue-mix.svg +10 -10
- package/src/svg/menu/main/clue.svg +10 -10
- package/src/svg/menu/main/commonUse-mix.svg +4 -4
- package/src/svg/menu/main/commonUse.svg +4 -4
- package/src/svg/menu/main/construction-mix.svg +7 -7
- package/src/svg/menu/main/construction.svg +7 -7
- package/src/svg/menu/main/contract-mix.svg +8 -8
- package/src/svg/menu/main/contract.svg +8 -8
- package/src/svg/menu/main/credit-mix.svg +5 -5
- package/src/svg/menu/main/credit.svg +5 -5
- package/src/svg/menu/main/data-mix.svg +5 -5
- package/src/svg/menu/main/data.svg +5 -5
- package/src/svg/menu/main/date-mix.svg +7 -7
- package/src/svg/menu/main/deposit-mix.svg +4 -4
- package/src/svg/menu/main/device-mix.svg +4 -4
- package/src/svg/menu/main/device.svg +4 -4
- package/src/svg/menu/main/discrepancy-mix.svg +5 -5
- package/src/svg/menu/main/door-mix.svg +6 -6
- package/src/svg/menu/main/fault-mix.svg +12 -12
- package/src/svg/menu/main/fault.svg +16 -16
- package/src/svg/menu/main/finance-mix.svg +11 -11
- package/src/svg/menu/main/finance.svg +13 -13
- package/src/svg/menu/main/flow-mix.svg +4 -4
- package/src/svg/menu/main/flow.svg +4 -4
- package/src/svg/menu/main/folder-mix.svg +4 -4
- package/src/svg/menu/main/folder.svg +4 -4
- package/src/svg/menu/main/friendly-mix.svg +5 -5
- package/src/svg/menu/main/fusion-mix.svg +5 -5
- package/src/svg/menu/main/fusion.svg +5 -5
- package/src/svg/menu/main/gift-mix.svg +8 -8
- package/src/svg/menu/main/gift.svg +8 -8
- package/src/svg/menu/main/gps-mix.svg +6 -6
- package/src/svg/menu/main/gps.svg +6 -6
- package/src/svg/menu/main/grid-mix.svg +7 -7
- package/src/svg/menu/main/grid.svg +7 -7
- package/src/svg/menu/main/group-mix.svg +4 -4
- package/src/svg/menu/main/group.svg +4 -4
- package/src/svg/menu/main/home-mix.svg +5 -5
- package/src/svg/menu/main/home.svg +8 -8
- package/src/svg/menu/main/ict-mix.svg +4 -4
- package/src/svg/menu/main/industry-mix.svg +5 -5
- package/src/svg/menu/main/industry.svg +5 -5
- package/src/svg/menu/main/info-mix.svg +9 -9
- package/src/svg/menu/main/info.svg +9 -9
- package/src/svg/menu/main/integral-mix.svg +5 -5
- package/src/svg/menu/main/integral.svg +5 -5
- package/src/svg/menu/main/internet-mix.svg +5 -5
- package/src/svg/menu/main/internet.svg +5 -5
- package/src/svg/menu/main/inventory-mix.svg +5 -5
- package/src/svg/menu/main/invoice-mix.svg +6 -6
- package/src/svg/menu/main/invoice.svg +14 -14
- package/src/svg/menu/main/iot-mix.svg +5 -5
- package/src/svg/menu/main/iot.svg +5 -5
- package/src/svg/menu/main/label-mix.svg +4 -4
- package/src/svg/menu/main/label.svg +4 -4
- package/src/svg/menu/main/love-mix.svg +6 -6
- package/src/svg/menu/main/love.svg +13 -13
- package/src/svg/menu/main/m1-mix.svg +4 -4
- package/src/svg/menu/main/m1.svg +4 -4
- package/src/svg/menu/main/m2-mix.svg +12 -12
- package/src/svg/menu/main/m2.svg +11 -11
- package/src/svg/menu/main/m3-mix.svg +6 -6
- package/src/svg/menu/main/m3.svg +7 -7
- package/src/svg/menu/main/m4-mix.svg +5 -5
- package/src/svg/menu/main/m4.svg +7 -7
- package/src/svg/menu/main/m5-mix.svg +8 -8
- package/src/svg/menu/main/m5.svg +10 -10
- package/src/svg/menu/main/mail-mix.svg +5 -5
- package/src/svg/menu/main/manual-mix.svg +11 -11
- package/src/svg/menu/main/manual.svg +11 -11
- package/src/svg/menu/main/market-mix.svg +4 -4
- package/src/svg/menu/main/market.svg +4 -4
- package/src/svg/menu/main/member-mix.svg +6 -6
- package/src/svg/menu/main/member.svg +6 -6
- package/src/svg/menu/main/menu-mix.svg +4 -4
- package/src/svg/menu/main/menu.svg +4 -4
- package/src/svg/menu/main/message-mix.svg +11 -11
- package/src/svg/menu/main/message.svg +11 -11
- package/src/svg/menu/main/namelist-mix.svg +4 -4
- package/src/svg/menu/main/namelist.svg +4 -4
- package/src/svg/menu/main/net-mix.svg +7 -7
- package/src/svg/menu/main/niche-mix.svg +12 -12
- package/src/svg/menu/main/niche.svg +12 -12
- package/src/svg/menu/main/notice-mix.svg +4 -4
- package/src/svg/menu/main/notice.svg +4 -4
- package/src/svg/menu/main/number-mix.svg +6 -6
- package/src/svg/menu/main/operations-mix.svg +4 -4
- package/src/svg/menu/main/operations.svg +4 -4
- package/src/svg/menu/main/order-mix.svg +8 -8
- package/src/svg/menu/main/order.svg +8 -8
- package/src/svg/menu/main/person-mix.svg +6 -6
- package/src/svg/menu/main/person.svg +6 -6
- package/src/svg/menu/main/phone-mix.svg +4 -4
- package/src/svg/menu/main/phone.svg +4 -4
- package/src/svg/menu/main/phoneBill-mix.svg +6 -6
- package/src/svg/menu/main/phoneBill.svg +6 -6
- package/src/svg/menu/main/preferential-mix.svg +5 -5
- package/src/svg/menu/main/preferential.svg +5 -5
- package/src/svg/menu/main/print-mix.svg +5 -5
- package/src/svg/menu/main/problem-mix.svg +4 -4
- package/src/svg/menu/main/problem.svg +4 -4
- package/src/svg/menu/main/process-mix.svg +4 -4
- package/src/svg/menu/main/process.svg +4 -4
- package/src/svg/menu/main/product-mix.svg +5 -5
- package/src/svg/menu/main/product.svg +6 -6
- package/src/svg/menu/main/qrCode-mix.svg +8 -8
- package/src/svg/menu/main/qrCode.svg +8 -8
- package/src/svg/menu/main/refuelingBag-mix-mix.svg +4 -4
- package/src/svg/menu/main/refuelingBag-mix.svg +4 -4
- package/src/svg/menu/main/reportForm-mix.svg +8 -8
- package/src/svg/menu/main/reportForm.svg +8 -8
- package/src/svg/menu/main/risk-mix.svg +16 -16
- package/src/svg/menu/main/risk.svg +17 -17
- package/src/svg/menu/main/robot-mix.svg +9 -9
- package/src/svg/menu/main/robot.svg +9 -9
- package/src/svg/menu/main/satisfaction-mix.svg +4 -4
- package/src/svg/menu/main/satisfaction.svg +4 -4
- package/src/svg/menu/main/scratchCard-mix.svg +4 -4
- package/src/svg/menu/main/sim-mix.svg +4 -4
- package/src/svg/menu/main/sim.svg +4 -4
- package/src/svg/menu/main/staging-mix.svg +4 -4
- package/src/svg/menu/main/staging.svg +4 -4
- package/src/svg/menu/main/survey-mix.svg +5 -5
- package/src/svg/menu/main/survey.svg +5 -5
- package/src/svg/menu/main/tasks-mix.svg +8 -8
- package/src/svg/menu/main/tasks.svg +8 -8
- package/src/svg/menu/main/telephone-mix.svg +4 -4
- package/src/svg/menu/main/topUp-mix.svg +5 -5
- package/src/svg/menu/main/trajectory-mix.svg +11 -11
- package/src/svg/menu/main/trajectory.svg +23 -23
- package/src/svg/menu/main/transmit-mix.svg +5 -5
- package/src/svg/menu/main/tv-mix.svg +6 -6
- package/src/svg/menu/main/unlock-mix.svg +4 -4
- package/src/svg/menu/main/unlock.svg +4 -4
- package/src/svg/menu/main/view-mix.svg +5 -5
- package/src/svg/menu/main/view.svg +5 -5
- package/src/svg/menu/main/visits-mix.svg +19 -19
- package/src/svg/menu/main/visits.svg +19 -19
- package/src/svg/menu/main/voice-mix.svg +4 -4
- package/src/svg/menu/main/voice.svg +4 -4
- package/src/svg/menu/main/wiki-mix.svg +4 -4
- package/src/svg/menu/main/wiki.svg +4 -4
- package/src/svg/menu/main/workOrder-mix.svg +6 -6
- package/src/svg/menu/main/workOrder.svg +14 -14
- package/src/svg/menu/patch/Mo-space.svg +2 -2
- package/src/svg/menu/patch/Mo.svg +3 -3
- package/src/svg/menu/patch/add-space.svg +3 -3
- package/src/svg/menu/patch/add.svg +3 -3
- package/src/svg/menu/patch/address-space.svg +3 -3
- package/src/svg/menu/patch/address.svg +3 -3
- package/src/svg/menu/patch/approve-space.svg +3 -3
- package/src/svg/menu/patch/approve.svg +4 -4
- package/src/svg/menu/patch/avoid-space.svg +3 -3
- package/src/svg/menu/patch/avoid.svg +3 -3
- package/src/svg/menu/patch/batch-space.svg +3 -3
- package/src/svg/menu/patch/batch.svg +5 -5
- package/src/svg/menu/patch/broadband-space.svg +3 -3
- package/src/svg/menu/patch/broadband.svg +4 -4
- package/src/svg/menu/patch/cancellation-space.svg +3 -3
- package/src/svg/menu/patch/cancellation.svg +3 -3
- package/src/svg/menu/patch/center-space.svg +3 -3
- package/src/svg/menu/patch/center.svg +5 -5
- package/src/svg/menu/patch/change-space.svg +3 -3
- package/src/svg/menu/patch/change.svg +4 -4
- package/src/svg/menu/patch/click-space.svg +3 -3
- package/src/svg/menu/patch/click.svg +4 -4
- package/src/svg/menu/patch/close-1-space.svg +3 -3
- package/src/svg/menu/patch/close-1.svg +3 -3
- package/src/svg/menu/patch/close-space.svg +2 -2
- package/src/svg/menu/patch/close.svg +3 -3
- package/src/svg/menu/patch/collect-space.svg +3 -3
- package/src/svg/menu/patch/collect.svg +3 -3
- package/src/svg/menu/patch/comment-space.svg +3 -3
- package/src/svg/menu/patch/comment.svg +3 -3
- package/src/svg/menu/patch/confirm-space.svg +3 -3
- package/src/svg/menu/patch/confirm.svg +3 -3
- package/src/svg/menu/patch/contract-space.svg +3 -3
- package/src/svg/menu/patch/contract.svg +3 -3
- package/src/svg/menu/patch/credit-space.svg +3 -3
- package/src/svg/menu/patch/credit.svg +5 -5
- package/src/svg/menu/patch/dataMonitoring-space.svg +3 -3
- package/src/svg/menu/patch/dataMonitoring.svg +3 -3
- package/src/svg/menu/patch/dedicatedCircuit-space.svg +3 -3
- package/src/svg/menu/patch/dedicatedCircuit.svg +3 -3
- package/src/svg/menu/patch/detail-space.svg +3 -3
- package/src/svg/menu/patch/detail.svg +3 -3
- package/src/svg/menu/patch/disassemb-space.svg +3 -3
- package/src/svg/menu/patch/disassemb.svg +3 -3
- package/src/svg/menu/patch/earnestMoney-space.svg +3 -3
- package/src/svg/menu/patch/earnestMoney.svg +3 -3
- package/src/svg/menu/patch/empower-space.svg +3 -3
- package/src/svg/menu/patch/empower.svg +3 -3
- package/src/svg/menu/patch/entrust-space.svg +3 -3
- package/src/svg/menu/patch/entrust.svg +3 -3
- package/src/svg/menu/patch/expedite-space.svg +4 -4
- package/src/svg/menu/patch/expedite.svg +4 -4
- package/src/svg/menu/patch/flow-space.svg +3 -3
- package/src/svg/menu/patch/flow.svg +3 -3
- package/src/svg/menu/patch/folder-space.svg +3 -3
- package/src/svg/menu/patch/folder.svg +3 -3
- package/src/svg/menu/patch/forbidden-space.svg +3 -3
- package/src/svg/menu/patch/forbidden.svg +3 -3
- package/src/svg/menu/patch/forward-space.svg +3 -3
- package/src/svg/menu/patch/forward.svg +3 -3
- package/src/svg/menu/patch/fusion-space.svg +3 -3
- package/src/svg/menu/patch/fusion.svg +6 -6
- package/src/svg/menu/patch/history-space.svg +3 -3
- package/src/svg/menu/patch/history.svg +3 -3
- package/src/svg/menu/patch/information-space.svg +3 -3
- package/src/svg/menu/patch/information.svg +3 -3
- package/src/svg/menu/patch/insert-space.svg +3 -3
- package/src/svg/menu/patch/insert.svg +3 -3
- package/src/svg/menu/patch/letv-space.svg +3 -3
- package/src/svg/menu/patch/letv.svg +3 -3
- package/src/svg/menu/patch/link-space.svg +3 -3
- package/src/svg/menu/patch/link.svg +3 -3
- package/src/svg/menu/patch/location-space.svg +3 -3
- package/src/svg/menu/patch/location.svg +3 -3
- package/src/svg/menu/patch/message-space.svg +3 -3
- package/src/svg/menu/patch/message.svg +4 -4
- package/src/svg/menu/patch/minus-space.svg +3 -3
- package/src/svg/menu/patch/minus.svg +3 -3
- package/src/svg/menu/patch/mms-space.svg +3 -3
- package/src/svg/menu/patch/mms.svg +3 -3
- package/src/svg/menu/patch/monitor-space.svg +3 -3
- package/src/svg/menu/patch/monitor.svg +3 -3
- package/src/svg/menu/patch/move-space.svg +3 -3
- package/src/svg/menu/patch/move.svg +3 -3
- package/src/svg/menu/patch/negative-space.svg +2 -2
- package/src/svg/menu/patch/negative.svg +3 -3
- package/src/svg/menu/patch/net-space.svg +2 -2
- package/src/svg/menu/patch/net.svg +3 -3
- package/src/svg/menu/patch/news-space.svg +3 -3
- package/src/svg/menu/patch/news.svg +3 -3
- package/src/svg/menu/patch/notice-space.svg +4 -4
- package/src/svg/menu/patch/notice.svg +5 -5
- package/src/svg/menu/patch/officialBusiness-space.svg +3 -3
- package/src/svg/menu/patch/officialBusiness.svg +4 -4
- package/src/svg/menu/patch/pay-space.svg +3 -3
- package/src/svg/menu/patch/pay.svg +3 -3
- package/src/svg/menu/patch/phone-space.svg +3 -3
- package/src/svg/menu/patch/phone.svg +5 -5
- package/src/svg/menu/patch/print-space.svg +3 -3
- package/src/svg/menu/patch/print.svg +5 -5
- package/src/svg/menu/patch/product-space.svg +3 -3
- package/src/svg/menu/patch/product.svg +5 -5
- package/src/svg/menu/patch/reservation-space.svg +3 -3
- package/src/svg/menu/patch/reservation.svg +3 -3
- package/src/svg/menu/patch/sale-space.svg +3 -3
- package/src/svg/menu/patch/sale.svg +5 -5
- package/src/svg/menu/patch/search-space.svg +3 -3
- package/src/svg/menu/patch/search.svg +3 -3
- package/src/svg/menu/patch/secure-space.svg +3 -3
- package/src/svg/menu/patch/secure.svg +5 -5
- package/src/svg/menu/patch/setup-space.svg +3 -3
- package/src/svg/menu/patch/setup.svg +3 -3
- package/src/svg/menu/patch/shift-space.svg +3 -3
- package/src/svg/menu/patch/shift.svg +3 -3
- package/src/svg/menu/patch/situation-space.svg +3 -3
- package/src/svg/menu/patch/situation.svg +3 -3
- package/src/svg/menu/patch/special-space.svg +3 -3
- package/src/svg/menu/patch/special.svg +3 -3
- package/src/svg/menu/patch/tabulation-space.svg +3 -3
- package/src/svg/menu/patch/tabulation.svg +8 -8
- package/src/svg/menu/patch/track-space.svg +3 -3
- package/src/svg/menu/patch/track.svg +5 -5
- package/src/svg/menu/patch/transaction-space.svg +3 -3
- package/src/svg/menu/patch/transaction.svg +6 -6
- package/src/svg/menu/patch/user-space.svg +3 -3
- package/src/svg/menu/patch/user.svg +3 -3
- package/src/svg/menu/patch/visualize-space.svg +3 -3
- package/src/svg/menu/patch/visualize.svg +4 -4
- package/src/svg/menu/patch/vnet-space.svg +3 -3
- package/src/svg/menu/patch/vnet.svg +3 -3
- package/src/tip/tip.js +160 -160
- package/src/utils/after-leave.js +27 -27
- package/src/utils/ajax.js +59 -59
- package/src/utils/array.js +24 -24
- package/src/utils/clickoutside.js +105 -105
- package/src/utils/compare.js +16 -16
- package/src/utils/date.js +55 -55
- package/src/utils/disabledArea.js +18 -18
- package/src/utils/dom.js +301 -301
- package/src/utils/filetransfer.js +287 -287
- package/src/utils/isModified.js +20 -20
- package/src/utils/jsencrypt/JSEncrypt.js +192 -192
- package/src/utils/jsencrypt/JSEncryptRSAKey.js +320 -320
- package/src/utils/jsencrypt/index.js +3 -3
- package/src/utils/jsencrypt/jselib/asn1js/asn1.d.ts +51 -51
- package/src/utils/jsencrypt/jselib/asn1js/asn1.js +565 -565
- package/src/utils/jsencrypt/jselib/asn1js/base64.d.ts +5 -5
- package/src/utils/jsencrypt/jselib/asn1js/base64.js +88 -88
- package/src/utils/jsencrypt/jselib/asn1js/hex.d.ts +3 -3
- package/src/utils/jsencrypt/jselib/asn1js/hex.js +64 -64
- package/src/utils/jsencrypt/jselib/asn1js/int10.d.ts +9 -9
- package/src/utils/jsencrypt/jselib/asn1js/int10.js +87 -87
- package/src/utils/jsencrypt/jselib/asn1js/oids.d.ts +9778 -9778
- package/src/utils/jsencrypt/jselib/asn1js/oids.js +1962 -1962
- package/src/utils/jsencrypt/jselib/jsbn/base64.d.ts +3 -3
- package/src/utils/jsencrypt/jselib/jsbn/base64.js +76 -76
- package/src/utils/jsencrypt/jselib/jsbn/jsbn.d.ts +98 -98
- package/src/utils/jsencrypt/jselib/jsbn/jsbn.js +1754 -1754
- package/src/utils/jsencrypt/jselib/jsbn/prng4.d.ts +10 -10
- package/src/utils/jsencrypt/jselib/jsbn/prng4.js +46 -46
- package/src/utils/jsencrypt/jselib/jsbn/rng.d.ts +3 -3
- package/src/utils/jsencrypt/jselib/jsbn/rng.js +78 -78
- package/src/utils/jsencrypt/jselib/jsbn/rsa.d.ts +23 -23
- package/src/utils/jsencrypt/jselib/jsbn/rsa.js +373 -373
- package/src/utils/jsencrypt/jselib/jsbn/util.d.ts +7 -7
- package/src/utils/jsencrypt/jselib/jsbn/util.js +58 -58
- package/src/utils/jsencrypt/jselib/jsrsasign/asn1-1.0.js +1593 -1593
- package/src/utils/jsencrypt/jselib/jsrsasign/yahoo.js +63 -63
- package/src/utils/jsencrypt/util.js +58 -58
- package/src/utils/jsencrypt.js +263 -263
- package/src/utils/md5.js +203 -203
- package/src/utils/merge.js +15 -15
- package/src/utils/mime.js +75 -75
- package/src/utils/print.js +39 -39
- package/src/utils/ratio.js +230 -230
- package/src/utils/respo.js +9 -9
- package/src/utils/shared.js +7 -7
- package/src/utils/sign.js +185 -185
- package/src/utils/string.js +13 -13
- package/src/utils/theme.js +91 -91
- package/src/utils/types.js +40 -40
- package/src/utils/util.js +286 -286
- package/src/utils/uuid.js +12 -12
- package/src/utils/validate.js +373 -373
|
@@ -1,1142 +1,1142 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="to-calendar" :class="{'to-calendar-type-month' : type === 'month', 'to-calendar-size-large' : size === 'large'}">
|
|
3
|
-
<!-- 头部 开始 -->
|
|
4
|
-
<div class="header">
|
|
5
|
-
<div class="prevYear" @click="lastYear"></div>
|
|
6
|
-
<div class="prev" @click="lastMonth"></div>
|
|
7
|
-
<div class="info" :class="{'info-unfold' : type !== 'month'}" @click="toggleMonthSelector">
|
|
8
|
-
<span class="year">{{ year }}</span>
|
|
9
|
-
<span class="month">{{ month | addZero }}</span>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="next" @click="nextMonth"></div>
|
|
12
|
-
<div class="nextYear" @click="nextYear"></div>
|
|
13
|
-
</div>
|
|
14
|
-
<!-- 头部 结束 -->
|
|
15
|
-
<!-- 年月选择 开始 -->
|
|
16
|
-
<div v-show="monthLayer || type === 'month'" class="select">
|
|
17
|
-
<div class="year">
|
|
18
|
-
<span class="prev" @click="lastYears"></span>
|
|
19
|
-
<ul>
|
|
20
|
-
<li v-for="(item, index) in years" :key="index" :class="setYearClass(item)" @click="selectYear(item)">
|
|
21
|
-
{{ item }}
|
|
22
|
-
</li>
|
|
23
|
-
</ul>
|
|
24
|
-
<span class="next" @click="nextYears"></span>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="month">
|
|
27
|
-
<ul>
|
|
28
|
-
<li :class="setMonthClass(1)" @click="selectMonth(1)">{{ t('to.calendar.month.m1') }}</li>
|
|
29
|
-
<li :class="setMonthClass(2)" @click="selectMonth(2)">{{ t('to.calendar.month.m2') }}</li>
|
|
30
|
-
<li :class="setMonthClass(3)" @click="selectMonth(3)">{{ t('to.calendar.month.m3') }}</li>
|
|
31
|
-
<li :class="setMonthClass(4)" @click="selectMonth(4)">{{ t('to.calendar.month.m4') }}</li>
|
|
32
|
-
<li :class="setMonthClass(5)" @click="selectMonth(5)">{{ t('to.calendar.month.m5') }}</li>
|
|
33
|
-
<li :class="setMonthClass(6)" @click="selectMonth(6)">{{ t('to.calendar.month.m6') }}</li>
|
|
34
|
-
<li :class="setMonthClass(7)" @click="selectMonth(7)">{{ t('to.calendar.month.m7') }}</li>
|
|
35
|
-
<li :class="setMonthClass(8)" @click="selectMonth(8)">{{ t('to.calendar.month.m8') }}</li>
|
|
36
|
-
<li :class="setMonthClass(9)" @click="selectMonth(9)">{{ t('to.calendar.month.m9') }}</li>
|
|
37
|
-
<li :class="setMonthClass(10)" @click="selectMonth(10)">{{ t('to.calendar.month.m10') }}</li>
|
|
38
|
-
<li :class="setMonthClass(11)" @click="selectMonth(11)">{{ t('to.calendar.month.m11') }}</li>
|
|
39
|
-
<li :class="setMonthClass(12)" @click="selectMonth(12)">{{ t('to.calendar.month.m12') }}</li>
|
|
40
|
-
</ul>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
<!-- 年月选择 结束-->
|
|
44
|
-
<!-- 周 开始 -->
|
|
45
|
-
<div v-if="type!=='month'" class="week">
|
|
46
|
-
<ul>
|
|
47
|
-
<li>{{ t('to.calendar.week.w0') }}</li>
|
|
48
|
-
<li>{{ t('to.calendar.week.w1') }}</li>
|
|
49
|
-
<li>{{ t('to.calendar.week.w2') }}</li>
|
|
50
|
-
<li>{{ t('to.calendar.week.w3') }}</li>
|
|
51
|
-
<li>{{ t('to.calendar.week.w4') }}</li>
|
|
52
|
-
<li>{{ t('to.calendar.week.w5') }}</li>
|
|
53
|
-
<li>{{ t('to.calendar.week.w6') }}</li>
|
|
54
|
-
</ul>
|
|
55
|
-
</div>
|
|
56
|
-
<!-- 周 结束 -->
|
|
57
|
-
<!-- 日期 开始 -->
|
|
58
|
-
<div v-if="type!=='month'" class="day">
|
|
59
|
-
<ul>
|
|
60
|
-
<li v-for="(item, index) in days" :key="index" v-tip="item.point && item.point.tooltip ? item.point.tooltip : ''" v-dis="isDisableDay(item)" :class="setDayClass(item)" @click="selectDay(item)">
|
|
61
|
-
<slot :item="item" :index="index">
|
|
62
|
-
<span v-if="item.value" class="solar">{{ dayText(item.value) }}</span>
|
|
63
|
-
<span v-if="item.point && item.point.length > 0" class="to-calendar-points">
|
|
64
|
-
<to-tag v-for="(ipoint, pointIndex) in item.point" :key="pointIndex" :type="size === 'large' ? 'dot' : ''" :color="pointColor(ipoint.type)" :fillet="size === 'large' ? '' : 'round'">{{ ipoint.count }}</to-tag>
|
|
65
|
-
</span>
|
|
66
|
-
</slot>
|
|
67
|
-
</li>
|
|
68
|
-
</ul>
|
|
69
|
-
</div>
|
|
70
|
-
<!-- 日期 结束 -->
|
|
71
|
-
<div v-if="legend" class="to-calendar-legend">
|
|
72
|
-
<slot name="legend">
|
|
73
|
-
<to-tag type="dot" color="danger">逾期未完成</to-tag>
|
|
74
|
-
<to-tag type="dot" color="primary">正常进行中</to-tag>
|
|
75
|
-
<to-tag type="dot" color="success">已完成</to-tag>
|
|
76
|
-
</slot>
|
|
77
|
-
</div>
|
|
78
|
-
<!-- 时间 开始 -->
|
|
79
|
-
<div v-if="type === 'datetime' || type === 'time'" class="time">
|
|
80
|
-
<div class="input">
|
|
81
|
-
<to-input v-model="hour" type="number" mode="none" :placeholder="t('to.calendar.time.hPlaceholder')" width="full" :maxlength="2" :max="maxHour" :min="0" @click.native="showTimeLayer"></to-input>
|
|
82
|
-
</div>
|
|
83
|
-
<span class="text">:</span>
|
|
84
|
-
<span class="input">
|
|
85
|
-
<to-input v-model="minute" type="number" mode="none" :placeholder="t('to.calendar.time.mPlaceholder')" width="full" :maxlength="2" :max="new Date(max).getMinutes()" :min="0" @click.native="showTimeLayer"></to-input>
|
|
86
|
-
</span>
|
|
87
|
-
<span class="text">:</span>
|
|
88
|
-
<span class="input">
|
|
89
|
-
<to-input v-model="second" type="number" mode="none" :placeholder="t('to.calendar.time.sPlaceholder')" width="full" :maxlength="2" :max="new Date(max).getSeconds()" :min="0" @click.native="showTimeLayer"></to-input>
|
|
90
|
-
</span>
|
|
91
|
-
<to-button color="primary" @click="selectTime">{{ t('to.common.confirm') }}</to-button>
|
|
92
|
-
<div v-show="timeLayer" class="option">
|
|
93
|
-
<to-header :title="t('to.calendar.time.title')" color="primary" mode="fill">
|
|
94
|
-
<to-button mode="none" color="bg" icon="close" @click="closeTimeLayer"></to-button>
|
|
95
|
-
</to-header>
|
|
96
|
-
<div class="content">
|
|
97
|
-
<to-scroll ref="hourScroll" :vitrual="!$phone &&! $pad" bar-display="hover">
|
|
98
|
-
<to-padding :value="0.5">
|
|
99
|
-
<to-grid :col="2">
|
|
100
|
-
<to-grid-item v-for="item in hours" :key="item">
|
|
101
|
-
<to-card v-dis="isDisableHour(item)" fillet="normal" :color="hour === item ? 'warning' : 'default'" :mode="hour === item ? 'fill' : 'none'" link @click="hour = item;">{{ item }}</to-card>
|
|
102
|
-
</to-grid-item>
|
|
103
|
-
</to-grid>
|
|
104
|
-
</to-padding>
|
|
105
|
-
</to-scroll>
|
|
106
|
-
<to-scroll ref="minuteScroll" :vitrual="!$phone &&! $pad" bar-display="hover">
|
|
107
|
-
<to-padding :value="0.5">
|
|
108
|
-
<to-grid :col="2">
|
|
109
|
-
<to-grid-item v-for="item in minutes" :key="item">
|
|
110
|
-
<to-card v-dis="isDisableMinute(item)" fillet="normal" :color="minute === item ? 'warning' : 'default'" :mode="minute === item ? 'fill' : 'none'" link @click="minute = item;">{{ item }}</to-card>
|
|
111
|
-
</to-grid-item>
|
|
112
|
-
</to-grid>
|
|
113
|
-
</to-padding>
|
|
114
|
-
</to-scroll>
|
|
115
|
-
<to-scroll ref="secondScroll" :vitrual="!$phone &&! $pad" bar-display="hover">
|
|
116
|
-
<to-padding :value="0.5">
|
|
117
|
-
<to-grid :col="2">
|
|
118
|
-
<to-grid-item v-for="item in seconds" :key="item">
|
|
119
|
-
<to-card v-dis="isDisableSecond(item)" fillet="normal" :color="second === item ? 'warning' : 'default'" :mode="second === item ? 'fill' : 'none'" link @click="second = item;">{{ item }}</to-card>
|
|
120
|
-
</to-grid-item>
|
|
121
|
-
</to-grid>
|
|
122
|
-
</to-padding>
|
|
123
|
-
</to-scroll>
|
|
124
|
-
</div>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
<!-- 时间 结束 -->
|
|
128
|
-
</div>
|
|
129
|
-
</template>
|
|
130
|
-
<script>
|
|
131
|
-
import Locale from 'ai.touchui-vue/src/mixins/locale'
|
|
132
|
-
export default {
|
|
133
|
-
|
|
134
|
-
// 注:下列注释中,“当前” 是指控件所处的日期/时间,“现在” 则是指实际所处的日期/时间
|
|
135
|
-
name: 'ToCalendar',
|
|
136
|
-
componentName: 'ToCalendar',
|
|
137
|
-
filters: {
|
|
138
|
-
addZero: function(str) {
|
|
139
|
-
return ('00' + str).substr(str.toString().length);
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
mixins: [Locale],
|
|
143
|
-
model: {
|
|
144
|
-
event: 'change'
|
|
145
|
-
},
|
|
146
|
-
props: {
|
|
147
|
-
// 假期,用于显示假期标识
|
|
148
|
-
// ['2024-04-03', '2024-04-04', '2024-04-05']
|
|
149
|
-
holiday: {
|
|
150
|
-
type: Array,
|
|
151
|
-
default() {
|
|
152
|
-
return []
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
// 重点日期(比如这天有待办之类的)
|
|
156
|
-
// [
|
|
157
|
-
// {
|
|
158
|
-
// day: '2024-04-02',
|
|
159
|
-
// tooltip: 'test',
|
|
160
|
-
// count: 1
|
|
161
|
-
// },
|
|
162
|
-
// {
|
|
163
|
-
// day: '2024-04-07',
|
|
164
|
-
// tooltip: 'test',
|
|
165
|
-
// count: 1
|
|
166
|
-
// }
|
|
167
|
-
// ]
|
|
168
|
-
point: {
|
|
169
|
-
type: Array,
|
|
170
|
-
default() {
|
|
171
|
-
return []
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
type: {
|
|
175
|
-
type: String,
|
|
176
|
-
default: ''
|
|
177
|
-
},
|
|
178
|
-
// 大小,支持 large
|
|
179
|
-
size: {
|
|
180
|
-
type: String,
|
|
181
|
-
default: ''
|
|
182
|
-
},
|
|
183
|
-
// 是否显示 point 提示信息
|
|
184
|
-
legend: Boolean,
|
|
185
|
-
value: {
|
|
186
|
-
type: [String, Date],
|
|
187
|
-
default() {
|
|
188
|
-
return ''
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
// 范围类型
|
|
192
|
-
// 开始:''
|
|
193
|
-
// 结束:'end'
|
|
194
|
-
rangeType: {
|
|
195
|
-
type: String,
|
|
196
|
-
default: ''
|
|
197
|
-
},
|
|
198
|
-
range: Boolean,
|
|
199
|
-
time: {
|
|
200
|
-
type: String,
|
|
201
|
-
default: ''
|
|
202
|
-
},
|
|
203
|
-
beforeChange: {
|
|
204
|
-
type: Function,
|
|
205
|
-
default: null
|
|
206
|
-
},
|
|
207
|
-
min: {
|
|
208
|
-
type: [String, Date, Number],
|
|
209
|
-
default: ''
|
|
210
|
-
},
|
|
211
|
-
max: {
|
|
212
|
-
type: [String, Date, Number],
|
|
213
|
-
default: ''
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
data() {
|
|
217
|
-
return {
|
|
218
|
-
|
|
219
|
-
// 缓存值
|
|
220
|
-
changeFrom: 'out',
|
|
221
|
-
submitValue: '',
|
|
222
|
-
|
|
223
|
-
// 现在时间记录
|
|
224
|
-
curYear: new Date().getFullYear(),
|
|
225
|
-
curMonth: new Date().getMonth() + 1,
|
|
226
|
-
curDay: new Date().getDate(),
|
|
227
|
-
|
|
228
|
-
// 默认值
|
|
229
|
-
year: '',
|
|
230
|
-
month: '',
|
|
231
|
-
day: '',
|
|
232
|
-
hour: '',
|
|
233
|
-
minute: '',
|
|
234
|
-
second: '',
|
|
235
|
-
|
|
236
|
-
// 页面数据
|
|
237
|
-
years: [],
|
|
238
|
-
days: [],
|
|
239
|
-
hours: [],
|
|
240
|
-
minutes: [],
|
|
241
|
-
seconds: [],
|
|
242
|
-
|
|
243
|
-
// 选择层
|
|
244
|
-
monthLayer: false,
|
|
245
|
-
timeLayer: false,
|
|
246
|
-
|
|
247
|
-
// 年份切换器
|
|
248
|
-
tempYear: 0, // 临时当前年,选择年月的时候,在选月份之前,年份是尚未确定的
|
|
249
|
-
yearsPage: 0,
|
|
250
|
-
now: new Date(),
|
|
251
|
-
|
|
252
|
-
// 范围
|
|
253
|
-
start: {
|
|
254
|
-
year: '',
|
|
255
|
-
month: '',
|
|
256
|
-
day: ''
|
|
257
|
-
},
|
|
258
|
-
end: {
|
|
259
|
-
year: '',
|
|
260
|
-
month: '',
|
|
261
|
-
day: ''
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
},
|
|
265
|
-
computed: {
|
|
266
|
-
dayText() {
|
|
267
|
-
const that = this
|
|
268
|
-
return function(val) {
|
|
269
|
-
// 凡是假期,都加上标记
|
|
270
|
-
const dayStr = that.year + '-' + that.addZero(that.month) + '-' + that.addZero(val)
|
|
271
|
-
if (that.holiday.length > 0 && that.holiday.indexOf(dayStr) > -1) {
|
|
272
|
-
return that.t('to.calendar.day.holiday')
|
|
273
|
-
} else {
|
|
274
|
-
return val
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
pointColor() {
|
|
279
|
-
return function(val) {
|
|
280
|
-
if (val === -1) {
|
|
281
|
-
return 'danger'
|
|
282
|
-
}
|
|
283
|
-
if (val === 0) {
|
|
284
|
-
return 'primary'
|
|
285
|
-
}
|
|
286
|
-
if (val === 1) {
|
|
287
|
-
return 'success'
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
},
|
|
291
|
-
hourz: {
|
|
292
|
-
get() {
|
|
293
|
-
return this.addZero(this.hour)
|
|
294
|
-
},
|
|
295
|
-
set(val) {
|
|
296
|
-
this.hour = String(val)
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
minutez: {
|
|
300
|
-
get() {
|
|
301
|
-
return this.addZero(this.minute)
|
|
302
|
-
},
|
|
303
|
-
set(val) {
|
|
304
|
-
this.minute = String(val)
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
secondz: {
|
|
308
|
-
get() {
|
|
309
|
-
return this.addZero(this.second)
|
|
310
|
-
},
|
|
311
|
-
set(val) {
|
|
312
|
-
this.second = String(val)
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
iValue() {
|
|
316
|
-
if (this.range) {
|
|
317
|
-
const start = (this.start.day || this.start.month) ? this.getStringValue(this.start) : ''
|
|
318
|
-
const end = (this.end.day || this.end.month) ? this.getStringValue(this.end) : ''
|
|
319
|
-
return `${start},${end}`
|
|
320
|
-
} else {
|
|
321
|
-
return this.getStringValue()
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
maxHour() {
|
|
325
|
-
let max = ''
|
|
326
|
-
if (typeof this.max === 'string') {
|
|
327
|
-
max = this.max.replace(/-/gi, '/')
|
|
328
|
-
} else {
|
|
329
|
-
max = this.max
|
|
330
|
-
}
|
|
331
|
-
return new Date(max).getHours()
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
isDisableDay() {
|
|
335
|
-
return (item) => {
|
|
336
|
-
if (this.year && this.month) {
|
|
337
|
-
let dateString = `${this.year}/${this.month}/${Number(item.value) + 1}`
|
|
338
|
-
let min = ''
|
|
339
|
-
// 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
|
|
340
|
-
if (typeof this.min === 'string') {
|
|
341
|
-
min = this.min.replace(/-/gi, '/')
|
|
342
|
-
} else {
|
|
343
|
-
min = this.min
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
let max = ''
|
|
347
|
-
if (typeof this.max === 'string') {
|
|
348
|
-
max = this.max.replace(/-/gi, '/')
|
|
349
|
-
} else {
|
|
350
|
-
max = this.max
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
return new Date(dateString) <= new Date(min) || new Date(dateString) > new Date(max)
|
|
354
|
-
} else {
|
|
355
|
-
return false
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
|
|
360
|
-
isDisableHour() {
|
|
361
|
-
return (item) => {
|
|
362
|
-
if (this.year && this.month && this.day) {
|
|
363
|
-
let dateString = `${this.year}/${this.month}/${this.day} ${Number(item) + 1}:00:00`
|
|
364
|
-
let min = ''
|
|
365
|
-
// 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
|
|
366
|
-
if (typeof this.min === 'string') {
|
|
367
|
-
min = this.min.replace(/-/gi, '/')
|
|
368
|
-
} else {
|
|
369
|
-
min = this.min
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
let max = ''
|
|
373
|
-
if (typeof this.max === 'string') {
|
|
374
|
-
max = this.max.replace(/-/gi, '/')
|
|
375
|
-
} else {
|
|
376
|
-
max = this.max
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
return new Date(dateString) <= new Date(min) || new Date(dateString) > new Date(max)
|
|
380
|
-
} else {
|
|
381
|
-
return false
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
},
|
|
385
|
-
isDisableMinute() {
|
|
386
|
-
return (item) => {
|
|
387
|
-
if (this.year && this.month && this.day && this.hour) {
|
|
388
|
-
let dateString = `${this.year}/${this.month}/${this.day} ${this.hour}:${Number(item) + 1}:00`
|
|
389
|
-
let min = ''
|
|
390
|
-
// 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
|
|
391
|
-
if (typeof this.min === 'string') {
|
|
392
|
-
min = this.min.replace(/-/gi, '/')
|
|
393
|
-
} else {
|
|
394
|
-
min = this.min
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
let max = ''
|
|
398
|
-
if (typeof this.max === 'string') {
|
|
399
|
-
max = this.max.replace(/-/gi, '/')
|
|
400
|
-
} else {
|
|
401
|
-
max = this.max
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
return new Date(dateString) < new Date(min) || new Date(dateString) > new Date(max)
|
|
405
|
-
} else {
|
|
406
|
-
return false
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
isDisableSecond() {
|
|
411
|
-
return (item) => {
|
|
412
|
-
if (this.year && this.month && this.day && this.hour && this.minute) {
|
|
413
|
-
let dateString = `${this.year}/${this.month}/${this.day} ${this.hour}:${this.minute}:${Number(item) + 1}`
|
|
414
|
-
let min = ''
|
|
415
|
-
// 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
|
|
416
|
-
if (typeof this.min === 'string') {
|
|
417
|
-
min = this.min.replace(/-/gi, '/')
|
|
418
|
-
} else {
|
|
419
|
-
min = this.min
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
let max = ''
|
|
423
|
-
if (typeof this.max === 'string') {
|
|
424
|
-
max = this.max.replace(/-/gi, '/')
|
|
425
|
-
} else {
|
|
426
|
-
max = this.max
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
return new Date(dateString) < new Date(min) || new Date(dateString) > new Date(max)
|
|
430
|
-
} else {
|
|
431
|
-
return false
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
watch: {
|
|
437
|
-
value(val) {
|
|
438
|
-
this.setData()
|
|
439
|
-
if (this.changeFrom === 'out') {
|
|
440
|
-
this.submitValue = val
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
submitValue(val) {
|
|
444
|
-
this.$emit('change', val)
|
|
445
|
-
this.changeFrom = 'in'
|
|
446
|
-
setTimeout(() => {
|
|
447
|
-
this.changeFrom = 'out'
|
|
448
|
-
}, 100);
|
|
449
|
-
},
|
|
450
|
-
min(val) {
|
|
451
|
-
this.min = val
|
|
452
|
-
},
|
|
453
|
-
max(val) {
|
|
454
|
-
this.max = val
|
|
455
|
-
},
|
|
456
|
-
point: {
|
|
457
|
-
handler() {
|
|
458
|
-
this.setDayData()
|
|
459
|
-
},
|
|
460
|
-
deep: true
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
created() {
|
|
464
|
-
this.setData()
|
|
465
|
-
},
|
|
466
|
-
methods: {
|
|
467
|
-
initCalendar() {
|
|
468
|
-
if (this.type === 'time') {
|
|
469
|
-
this.showTimeLayer()
|
|
470
|
-
} else {
|
|
471
|
-
this.timeLayer = false
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
// 根据 obj 获取当前时间值,入参格式形如:
|
|
475
|
-
// arg = {
|
|
476
|
-
// year: '2022',
|
|
477
|
-
// month: '02',
|
|
478
|
-
// day: '22'
|
|
479
|
-
// }
|
|
480
|
-
getValue(arg) {
|
|
481
|
-
return new Date(`${arg.year || this.year}/${arg.month || this.month}/${arg.day || this.day || '01'}`).getTime()
|
|
482
|
-
},
|
|
483
|
-
|
|
484
|
-
// 获取格式化为字符串后的日期
|
|
485
|
-
getStringValue(arg = {}) {
|
|
486
|
-
const year = arg.year || this.year
|
|
487
|
-
const month = arg.month || this.month
|
|
488
|
-
const day = arg.day || this.day
|
|
489
|
-
const hour = arg.hour || this.hourz
|
|
490
|
-
const minute = arg.minute || this.minutez
|
|
491
|
-
const second = arg.second || this.secondz
|
|
492
|
-
const imonth = `${year}-${this.addZero(month)}`
|
|
493
|
-
const iday = day ? `${this.addZero(day)}` : '01'
|
|
494
|
-
const itime = `${hour}:${minute}:${second}`
|
|
495
|
-
if (this.type === 'month') {
|
|
496
|
-
return imonth
|
|
497
|
-
} else if (this.type === 'datetime' || this.type === 'time') {
|
|
498
|
-
return `${imonth}-${iday} ${itime}`
|
|
499
|
-
} else {
|
|
500
|
-
return `${imonth}-${iday}`
|
|
501
|
-
}
|
|
502
|
-
},
|
|
503
|
-
|
|
504
|
-
// 获取格式化为对象的日期
|
|
505
|
-
getObjectValue(str) {
|
|
506
|
-
const date = new Date(str)
|
|
507
|
-
// eslint-disable-next-line no-debugger
|
|
508
|
-
if (this.isDate(str) && str) {
|
|
509
|
-
return {
|
|
510
|
-
year: date.getFullYear(),
|
|
511
|
-
month: date.getMonth() + 1,
|
|
512
|
-
day: date.getDate()
|
|
513
|
-
}
|
|
514
|
-
} else if (this.isMonth(str) && str) {
|
|
515
|
-
return {
|
|
516
|
-
year: date.getFullYear(),
|
|
517
|
-
month: date.getMonth() + 1,
|
|
518
|
-
day: ''
|
|
519
|
-
}
|
|
520
|
-
} else {
|
|
521
|
-
return {
|
|
522
|
-
year: '',
|
|
523
|
-
month: '',
|
|
524
|
-
day: ''
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
|
|
529
|
-
// 数据设置
|
|
530
|
-
setData() {
|
|
531
|
-
this.setCurrent()
|
|
532
|
-
this.setYearData()
|
|
533
|
-
this.setDayData()
|
|
534
|
-
this.setTimeData()
|
|
535
|
-
},
|
|
536
|
-
setCurrent() {
|
|
537
|
-
this.year = ''
|
|
538
|
-
this.month = ''
|
|
539
|
-
this.day = ''
|
|
540
|
-
if (this.range) {
|
|
541
|
-
let arr = this.value.split(',')
|
|
542
|
-
const start = arr[0]
|
|
543
|
-
const end = arr[1]
|
|
544
|
-
|
|
545
|
-
if (!start || this.isDate(start) || this.isMonth(start)) {
|
|
546
|
-
this.start = this.getObjectValue(start)
|
|
547
|
-
}
|
|
548
|
-
if (!end || this.isDate(end) || this.isMonth(end)) {
|
|
549
|
-
this.end = this.getObjectValue(end)
|
|
550
|
-
}
|
|
551
|
-
if (this.rangeType === 'end') {
|
|
552
|
-
this.year = this.year || new Date().getFullYear()
|
|
553
|
-
if ((this.end.day || this.end.month) && this.isAnyDate(this.getStringValue(this.end))) {
|
|
554
|
-
if (this.type === 'month') {
|
|
555
|
-
if (this.start.year === this.end.year) {
|
|
556
|
-
this.year = this.end.year + 1
|
|
557
|
-
} else {
|
|
558
|
-
this.year = this.end.year
|
|
559
|
-
}
|
|
560
|
-
this.month = 1
|
|
561
|
-
} else {
|
|
562
|
-
if (this.start.month === this.end.month) {
|
|
563
|
-
if (Number(this.month) === 12) {
|
|
564
|
-
this.year = this.end.year + 1
|
|
565
|
-
this.month = 1
|
|
566
|
-
} else {
|
|
567
|
-
this.month = this.end.month + 1
|
|
568
|
-
}
|
|
569
|
-
} else {
|
|
570
|
-
this.month = this.end.month
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
} else {
|
|
574
|
-
this.month = this.month || new Date().getMonth() + 2
|
|
575
|
-
}
|
|
576
|
-
if (this.month > 12) {
|
|
577
|
-
this.month = 1
|
|
578
|
-
this.year += 1
|
|
579
|
-
}
|
|
580
|
-
} else {
|
|
581
|
-
if ((this.start.day || this.start.month) && this.isAnyDate(this.getStringValue(this.start))) {
|
|
582
|
-
this.year = this.start.year
|
|
583
|
-
this.month = this.start.month
|
|
584
|
-
} else {
|
|
585
|
-
this.year = this.year || new Date().getFullYear()
|
|
586
|
-
this.month = this.month || new Date().getMonth() + 1
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
} else {
|
|
590
|
-
if (this.value && !isNaN(new Date(this.value))) {
|
|
591
|
-
this.year = new Date(this.value).getFullYear()
|
|
592
|
-
this.month = new Date(this.value).getMonth() + 1
|
|
593
|
-
this.day = new Date(this.value).getDate()
|
|
594
|
-
this.hour = String(new Date(this.value).getHours())
|
|
595
|
-
this.minute = String(new Date(this.value).getMinutes())
|
|
596
|
-
this.second = String(new Date(this.value).getSeconds())
|
|
597
|
-
} else if (this.value && isNaN(new Date(this.value)) && !isNaN(new Date(this.value.replace(/-/g, '/')))) {
|
|
598
|
-
const value = this.value.replace(/-/g, '/')
|
|
599
|
-
this.year = new Date(value).getFullYear()
|
|
600
|
-
this.month = new Date(value).getMonth() + 1
|
|
601
|
-
this.day = new Date(value).getDate()
|
|
602
|
-
this.hour = String(new Date(value).getHours())
|
|
603
|
-
this.minute = String(new Date(value).getMinutes())
|
|
604
|
-
this.second = String(new Date(value).getSeconds())
|
|
605
|
-
} else {
|
|
606
|
-
this.year = new Date().getFullYear()
|
|
607
|
-
this.month = new Date().getMonth() + 1
|
|
608
|
-
this.day = null
|
|
609
|
-
this.hour = '0'
|
|
610
|
-
this.minute = '0'
|
|
611
|
-
this.second = '0'
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
},
|
|
615
|
-
setYearData(year) {
|
|
616
|
-
year = year || this.year
|
|
617
|
-
let arr = [];
|
|
618
|
-
for (let i = 0; i < 10; i++) {
|
|
619
|
-
arr.push(Math.floor(year / 10) * 10 + i)
|
|
620
|
-
}
|
|
621
|
-
this.years = arr;
|
|
622
|
-
},
|
|
623
|
-
setDayData() {
|
|
624
|
-
let year = new Date(this.value).getFullYear()
|
|
625
|
-
let month = new Date(this.value).getMonth() + 1
|
|
626
|
-
let day = new Date(this.value).getDate()
|
|
627
|
-
const that = this
|
|
628
|
-
if (this.year === year && this.month === month) {
|
|
629
|
-
this.day = day
|
|
630
|
-
} else {
|
|
631
|
-
this.day = null
|
|
632
|
-
}
|
|
633
|
-
// 计算本月天数
|
|
634
|
-
const dayCount = this.getMonthDays(`${this.year}/${this.month}/1`);
|
|
635
|
-
|
|
636
|
-
// 计算前面有几天应该置空
|
|
637
|
-
const thisMonthFirstDay = new Date(`${this.year}/${this.month}/1`);
|
|
638
|
-
thisMonthFirstDay.setMonth(thisMonthFirstDay.getMonth(), 1);
|
|
639
|
-
const emptyLength = new Date(thisMonthFirstDay.setMonth(thisMonthFirstDay.getMonth(), 1)).getDay();
|
|
640
|
-
|
|
641
|
-
// 设置天数
|
|
642
|
-
this.days = (function() {
|
|
643
|
-
let arr = [];
|
|
644
|
-
for (let i = 0; i < emptyLength; i++) {
|
|
645
|
-
arr.push({});
|
|
646
|
-
}
|
|
647
|
-
for (let i = 1; i < dayCount + 1; i++) {
|
|
648
|
-
let obj = {};
|
|
649
|
-
obj.value = i;
|
|
650
|
-
|
|
651
|
-
// 星期天
|
|
652
|
-
if ((i + emptyLength) % 7 === 1) {
|
|
653
|
-
obj.sun = true;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// 星期六
|
|
657
|
-
if ((i + emptyLength) % 7 === 0) {
|
|
658
|
-
obj.sat = true;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
// 重点日期
|
|
662
|
-
const point = that.point.filter((item)=>{return item.day === `${that.year}-${that.addZero(that.month)}-${that.addZero(i)}`})
|
|
663
|
-
obj.point = point
|
|
664
|
-
|
|
665
|
-
arr.push(obj);
|
|
666
|
-
}
|
|
667
|
-
return arr;
|
|
668
|
-
})();
|
|
669
|
-
},
|
|
670
|
-
setTimeData() {
|
|
671
|
-
this.hours = this.genNumbers(0, 23)
|
|
672
|
-
this.minutes = this.genNumbers(0, 59)
|
|
673
|
-
this.seconds = this.genNumbers(0, 59)
|
|
674
|
-
const hour = String(new Date(this.value).getHours())
|
|
675
|
-
const minute = String(new Date(this.value).getMinutes())
|
|
676
|
-
const second = String(new Date(this.value).getSeconds())
|
|
677
|
-
if (this.time) {
|
|
678
|
-
const arr = this.time.split(':')
|
|
679
|
-
this.hour = arr[0] || '0'
|
|
680
|
-
this.minute = arr[1] || '0'
|
|
681
|
-
this.second = arr[2] || '0'
|
|
682
|
-
}
|
|
683
|
-
if (!isNaN(hour) && !isNaN(minute) && !isNaN(second)) {
|
|
684
|
-
this.hour = hour
|
|
685
|
-
this.minute = minute
|
|
686
|
-
this.second = second
|
|
687
|
-
}
|
|
688
|
-
},
|
|
689
|
-
|
|
690
|
-
// 选择事件
|
|
691
|
-
selectYear(item) {
|
|
692
|
-
this.year = item
|
|
693
|
-
},
|
|
694
|
-
selectMonth(item) {
|
|
695
|
-
if (item) {
|
|
696
|
-
if (this.range && this.type === 'month') {
|
|
697
|
-
let start = {}
|
|
698
|
-
let end = {}
|
|
699
|
-
if (!this.start.month && !this.end.month) {
|
|
700
|
-
start.year = this.year
|
|
701
|
-
start.month = item
|
|
702
|
-
start.day = ''
|
|
703
|
-
}
|
|
704
|
-
if (this.start.month) {
|
|
705
|
-
if (this.end.month) {
|
|
706
|
-
start.year = this.year
|
|
707
|
-
start.month = item
|
|
708
|
-
start.day = ''
|
|
709
|
-
end.year = ''
|
|
710
|
-
end.month = ''
|
|
711
|
-
end.day = ''
|
|
712
|
-
} else {
|
|
713
|
-
if (this.getValue(this.start) > this.getValue({month: item})) {
|
|
714
|
-
end.year = this.start.year
|
|
715
|
-
end.month = this.start.month
|
|
716
|
-
end.day = ''
|
|
717
|
-
start.year = this.year
|
|
718
|
-
start.month = item
|
|
719
|
-
start.day = ''
|
|
720
|
-
} else {
|
|
721
|
-
start = JSON.parse(JSON.stringify(this.start))
|
|
722
|
-
end.year = this.year
|
|
723
|
-
end.month = item
|
|
724
|
-
end.day = ''
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
this.start = JSON.parse(JSON.stringify(start))
|
|
729
|
-
this.end = JSON.parse(JSON.stringify(end))
|
|
730
|
-
this.submitValue = this.iValue
|
|
731
|
-
} else {
|
|
732
|
-
if (this.type === 'month') {
|
|
733
|
-
this.$emit('beforeChange', this.getStringValue({
|
|
734
|
-
month: item
|
|
735
|
-
}))
|
|
736
|
-
}
|
|
737
|
-
if (this.beforeChange) {
|
|
738
|
-
const fn = this.beforeChange(this.getStringValue({
|
|
739
|
-
month: item
|
|
740
|
-
}))
|
|
741
|
-
if (fn && fn.then) {
|
|
742
|
-
fn.then(flag => {
|
|
743
|
-
this.selectMonthAction(item)
|
|
744
|
-
}).catch((e)=>{})
|
|
745
|
-
} else {
|
|
746
|
-
// 是同步方法,则返回为 true 执行
|
|
747
|
-
if (fn) {
|
|
748
|
-
this.selectMonthAction(item)
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
} else {
|
|
752
|
-
this.selectMonthAction(item)
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
},
|
|
757
|
-
selectMonthAction(item) {
|
|
758
|
-
this.month = item;
|
|
759
|
-
this.monthLayer = false;
|
|
760
|
-
this.setDayData();
|
|
761
|
-
if (this.type === 'month') {
|
|
762
|
-
this.day = 1
|
|
763
|
-
this.submitValue = this.iValue
|
|
764
|
-
}
|
|
765
|
-
},
|
|
766
|
-
selectDay(item) {
|
|
767
|
-
if (item.value) {
|
|
768
|
-
if (this.range) {
|
|
769
|
-
let start = {}
|
|
770
|
-
let end = {}
|
|
771
|
-
if (!this.start.day && !this.end.day) {
|
|
772
|
-
start.year = this.year
|
|
773
|
-
start.month = this.month
|
|
774
|
-
start.day = item.value
|
|
775
|
-
}
|
|
776
|
-
if (this.start.day) {
|
|
777
|
-
if (this.end.day) {
|
|
778
|
-
start.year = this.year
|
|
779
|
-
start.month = this.month
|
|
780
|
-
start.day = item.value
|
|
781
|
-
end.year = ''
|
|
782
|
-
end.month = ''
|
|
783
|
-
end.day = ''
|
|
784
|
-
} else {
|
|
785
|
-
if (this.getValue(this.start) > this.getValue({day: item.value})) {
|
|
786
|
-
end.year = this.start.year
|
|
787
|
-
end.month = this.start.month
|
|
788
|
-
end.day = this.start.day
|
|
789
|
-
start.year = this.year
|
|
790
|
-
start.month = this.month
|
|
791
|
-
start.day = item.value
|
|
792
|
-
} else {
|
|
793
|
-
start = JSON.parse(JSON.stringify(this.start))
|
|
794
|
-
end.year = this.year
|
|
795
|
-
end.month = this.month
|
|
796
|
-
end.day = item.value
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
this.start = JSON.parse(JSON.stringify(start))
|
|
801
|
-
this.end = JSON.parse(JSON.stringify(end))
|
|
802
|
-
this.submitValue = this.iValue
|
|
803
|
-
}
|
|
804
|
-
else {
|
|
805
|
-
let val = this.getStringValue({
|
|
806
|
-
day: item.value
|
|
807
|
-
})
|
|
808
|
-
if (!this.type || this.type === 'date') {
|
|
809
|
-
this.$emit('beforeChange', val)
|
|
810
|
-
if (this.beforeChange) {
|
|
811
|
-
const fn = this.beforeChange(this.getStringValue({
|
|
812
|
-
day: item.value
|
|
813
|
-
}))
|
|
814
|
-
|
|
815
|
-
if (fn && fn.then) {
|
|
816
|
-
fn.then(flag => {
|
|
817
|
-
this.selectDayAction(item)
|
|
818
|
-
})
|
|
819
|
-
} else {
|
|
820
|
-
// 是同步方法,则返回为 true 执行
|
|
821
|
-
if (fn) {
|
|
822
|
-
this.selectDayAction(item)
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
} else {
|
|
826
|
-
this.selectDayAction(item)
|
|
827
|
-
}
|
|
828
|
-
} else {
|
|
829
|
-
this.selectDayAction(item)
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
},
|
|
834
|
-
selectDayAction(item) {
|
|
835
|
-
this.day = item.value
|
|
836
|
-
if (!this.type || this.type === 'date') {
|
|
837
|
-
this.submitValue = this.iValue
|
|
838
|
-
}
|
|
839
|
-
},
|
|
840
|
-
selectTime() {
|
|
841
|
-
if (!this.day && !this.min && !this.max) {
|
|
842
|
-
this.day = new Date().getDate()
|
|
843
|
-
} else if (!this.day && this.min && this.max) {
|
|
844
|
-
this.$tip.error(this.t('to.calendar.tip.error.selectDate'))
|
|
845
|
-
return
|
|
846
|
-
}
|
|
847
|
-
this.$emit('beforeChange', this.getStringValue())
|
|
848
|
-
if (this.beforeChange) {
|
|
849
|
-
|
|
850
|
-
const fn = this.beforeChange(this.getStringValue())
|
|
851
|
-
|
|
852
|
-
if (fn && fn.then) {
|
|
853
|
-
fn(this.getStringValue()).then(flag => {
|
|
854
|
-
this.selectTimeAction()
|
|
855
|
-
})
|
|
856
|
-
} else {
|
|
857
|
-
// 是同步方法,则返回为 true 执行
|
|
858
|
-
if (fn) {
|
|
859
|
-
this.selectTimeAction()
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
} else {
|
|
863
|
-
this.selectTimeAction()
|
|
864
|
-
}
|
|
865
|
-
},
|
|
866
|
-
selectTimeAction() {
|
|
867
|
-
this.timeLayer = false
|
|
868
|
-
this.submitValue = this.iValue
|
|
869
|
-
this.$emit('close')
|
|
870
|
-
},
|
|
871
|
-
// 样式设置
|
|
872
|
-
setYearClass(item) {
|
|
873
|
-
return {
|
|
874
|
-
cur: this.curYear === item,
|
|
875
|
-
on: this.year === item
|
|
876
|
-
};
|
|
877
|
-
},
|
|
878
|
-
setMonthClass(item) {
|
|
879
|
-
let arr = []
|
|
880
|
-
if (this.year === this.curYear && this.curMonth === item) {
|
|
881
|
-
arr.push('cur')
|
|
882
|
-
}
|
|
883
|
-
if (this.range && this.type === 'month') {
|
|
884
|
-
if (this.year === this.start.year && item === this.start.month) {
|
|
885
|
-
if (this.end.month) {
|
|
886
|
-
arr.push('start')
|
|
887
|
-
} else {
|
|
888
|
-
arr.push('on')
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
if (this.year === this.end.year && item === this.end.month) {
|
|
892
|
-
arr.push('end')
|
|
893
|
-
}
|
|
894
|
-
const value = this.getValue({
|
|
895
|
-
year: this.year,
|
|
896
|
-
month: item,
|
|
897
|
-
day: 1
|
|
898
|
-
})
|
|
899
|
-
if ((value > this.getValue(this.start) || value === this.getValue(this.start)) && value < this.getValue(this.end)) {
|
|
900
|
-
arr.push('range')
|
|
901
|
-
}
|
|
902
|
-
} else {
|
|
903
|
-
if (this.month === item) {
|
|
904
|
-
arr.push('on')
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
if (item && (this.min || this.max)) {
|
|
909
|
-
let curData = this.year + '/' + (item > 9 ? item : '0' + item) + '/01'
|
|
910
|
-
let date = new Date()
|
|
911
|
-
let hour = date.getHours()
|
|
912
|
-
let minute = date.getMinutes()
|
|
913
|
-
let second = date.getSeconds()
|
|
914
|
-
curData = curData + ' ' + (hour > 9 ? hour : '0' + hour) + ':' + (minute > 9 ? minute : '0' + minute) + ':' + (second > 9 ? second : '0' + second)
|
|
915
|
-
let curTime = new Date(curData).getTime()
|
|
916
|
-
let min = new Date(this.min).getTime()
|
|
917
|
-
let maxTime = new Date(this.max).getTime()
|
|
918
|
-
let cur = curData.split(' ')[0]
|
|
919
|
-
let year = new Date(this.max).getFullYear()
|
|
920
|
-
let month = new Date(this.max).getMonth() + 1
|
|
921
|
-
let day = new Date(this.max).getDate()
|
|
922
|
-
let max = year + '/' + (month > 9 ? month : '0' + month) + '/' + (day > 9 ? day : '0' + day)
|
|
923
|
-
if (min === maxTime && cur !== max) {
|
|
924
|
-
if (curTime > maxTime) {
|
|
925
|
-
arr.push('to-dis')
|
|
926
|
-
}
|
|
927
|
-
if (curTime < min) {
|
|
928
|
-
arr.push('to-dis')
|
|
929
|
-
}
|
|
930
|
-
} else if (min !== maxTime && cur !== max) {
|
|
931
|
-
if (curTime > maxTime) {
|
|
932
|
-
arr.push('to-dis')
|
|
933
|
-
}
|
|
934
|
-
if (curTime < min) {
|
|
935
|
-
arr.push('to-dis')
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
return arr;
|
|
940
|
-
},
|
|
941
|
-
setDayClass(item) {
|
|
942
|
-
let arr = []
|
|
943
|
-
if (item.sat) {
|
|
944
|
-
arr.push('sat')
|
|
945
|
-
}
|
|
946
|
-
if (item.sun) {
|
|
947
|
-
arr.push('sun')
|
|
948
|
-
}
|
|
949
|
-
if (this.year === this.curYear && this.month === this.curMonth && this.curDay === item.value) {
|
|
950
|
-
arr.push('cur')
|
|
951
|
-
}
|
|
952
|
-
if (this.range) {
|
|
953
|
-
if (this.year === this.start.year && this.month === this.start.month && item.value === this.start.day) {
|
|
954
|
-
if (this.end.day) {
|
|
955
|
-
arr.push('start')
|
|
956
|
-
} else {
|
|
957
|
-
arr.push('on')
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
if (this.year === this.end.year && this.month === this.end.month && item.value === this.end.day) {
|
|
961
|
-
arr.push('end')
|
|
962
|
-
}
|
|
963
|
-
const value = this.getValue({
|
|
964
|
-
year: this.year,
|
|
965
|
-
month: this.month,
|
|
966
|
-
day: item.value
|
|
967
|
-
})
|
|
968
|
-
if (value > this.getValue(this.start) && value < this.getValue(this.end)) {
|
|
969
|
-
arr.push('range')
|
|
970
|
-
}
|
|
971
|
-
} else {
|
|
972
|
-
if (this.day === item.value) {
|
|
973
|
-
arr.push('on')
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
return arr;
|
|
977
|
-
},
|
|
978
|
-
|
|
979
|
-
// 界面控制
|
|
980
|
-
nextMonth() {
|
|
981
|
-
if (this.month === 12) {
|
|
982
|
-
this.year += 1;
|
|
983
|
-
this.month = 1;
|
|
984
|
-
} else {
|
|
985
|
-
this.month += 1;
|
|
986
|
-
}
|
|
987
|
-
this.setDayData();
|
|
988
|
-
},
|
|
989
|
-
lastMonth() {
|
|
990
|
-
if (this.month === 1) {
|
|
991
|
-
this.year -= 1;
|
|
992
|
-
this.month = 12;
|
|
993
|
-
} else {
|
|
994
|
-
this.month -= 1;
|
|
995
|
-
}
|
|
996
|
-
this.setDayData();
|
|
997
|
-
},
|
|
998
|
-
lastYears() {
|
|
999
|
-
this.yearsPage -= 1;
|
|
1000
|
-
this.setYearData(this.year + 10 * this.yearsPage);
|
|
1001
|
-
},
|
|
1002
|
-
nextYears() {
|
|
1003
|
-
this.yearsPage += 1;
|
|
1004
|
-
this.setYearData(this.year + 10 * this.yearsPage);
|
|
1005
|
-
},
|
|
1006
|
-
nextYear() {
|
|
1007
|
-
this.year += 1
|
|
1008
|
-
let year = new Date(this.value).getFullYear()
|
|
1009
|
-
let month = new Date(this.value).getMonth() + 1
|
|
1010
|
-
let day = new Date(this.value).getDate()
|
|
1011
|
-
if (this.year === year && this.month === month) {
|
|
1012
|
-
this.day = day
|
|
1013
|
-
} else {
|
|
1014
|
-
this.day = null
|
|
1015
|
-
}
|
|
1016
|
-
},
|
|
1017
|
-
lastYear() {
|
|
1018
|
-
this.year -= 1
|
|
1019
|
-
let year = new Date(this.value).getFullYear()
|
|
1020
|
-
let month = new Date(this.value).getMonth() + 1
|
|
1021
|
-
let day = new Date(this.value).getDate()
|
|
1022
|
-
if (this.year === year && this.month === month) {
|
|
1023
|
-
this.day = day
|
|
1024
|
-
} else {
|
|
1025
|
-
this.day = null
|
|
1026
|
-
}
|
|
1027
|
-
},
|
|
1028
|
-
toggleMonthSelector() {
|
|
1029
|
-
if (!this.monthLayer) {
|
|
1030
|
-
// 打开
|
|
1031
|
-
this.monthLayer = true;
|
|
1032
|
-
this.tempYear = this.year;
|
|
1033
|
-
this.setYearData(this.year);
|
|
1034
|
-
} else {
|
|
1035
|
-
// 关闭
|
|
1036
|
-
this.monthLayer = false;
|
|
1037
|
-
}
|
|
1038
|
-
},
|
|
1039
|
-
showTimeLayer() {
|
|
1040
|
-
this.timeLayer = true;
|
|
1041
|
-
this.$nextTick(function() {
|
|
1042
|
-
this.$refs.hourScroll.adjust()
|
|
1043
|
-
this.$refs.minuteScroll.adjust()
|
|
1044
|
-
this.$refs.secondScroll.adjust()
|
|
1045
|
-
})
|
|
1046
|
-
},
|
|
1047
|
-
closeTimeLayer() {
|
|
1048
|
-
if (this.type === 'time') {
|
|
1049
|
-
this.timeLayer = false
|
|
1050
|
-
this.$emit('close')
|
|
1051
|
-
} else {
|
|
1052
|
-
this.timeLayer = false
|
|
1053
|
-
}
|
|
1054
|
-
},
|
|
1055
|
-
|
|
1056
|
-
// 内置方法
|
|
1057
|
-
// 验证日期格式
|
|
1058
|
-
isDate(date) {
|
|
1059
|
-
const DateExp = /^[1-2][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/
|
|
1060
|
-
if (DateExp.test(date)) {
|
|
1061
|
-
return (new Date(date).getDate() === Number(date.substring(date.length - 2)))
|
|
1062
|
-
} else {
|
|
1063
|
-
return false
|
|
1064
|
-
}
|
|
1065
|
-
},
|
|
1066
|
-
isMonth(date) {
|
|
1067
|
-
const DateExp = /^[1-2][0-9]{3}-(0[1-9]|1[0-2])$/
|
|
1068
|
-
if (DateExp.test(date)) {
|
|
1069
|
-
return (new Date(date + '-01').getDate() === Number(1))
|
|
1070
|
-
} else {
|
|
1071
|
-
return false
|
|
1072
|
-
}
|
|
1073
|
-
},
|
|
1074
|
-
isDatetime(time) {
|
|
1075
|
-
if (typeof time === 'string') {
|
|
1076
|
-
var reg = /^(\d{1,4})(-|\/)(\d{2})\2(\d{1,2}) (\d{2}):(\d{2}):(\d{2})$/;
|
|
1077
|
-
var r = time.match(reg);
|
|
1078
|
-
if (r == null) return false;
|
|
1079
|
-
var d = new Date(r[1], r[3] - 1, r[4], r[5], r[6], r[7]);
|
|
1080
|
-
return (d.getFullYear() === Number(r[1]) && (d.getMonth() + 1) === Number(r[3]) && d.getDate() === Number(r[4]) && d.getHours() === Number(r[5]) && d.getMinutes() === Number(r[6]) && d.getSeconds() === Number(r[7]));
|
|
1081
|
-
} else {
|
|
1082
|
-
return true
|
|
1083
|
-
}
|
|
1084
|
-
},
|
|
1085
|
-
isAnyDate(val) {
|
|
1086
|
-
if ((this.isDate(val) && (this.type === '')) || (this.isDatetime(val) && this.type === 'datetime') || (this.isMonth(val) && this.type === 'month')) {
|
|
1087
|
-
return true
|
|
1088
|
-
} else {
|
|
1089
|
-
return false
|
|
1090
|
-
}
|
|
1091
|
-
},
|
|
1092
|
-
|
|
1093
|
-
// 获取一个月的天数
|
|
1094
|
-
getMonthDays(date) {
|
|
1095
|
-
const thisMonthFirstDay = new Date(date);
|
|
1096
|
-
const nextMonthFirstDay = new Date(date);
|
|
1097
|
-
thisMonthFirstDay.setMonth(thisMonthFirstDay.getMonth(), 1);
|
|
1098
|
-
nextMonthFirstDay.setMonth(nextMonthFirstDay.getMonth() + 1, 1);
|
|
1099
|
-
return (nextMonthFirstDay.valueOf() - thisMonthFirstDay.valueOf()) / (1000 * 60 * 60 * 24);
|
|
1100
|
-
},
|
|
1101
|
-
// 格式化日期
|
|
1102
|
-
formatDate(date, fmt) {
|
|
1103
|
-
if (!fmt) {
|
|
1104
|
-
if (this.type === 'datetime') {
|
|
1105
|
-
fmt = 'yyyy-MM-dd HH:mm:ss'
|
|
1106
|
-
} else {
|
|
1107
|
-
fmt = 'yyyy-MM-dd'
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
if (/(y+)/.test(fmt)) {
|
|
1111
|
-
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
|
|
1112
|
-
}
|
|
1113
|
-
const o = {
|
|
1114
|
-
'M+': date.getMonth() + 1,
|
|
1115
|
-
'd+': date.getDate(),
|
|
1116
|
-
'H+': date.getHours(),
|
|
1117
|
-
'm+': date.getMinutes(),
|
|
1118
|
-
's+': date.getSeconds()
|
|
1119
|
-
};
|
|
1120
|
-
for (const k in o) {
|
|
1121
|
-
if (new RegExp('(' + k + ')').test(fmt)) {
|
|
1122
|
-
const str = o[k] + '';
|
|
1123
|
-
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : this.addZero(str));
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
return fmt;
|
|
1127
|
-
},
|
|
1128
|
-
// 生成循环数字
|
|
1129
|
-
genNumbers(min, max, step = 1) {
|
|
1130
|
-
let arr = []
|
|
1131
|
-
for (let i = min; i <= max; i += step) {
|
|
1132
|
-
arr.push(String(i))
|
|
1133
|
-
}
|
|
1134
|
-
return arr
|
|
1135
|
-
},
|
|
1136
|
-
// 给个位数的数字前面补 0
|
|
1137
|
-
addZero(str) {
|
|
1138
|
-
return ('00' + str).substr(str.toString().length);
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
};
|
|
1142
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="to-calendar" :class="{'to-calendar-type-month' : type === 'month', 'to-calendar-size-large' : size === 'large'}">
|
|
3
|
+
<!-- 头部 开始 -->
|
|
4
|
+
<div class="header">
|
|
5
|
+
<div class="prevYear" @click="lastYear"></div>
|
|
6
|
+
<div class="prev" @click="lastMonth"></div>
|
|
7
|
+
<div class="info" :class="{'info-unfold' : type !== 'month'}" @click="toggleMonthSelector">
|
|
8
|
+
<span class="year">{{ year }}</span>
|
|
9
|
+
<span class="month">{{ month | addZero }}</span>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="next" @click="nextMonth"></div>
|
|
12
|
+
<div class="nextYear" @click="nextYear"></div>
|
|
13
|
+
</div>
|
|
14
|
+
<!-- 头部 结束 -->
|
|
15
|
+
<!-- 年月选择 开始 -->
|
|
16
|
+
<div v-show="monthLayer || type === 'month'" class="select">
|
|
17
|
+
<div class="year">
|
|
18
|
+
<span class="prev" @click="lastYears"></span>
|
|
19
|
+
<ul>
|
|
20
|
+
<li v-for="(item, index) in years" :key="index" :class="setYearClass(item)" @click="selectYear(item)">
|
|
21
|
+
{{ item }}
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
<span class="next" @click="nextYears"></span>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="month">
|
|
27
|
+
<ul>
|
|
28
|
+
<li :class="setMonthClass(1)" @click="selectMonth(1)">{{ t('to.calendar.month.m1') }}</li>
|
|
29
|
+
<li :class="setMonthClass(2)" @click="selectMonth(2)">{{ t('to.calendar.month.m2') }}</li>
|
|
30
|
+
<li :class="setMonthClass(3)" @click="selectMonth(3)">{{ t('to.calendar.month.m3') }}</li>
|
|
31
|
+
<li :class="setMonthClass(4)" @click="selectMonth(4)">{{ t('to.calendar.month.m4') }}</li>
|
|
32
|
+
<li :class="setMonthClass(5)" @click="selectMonth(5)">{{ t('to.calendar.month.m5') }}</li>
|
|
33
|
+
<li :class="setMonthClass(6)" @click="selectMonth(6)">{{ t('to.calendar.month.m6') }}</li>
|
|
34
|
+
<li :class="setMonthClass(7)" @click="selectMonth(7)">{{ t('to.calendar.month.m7') }}</li>
|
|
35
|
+
<li :class="setMonthClass(8)" @click="selectMonth(8)">{{ t('to.calendar.month.m8') }}</li>
|
|
36
|
+
<li :class="setMonthClass(9)" @click="selectMonth(9)">{{ t('to.calendar.month.m9') }}</li>
|
|
37
|
+
<li :class="setMonthClass(10)" @click="selectMonth(10)">{{ t('to.calendar.month.m10') }}</li>
|
|
38
|
+
<li :class="setMonthClass(11)" @click="selectMonth(11)">{{ t('to.calendar.month.m11') }}</li>
|
|
39
|
+
<li :class="setMonthClass(12)" @click="selectMonth(12)">{{ t('to.calendar.month.m12') }}</li>
|
|
40
|
+
</ul>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<!-- 年月选择 结束-->
|
|
44
|
+
<!-- 周 开始 -->
|
|
45
|
+
<div v-if="type!=='month'" class="week">
|
|
46
|
+
<ul>
|
|
47
|
+
<li>{{ t('to.calendar.week.w0') }}</li>
|
|
48
|
+
<li>{{ t('to.calendar.week.w1') }}</li>
|
|
49
|
+
<li>{{ t('to.calendar.week.w2') }}</li>
|
|
50
|
+
<li>{{ t('to.calendar.week.w3') }}</li>
|
|
51
|
+
<li>{{ t('to.calendar.week.w4') }}</li>
|
|
52
|
+
<li>{{ t('to.calendar.week.w5') }}</li>
|
|
53
|
+
<li>{{ t('to.calendar.week.w6') }}</li>
|
|
54
|
+
</ul>
|
|
55
|
+
</div>
|
|
56
|
+
<!-- 周 结束 -->
|
|
57
|
+
<!-- 日期 开始 -->
|
|
58
|
+
<div v-if="type!=='month'" class="day">
|
|
59
|
+
<ul>
|
|
60
|
+
<li v-for="(item, index) in days" :key="index" v-tip="item.point && item.point.tooltip ? item.point.tooltip : ''" v-dis="isDisableDay(item)" :class="setDayClass(item)" @click="selectDay(item)">
|
|
61
|
+
<slot :item="item" :index="index">
|
|
62
|
+
<span v-if="item.value" class="solar">{{ dayText(item.value) }}</span>
|
|
63
|
+
<span v-if="item.point && item.point.length > 0" class="to-calendar-points">
|
|
64
|
+
<to-tag v-for="(ipoint, pointIndex) in item.point" :key="pointIndex" :type="size === 'large' ? 'dot' : ''" :color="pointColor(ipoint.type)" :fillet="size === 'large' ? '' : 'round'">{{ ipoint.count }}</to-tag>
|
|
65
|
+
</span>
|
|
66
|
+
</slot>
|
|
67
|
+
</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
<!-- 日期 结束 -->
|
|
71
|
+
<div v-if="legend" class="to-calendar-legend">
|
|
72
|
+
<slot name="legend">
|
|
73
|
+
<to-tag type="dot" color="danger">逾期未完成</to-tag>
|
|
74
|
+
<to-tag type="dot" color="primary">正常进行中</to-tag>
|
|
75
|
+
<to-tag type="dot" color="success">已完成</to-tag>
|
|
76
|
+
</slot>
|
|
77
|
+
</div>
|
|
78
|
+
<!-- 时间 开始 -->
|
|
79
|
+
<div v-if="type === 'datetime' || type === 'time'" class="time">
|
|
80
|
+
<div class="input">
|
|
81
|
+
<to-input v-model="hour" type="number" mode="none" :placeholder="t('to.calendar.time.hPlaceholder')" width="full" :maxlength="2" :max="maxHour" :min="0" @click.native="showTimeLayer"></to-input>
|
|
82
|
+
</div>
|
|
83
|
+
<span class="text">:</span>
|
|
84
|
+
<span class="input">
|
|
85
|
+
<to-input v-model="minute" type="number" mode="none" :placeholder="t('to.calendar.time.mPlaceholder')" width="full" :maxlength="2" :max="new Date(max).getMinutes()" :min="0" @click.native="showTimeLayer"></to-input>
|
|
86
|
+
</span>
|
|
87
|
+
<span class="text">:</span>
|
|
88
|
+
<span class="input">
|
|
89
|
+
<to-input v-model="second" type="number" mode="none" :placeholder="t('to.calendar.time.sPlaceholder')" width="full" :maxlength="2" :max="new Date(max).getSeconds()" :min="0" @click.native="showTimeLayer"></to-input>
|
|
90
|
+
</span>
|
|
91
|
+
<to-button color="primary" @click="selectTime">{{ t('to.common.confirm') }}</to-button>
|
|
92
|
+
<div v-show="timeLayer" class="option">
|
|
93
|
+
<to-header :title="t('to.calendar.time.title')" color="primary" mode="fill">
|
|
94
|
+
<to-button mode="none" color="bg" icon="close" @click="closeTimeLayer"></to-button>
|
|
95
|
+
</to-header>
|
|
96
|
+
<div class="content">
|
|
97
|
+
<to-scroll ref="hourScroll" :vitrual="!$phone &&! $pad" bar-display="hover">
|
|
98
|
+
<to-padding :value="0.5">
|
|
99
|
+
<to-grid :col="2">
|
|
100
|
+
<to-grid-item v-for="item in hours" :key="item">
|
|
101
|
+
<to-card v-dis="isDisableHour(item)" fillet="normal" :color="hour === item ? 'warning' : 'default'" :mode="hour === item ? 'fill' : 'none'" link @click="hour = item;">{{ item }}</to-card>
|
|
102
|
+
</to-grid-item>
|
|
103
|
+
</to-grid>
|
|
104
|
+
</to-padding>
|
|
105
|
+
</to-scroll>
|
|
106
|
+
<to-scroll ref="minuteScroll" :vitrual="!$phone &&! $pad" bar-display="hover">
|
|
107
|
+
<to-padding :value="0.5">
|
|
108
|
+
<to-grid :col="2">
|
|
109
|
+
<to-grid-item v-for="item in minutes" :key="item">
|
|
110
|
+
<to-card v-dis="isDisableMinute(item)" fillet="normal" :color="minute === item ? 'warning' : 'default'" :mode="minute === item ? 'fill' : 'none'" link @click="minute = item;">{{ item }}</to-card>
|
|
111
|
+
</to-grid-item>
|
|
112
|
+
</to-grid>
|
|
113
|
+
</to-padding>
|
|
114
|
+
</to-scroll>
|
|
115
|
+
<to-scroll ref="secondScroll" :vitrual="!$phone &&! $pad" bar-display="hover">
|
|
116
|
+
<to-padding :value="0.5">
|
|
117
|
+
<to-grid :col="2">
|
|
118
|
+
<to-grid-item v-for="item in seconds" :key="item">
|
|
119
|
+
<to-card v-dis="isDisableSecond(item)" fillet="normal" :color="second === item ? 'warning' : 'default'" :mode="second === item ? 'fill' : 'none'" link @click="second = item;">{{ item }}</to-card>
|
|
120
|
+
</to-grid-item>
|
|
121
|
+
</to-grid>
|
|
122
|
+
</to-padding>
|
|
123
|
+
</to-scroll>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
<!-- 时间 结束 -->
|
|
128
|
+
</div>
|
|
129
|
+
</template>
|
|
130
|
+
<script>
|
|
131
|
+
import Locale from 'ai.touchui-vue/src/mixins/locale'
|
|
132
|
+
export default {
|
|
133
|
+
|
|
134
|
+
// 注:下列注释中,“当前” 是指控件所处的日期/时间,“现在” 则是指实际所处的日期/时间
|
|
135
|
+
name: 'ToCalendar',
|
|
136
|
+
componentName: 'ToCalendar',
|
|
137
|
+
filters: {
|
|
138
|
+
addZero: function(str) {
|
|
139
|
+
return ('00' + str).substr(str.toString().length);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
mixins: [Locale],
|
|
143
|
+
model: {
|
|
144
|
+
event: 'change'
|
|
145
|
+
},
|
|
146
|
+
props: {
|
|
147
|
+
// 假期,用于显示假期标识
|
|
148
|
+
// ['2024-04-03', '2024-04-04', '2024-04-05']
|
|
149
|
+
holiday: {
|
|
150
|
+
type: Array,
|
|
151
|
+
default() {
|
|
152
|
+
return []
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
// 重点日期(比如这天有待办之类的)
|
|
156
|
+
// [
|
|
157
|
+
// {
|
|
158
|
+
// day: '2024-04-02',
|
|
159
|
+
// tooltip: 'test',
|
|
160
|
+
// count: 1
|
|
161
|
+
// },
|
|
162
|
+
// {
|
|
163
|
+
// day: '2024-04-07',
|
|
164
|
+
// tooltip: 'test',
|
|
165
|
+
// count: 1
|
|
166
|
+
// }
|
|
167
|
+
// ]
|
|
168
|
+
point: {
|
|
169
|
+
type: Array,
|
|
170
|
+
default() {
|
|
171
|
+
return []
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
type: {
|
|
175
|
+
type: String,
|
|
176
|
+
default: ''
|
|
177
|
+
},
|
|
178
|
+
// 大小,支持 large
|
|
179
|
+
size: {
|
|
180
|
+
type: String,
|
|
181
|
+
default: ''
|
|
182
|
+
},
|
|
183
|
+
// 是否显示 point 提示信息
|
|
184
|
+
legend: Boolean,
|
|
185
|
+
value: {
|
|
186
|
+
type: [String, Date],
|
|
187
|
+
default() {
|
|
188
|
+
return ''
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
// 范围类型
|
|
192
|
+
// 开始:''
|
|
193
|
+
// 结束:'end'
|
|
194
|
+
rangeType: {
|
|
195
|
+
type: String,
|
|
196
|
+
default: ''
|
|
197
|
+
},
|
|
198
|
+
range: Boolean,
|
|
199
|
+
time: {
|
|
200
|
+
type: String,
|
|
201
|
+
default: ''
|
|
202
|
+
},
|
|
203
|
+
beforeChange: {
|
|
204
|
+
type: Function,
|
|
205
|
+
default: null
|
|
206
|
+
},
|
|
207
|
+
min: {
|
|
208
|
+
type: [String, Date, Number],
|
|
209
|
+
default: ''
|
|
210
|
+
},
|
|
211
|
+
max: {
|
|
212
|
+
type: [String, Date, Number],
|
|
213
|
+
default: ''
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
data() {
|
|
217
|
+
return {
|
|
218
|
+
|
|
219
|
+
// 缓存值
|
|
220
|
+
changeFrom: 'out',
|
|
221
|
+
submitValue: '',
|
|
222
|
+
|
|
223
|
+
// 现在时间记录
|
|
224
|
+
curYear: new Date().getFullYear(),
|
|
225
|
+
curMonth: new Date().getMonth() + 1,
|
|
226
|
+
curDay: new Date().getDate(),
|
|
227
|
+
|
|
228
|
+
// 默认值
|
|
229
|
+
year: '',
|
|
230
|
+
month: '',
|
|
231
|
+
day: '',
|
|
232
|
+
hour: '',
|
|
233
|
+
minute: '',
|
|
234
|
+
second: '',
|
|
235
|
+
|
|
236
|
+
// 页面数据
|
|
237
|
+
years: [],
|
|
238
|
+
days: [],
|
|
239
|
+
hours: [],
|
|
240
|
+
minutes: [],
|
|
241
|
+
seconds: [],
|
|
242
|
+
|
|
243
|
+
// 选择层
|
|
244
|
+
monthLayer: false,
|
|
245
|
+
timeLayer: false,
|
|
246
|
+
|
|
247
|
+
// 年份切换器
|
|
248
|
+
tempYear: 0, // 临时当前年,选择年月的时候,在选月份之前,年份是尚未确定的
|
|
249
|
+
yearsPage: 0,
|
|
250
|
+
now: new Date(),
|
|
251
|
+
|
|
252
|
+
// 范围
|
|
253
|
+
start: {
|
|
254
|
+
year: '',
|
|
255
|
+
month: '',
|
|
256
|
+
day: ''
|
|
257
|
+
},
|
|
258
|
+
end: {
|
|
259
|
+
year: '',
|
|
260
|
+
month: '',
|
|
261
|
+
day: ''
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
},
|
|
265
|
+
computed: {
|
|
266
|
+
dayText() {
|
|
267
|
+
const that = this
|
|
268
|
+
return function(val) {
|
|
269
|
+
// 凡是假期,都加上标记
|
|
270
|
+
const dayStr = that.year + '-' + that.addZero(that.month) + '-' + that.addZero(val)
|
|
271
|
+
if (that.holiday.length > 0 && that.holiday.indexOf(dayStr) > -1) {
|
|
272
|
+
return that.t('to.calendar.day.holiday')
|
|
273
|
+
} else {
|
|
274
|
+
return val
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
pointColor() {
|
|
279
|
+
return function(val) {
|
|
280
|
+
if (val === -1) {
|
|
281
|
+
return 'danger'
|
|
282
|
+
}
|
|
283
|
+
if (val === 0) {
|
|
284
|
+
return 'primary'
|
|
285
|
+
}
|
|
286
|
+
if (val === 1) {
|
|
287
|
+
return 'success'
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
hourz: {
|
|
292
|
+
get() {
|
|
293
|
+
return this.addZero(this.hour)
|
|
294
|
+
},
|
|
295
|
+
set(val) {
|
|
296
|
+
this.hour = String(val)
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
minutez: {
|
|
300
|
+
get() {
|
|
301
|
+
return this.addZero(this.minute)
|
|
302
|
+
},
|
|
303
|
+
set(val) {
|
|
304
|
+
this.minute = String(val)
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
secondz: {
|
|
308
|
+
get() {
|
|
309
|
+
return this.addZero(this.second)
|
|
310
|
+
},
|
|
311
|
+
set(val) {
|
|
312
|
+
this.second = String(val)
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
iValue() {
|
|
316
|
+
if (this.range) {
|
|
317
|
+
const start = (this.start.day || this.start.month) ? this.getStringValue(this.start) : ''
|
|
318
|
+
const end = (this.end.day || this.end.month) ? this.getStringValue(this.end) : ''
|
|
319
|
+
return `${start},${end}`
|
|
320
|
+
} else {
|
|
321
|
+
return this.getStringValue()
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
maxHour() {
|
|
325
|
+
let max = ''
|
|
326
|
+
if (typeof this.max === 'string') {
|
|
327
|
+
max = this.max.replace(/-/gi, '/')
|
|
328
|
+
} else {
|
|
329
|
+
max = this.max
|
|
330
|
+
}
|
|
331
|
+
return new Date(max).getHours()
|
|
332
|
+
},
|
|
333
|
+
|
|
334
|
+
isDisableDay() {
|
|
335
|
+
return (item) => {
|
|
336
|
+
if (this.year && this.month) {
|
|
337
|
+
let dateString = `${this.year}/${this.month}/${Number(item.value) + 1}`
|
|
338
|
+
let min = ''
|
|
339
|
+
// 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
|
|
340
|
+
if (typeof this.min === 'string') {
|
|
341
|
+
min = this.min.replace(/-/gi, '/')
|
|
342
|
+
} else {
|
|
343
|
+
min = this.min
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
let max = ''
|
|
347
|
+
if (typeof this.max === 'string') {
|
|
348
|
+
max = this.max.replace(/-/gi, '/')
|
|
349
|
+
} else {
|
|
350
|
+
max = this.max
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return new Date(dateString) <= new Date(min) || new Date(dateString) > new Date(max)
|
|
354
|
+
} else {
|
|
355
|
+
return false
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
|
|
360
|
+
isDisableHour() {
|
|
361
|
+
return (item) => {
|
|
362
|
+
if (this.year && this.month && this.day) {
|
|
363
|
+
let dateString = `${this.year}/${this.month}/${this.day} ${Number(item) + 1}:00:00`
|
|
364
|
+
let min = ''
|
|
365
|
+
// 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
|
|
366
|
+
if (typeof this.min === 'string') {
|
|
367
|
+
min = this.min.replace(/-/gi, '/')
|
|
368
|
+
} else {
|
|
369
|
+
min = this.min
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
let max = ''
|
|
373
|
+
if (typeof this.max === 'string') {
|
|
374
|
+
max = this.max.replace(/-/gi, '/')
|
|
375
|
+
} else {
|
|
376
|
+
max = this.max
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return new Date(dateString) <= new Date(min) || new Date(dateString) > new Date(max)
|
|
380
|
+
} else {
|
|
381
|
+
return false
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
isDisableMinute() {
|
|
386
|
+
return (item) => {
|
|
387
|
+
if (this.year && this.month && this.day && this.hour) {
|
|
388
|
+
let dateString = `${this.year}/${this.month}/${this.day} ${this.hour}:${Number(item) + 1}:00`
|
|
389
|
+
let min = ''
|
|
390
|
+
// 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
|
|
391
|
+
if (typeof this.min === 'string') {
|
|
392
|
+
min = this.min.replace(/-/gi, '/')
|
|
393
|
+
} else {
|
|
394
|
+
min = this.min
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
let max = ''
|
|
398
|
+
if (typeof this.max === 'string') {
|
|
399
|
+
max = this.max.replace(/-/gi, '/')
|
|
400
|
+
} else {
|
|
401
|
+
max = this.max
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return new Date(dateString) < new Date(min) || new Date(dateString) > new Date(max)
|
|
405
|
+
} else {
|
|
406
|
+
return false
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
isDisableSecond() {
|
|
411
|
+
return (item) => {
|
|
412
|
+
if (this.year && this.month && this.day && this.hour && this.minute) {
|
|
413
|
+
let dateString = `${this.year}/${this.month}/${this.day} ${this.hour}:${this.minute}:${Number(item) + 1}`
|
|
414
|
+
let min = ''
|
|
415
|
+
// 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
|
|
416
|
+
if (typeof this.min === 'string') {
|
|
417
|
+
min = this.min.replace(/-/gi, '/')
|
|
418
|
+
} else {
|
|
419
|
+
min = this.min
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
let max = ''
|
|
423
|
+
if (typeof this.max === 'string') {
|
|
424
|
+
max = this.max.replace(/-/gi, '/')
|
|
425
|
+
} else {
|
|
426
|
+
max = this.max
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return new Date(dateString) < new Date(min) || new Date(dateString) > new Date(max)
|
|
430
|
+
} else {
|
|
431
|
+
return false
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
watch: {
|
|
437
|
+
value(val) {
|
|
438
|
+
this.setData()
|
|
439
|
+
if (this.changeFrom === 'out') {
|
|
440
|
+
this.submitValue = val
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
submitValue(val) {
|
|
444
|
+
this.$emit('change', val)
|
|
445
|
+
this.changeFrom = 'in'
|
|
446
|
+
setTimeout(() => {
|
|
447
|
+
this.changeFrom = 'out'
|
|
448
|
+
}, 100);
|
|
449
|
+
},
|
|
450
|
+
min(val) {
|
|
451
|
+
this.min = val
|
|
452
|
+
},
|
|
453
|
+
max(val) {
|
|
454
|
+
this.max = val
|
|
455
|
+
},
|
|
456
|
+
point: {
|
|
457
|
+
handler() {
|
|
458
|
+
this.setDayData()
|
|
459
|
+
},
|
|
460
|
+
deep: true
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
created() {
|
|
464
|
+
this.setData()
|
|
465
|
+
},
|
|
466
|
+
methods: {
|
|
467
|
+
initCalendar() {
|
|
468
|
+
if (this.type === 'time') {
|
|
469
|
+
this.showTimeLayer()
|
|
470
|
+
} else {
|
|
471
|
+
this.timeLayer = false
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
// 根据 obj 获取当前时间值,入参格式形如:
|
|
475
|
+
// arg = {
|
|
476
|
+
// year: '2022',
|
|
477
|
+
// month: '02',
|
|
478
|
+
// day: '22'
|
|
479
|
+
// }
|
|
480
|
+
getValue(arg) {
|
|
481
|
+
return new Date(`${arg.year || this.year}/${arg.month || this.month}/${arg.day || this.day || '01'}`).getTime()
|
|
482
|
+
},
|
|
483
|
+
|
|
484
|
+
// 获取格式化为字符串后的日期
|
|
485
|
+
getStringValue(arg = {}) {
|
|
486
|
+
const year = arg.year || this.year
|
|
487
|
+
const month = arg.month || this.month
|
|
488
|
+
const day = arg.day || this.day
|
|
489
|
+
const hour = arg.hour || this.hourz
|
|
490
|
+
const minute = arg.minute || this.minutez
|
|
491
|
+
const second = arg.second || this.secondz
|
|
492
|
+
const imonth = `${year}-${this.addZero(month)}`
|
|
493
|
+
const iday = day ? `${this.addZero(day)}` : '01'
|
|
494
|
+
const itime = `${hour}:${minute}:${second}`
|
|
495
|
+
if (this.type === 'month') {
|
|
496
|
+
return imonth
|
|
497
|
+
} else if (this.type === 'datetime' || this.type === 'time') {
|
|
498
|
+
return `${imonth}-${iday} ${itime}`
|
|
499
|
+
} else {
|
|
500
|
+
return `${imonth}-${iday}`
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
|
|
504
|
+
// 获取格式化为对象的日期
|
|
505
|
+
getObjectValue(str) {
|
|
506
|
+
const date = new Date(str)
|
|
507
|
+
// eslint-disable-next-line no-debugger
|
|
508
|
+
if (this.isDate(str) && str) {
|
|
509
|
+
return {
|
|
510
|
+
year: date.getFullYear(),
|
|
511
|
+
month: date.getMonth() + 1,
|
|
512
|
+
day: date.getDate()
|
|
513
|
+
}
|
|
514
|
+
} else if (this.isMonth(str) && str) {
|
|
515
|
+
return {
|
|
516
|
+
year: date.getFullYear(),
|
|
517
|
+
month: date.getMonth() + 1,
|
|
518
|
+
day: ''
|
|
519
|
+
}
|
|
520
|
+
} else {
|
|
521
|
+
return {
|
|
522
|
+
year: '',
|
|
523
|
+
month: '',
|
|
524
|
+
day: ''
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
|
|
529
|
+
// 数据设置
|
|
530
|
+
setData() {
|
|
531
|
+
this.setCurrent()
|
|
532
|
+
this.setYearData()
|
|
533
|
+
this.setDayData()
|
|
534
|
+
this.setTimeData()
|
|
535
|
+
},
|
|
536
|
+
setCurrent() {
|
|
537
|
+
this.year = ''
|
|
538
|
+
this.month = ''
|
|
539
|
+
this.day = ''
|
|
540
|
+
if (this.range) {
|
|
541
|
+
let arr = this.value.split(',')
|
|
542
|
+
const start = arr[0]
|
|
543
|
+
const end = arr[1]
|
|
544
|
+
|
|
545
|
+
if (!start || this.isDate(start) || this.isMonth(start)) {
|
|
546
|
+
this.start = this.getObjectValue(start)
|
|
547
|
+
}
|
|
548
|
+
if (!end || this.isDate(end) || this.isMonth(end)) {
|
|
549
|
+
this.end = this.getObjectValue(end)
|
|
550
|
+
}
|
|
551
|
+
if (this.rangeType === 'end') {
|
|
552
|
+
this.year = this.year || new Date().getFullYear()
|
|
553
|
+
if ((this.end.day || this.end.month) && this.isAnyDate(this.getStringValue(this.end))) {
|
|
554
|
+
if (this.type === 'month') {
|
|
555
|
+
if (this.start.year === this.end.year) {
|
|
556
|
+
this.year = this.end.year + 1
|
|
557
|
+
} else {
|
|
558
|
+
this.year = this.end.year
|
|
559
|
+
}
|
|
560
|
+
this.month = 1
|
|
561
|
+
} else {
|
|
562
|
+
if (this.start.month === this.end.month) {
|
|
563
|
+
if (Number(this.month) === 12) {
|
|
564
|
+
this.year = this.end.year + 1
|
|
565
|
+
this.month = 1
|
|
566
|
+
} else {
|
|
567
|
+
this.month = this.end.month + 1
|
|
568
|
+
}
|
|
569
|
+
} else {
|
|
570
|
+
this.month = this.end.month
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
} else {
|
|
574
|
+
this.month = this.month || new Date().getMonth() + 2
|
|
575
|
+
}
|
|
576
|
+
if (this.month > 12) {
|
|
577
|
+
this.month = 1
|
|
578
|
+
this.year += 1
|
|
579
|
+
}
|
|
580
|
+
} else {
|
|
581
|
+
if ((this.start.day || this.start.month) && this.isAnyDate(this.getStringValue(this.start))) {
|
|
582
|
+
this.year = this.start.year
|
|
583
|
+
this.month = this.start.month
|
|
584
|
+
} else {
|
|
585
|
+
this.year = this.year || new Date().getFullYear()
|
|
586
|
+
this.month = this.month || new Date().getMonth() + 1
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
} else {
|
|
590
|
+
if (this.value && !isNaN(new Date(this.value))) {
|
|
591
|
+
this.year = new Date(this.value).getFullYear()
|
|
592
|
+
this.month = new Date(this.value).getMonth() + 1
|
|
593
|
+
this.day = new Date(this.value).getDate()
|
|
594
|
+
this.hour = String(new Date(this.value).getHours())
|
|
595
|
+
this.minute = String(new Date(this.value).getMinutes())
|
|
596
|
+
this.second = String(new Date(this.value).getSeconds())
|
|
597
|
+
} else if (this.value && isNaN(new Date(this.value)) && !isNaN(new Date(this.value.replace(/-/g, '/')))) {
|
|
598
|
+
const value = this.value.replace(/-/g, '/')
|
|
599
|
+
this.year = new Date(value).getFullYear()
|
|
600
|
+
this.month = new Date(value).getMonth() + 1
|
|
601
|
+
this.day = new Date(value).getDate()
|
|
602
|
+
this.hour = String(new Date(value).getHours())
|
|
603
|
+
this.minute = String(new Date(value).getMinutes())
|
|
604
|
+
this.second = String(new Date(value).getSeconds())
|
|
605
|
+
} else {
|
|
606
|
+
this.year = new Date().getFullYear()
|
|
607
|
+
this.month = new Date().getMonth() + 1
|
|
608
|
+
this.day = null
|
|
609
|
+
this.hour = '0'
|
|
610
|
+
this.minute = '0'
|
|
611
|
+
this.second = '0'
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
setYearData(year) {
|
|
616
|
+
year = year || this.year
|
|
617
|
+
let arr = [];
|
|
618
|
+
for (let i = 0; i < 10; i++) {
|
|
619
|
+
arr.push(Math.floor(year / 10) * 10 + i)
|
|
620
|
+
}
|
|
621
|
+
this.years = arr;
|
|
622
|
+
},
|
|
623
|
+
setDayData() {
|
|
624
|
+
let year = new Date(this.value).getFullYear()
|
|
625
|
+
let month = new Date(this.value).getMonth() + 1
|
|
626
|
+
let day = new Date(this.value).getDate()
|
|
627
|
+
const that = this
|
|
628
|
+
if (this.year === year && this.month === month) {
|
|
629
|
+
this.day = day
|
|
630
|
+
} else {
|
|
631
|
+
this.day = null
|
|
632
|
+
}
|
|
633
|
+
// 计算本月天数
|
|
634
|
+
const dayCount = this.getMonthDays(`${this.year}/${this.month}/1`);
|
|
635
|
+
|
|
636
|
+
// 计算前面有几天应该置空
|
|
637
|
+
const thisMonthFirstDay = new Date(`${this.year}/${this.month}/1`);
|
|
638
|
+
thisMonthFirstDay.setMonth(thisMonthFirstDay.getMonth(), 1);
|
|
639
|
+
const emptyLength = new Date(thisMonthFirstDay.setMonth(thisMonthFirstDay.getMonth(), 1)).getDay();
|
|
640
|
+
|
|
641
|
+
// 设置天数
|
|
642
|
+
this.days = (function() {
|
|
643
|
+
let arr = [];
|
|
644
|
+
for (let i = 0; i < emptyLength; i++) {
|
|
645
|
+
arr.push({});
|
|
646
|
+
}
|
|
647
|
+
for (let i = 1; i < dayCount + 1; i++) {
|
|
648
|
+
let obj = {};
|
|
649
|
+
obj.value = i;
|
|
650
|
+
|
|
651
|
+
// 星期天
|
|
652
|
+
if ((i + emptyLength) % 7 === 1) {
|
|
653
|
+
obj.sun = true;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// 星期六
|
|
657
|
+
if ((i + emptyLength) % 7 === 0) {
|
|
658
|
+
obj.sat = true;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// 重点日期
|
|
662
|
+
const point = that.point.filter((item)=>{return item.day === `${that.year}-${that.addZero(that.month)}-${that.addZero(i)}`})
|
|
663
|
+
obj.point = point
|
|
664
|
+
|
|
665
|
+
arr.push(obj);
|
|
666
|
+
}
|
|
667
|
+
return arr;
|
|
668
|
+
})();
|
|
669
|
+
},
|
|
670
|
+
setTimeData() {
|
|
671
|
+
this.hours = this.genNumbers(0, 23)
|
|
672
|
+
this.minutes = this.genNumbers(0, 59)
|
|
673
|
+
this.seconds = this.genNumbers(0, 59)
|
|
674
|
+
const hour = String(new Date(this.value).getHours())
|
|
675
|
+
const minute = String(new Date(this.value).getMinutes())
|
|
676
|
+
const second = String(new Date(this.value).getSeconds())
|
|
677
|
+
if (this.time) {
|
|
678
|
+
const arr = this.time.split(':')
|
|
679
|
+
this.hour = arr[0] || '0'
|
|
680
|
+
this.minute = arr[1] || '0'
|
|
681
|
+
this.second = arr[2] || '0'
|
|
682
|
+
}
|
|
683
|
+
if (!isNaN(hour) && !isNaN(minute) && !isNaN(second)) {
|
|
684
|
+
this.hour = hour
|
|
685
|
+
this.minute = minute
|
|
686
|
+
this.second = second
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
|
|
690
|
+
// 选择事件
|
|
691
|
+
selectYear(item) {
|
|
692
|
+
this.year = item
|
|
693
|
+
},
|
|
694
|
+
selectMonth(item) {
|
|
695
|
+
if (item) {
|
|
696
|
+
if (this.range && this.type === 'month') {
|
|
697
|
+
let start = {}
|
|
698
|
+
let end = {}
|
|
699
|
+
if (!this.start.month && !this.end.month) {
|
|
700
|
+
start.year = this.year
|
|
701
|
+
start.month = item
|
|
702
|
+
start.day = ''
|
|
703
|
+
}
|
|
704
|
+
if (this.start.month) {
|
|
705
|
+
if (this.end.month) {
|
|
706
|
+
start.year = this.year
|
|
707
|
+
start.month = item
|
|
708
|
+
start.day = ''
|
|
709
|
+
end.year = ''
|
|
710
|
+
end.month = ''
|
|
711
|
+
end.day = ''
|
|
712
|
+
} else {
|
|
713
|
+
if (this.getValue(this.start) > this.getValue({month: item})) {
|
|
714
|
+
end.year = this.start.year
|
|
715
|
+
end.month = this.start.month
|
|
716
|
+
end.day = ''
|
|
717
|
+
start.year = this.year
|
|
718
|
+
start.month = item
|
|
719
|
+
start.day = ''
|
|
720
|
+
} else {
|
|
721
|
+
start = JSON.parse(JSON.stringify(this.start))
|
|
722
|
+
end.year = this.year
|
|
723
|
+
end.month = item
|
|
724
|
+
end.day = ''
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
this.start = JSON.parse(JSON.stringify(start))
|
|
729
|
+
this.end = JSON.parse(JSON.stringify(end))
|
|
730
|
+
this.submitValue = this.iValue
|
|
731
|
+
} else {
|
|
732
|
+
if (this.type === 'month') {
|
|
733
|
+
this.$emit('beforeChange', this.getStringValue({
|
|
734
|
+
month: item
|
|
735
|
+
}))
|
|
736
|
+
}
|
|
737
|
+
if (this.beforeChange) {
|
|
738
|
+
const fn = this.beforeChange(this.getStringValue({
|
|
739
|
+
month: item
|
|
740
|
+
}))
|
|
741
|
+
if (fn && fn.then) {
|
|
742
|
+
fn.then(flag => {
|
|
743
|
+
this.selectMonthAction(item)
|
|
744
|
+
}).catch((e)=>{})
|
|
745
|
+
} else {
|
|
746
|
+
// 是同步方法,则返回为 true 执行
|
|
747
|
+
if (fn) {
|
|
748
|
+
this.selectMonthAction(item)
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
} else {
|
|
752
|
+
this.selectMonthAction(item)
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
},
|
|
757
|
+
selectMonthAction(item) {
|
|
758
|
+
this.month = item;
|
|
759
|
+
this.monthLayer = false;
|
|
760
|
+
this.setDayData();
|
|
761
|
+
if (this.type === 'month') {
|
|
762
|
+
this.day = 1
|
|
763
|
+
this.submitValue = this.iValue
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
selectDay(item) {
|
|
767
|
+
if (item.value) {
|
|
768
|
+
if (this.range) {
|
|
769
|
+
let start = {}
|
|
770
|
+
let end = {}
|
|
771
|
+
if (!this.start.day && !this.end.day) {
|
|
772
|
+
start.year = this.year
|
|
773
|
+
start.month = this.month
|
|
774
|
+
start.day = item.value
|
|
775
|
+
}
|
|
776
|
+
if (this.start.day) {
|
|
777
|
+
if (this.end.day) {
|
|
778
|
+
start.year = this.year
|
|
779
|
+
start.month = this.month
|
|
780
|
+
start.day = item.value
|
|
781
|
+
end.year = ''
|
|
782
|
+
end.month = ''
|
|
783
|
+
end.day = ''
|
|
784
|
+
} else {
|
|
785
|
+
if (this.getValue(this.start) > this.getValue({day: item.value})) {
|
|
786
|
+
end.year = this.start.year
|
|
787
|
+
end.month = this.start.month
|
|
788
|
+
end.day = this.start.day
|
|
789
|
+
start.year = this.year
|
|
790
|
+
start.month = this.month
|
|
791
|
+
start.day = item.value
|
|
792
|
+
} else {
|
|
793
|
+
start = JSON.parse(JSON.stringify(this.start))
|
|
794
|
+
end.year = this.year
|
|
795
|
+
end.month = this.month
|
|
796
|
+
end.day = item.value
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
this.start = JSON.parse(JSON.stringify(start))
|
|
801
|
+
this.end = JSON.parse(JSON.stringify(end))
|
|
802
|
+
this.submitValue = this.iValue
|
|
803
|
+
}
|
|
804
|
+
else {
|
|
805
|
+
let val = this.getStringValue({
|
|
806
|
+
day: item.value
|
|
807
|
+
})
|
|
808
|
+
if (!this.type || this.type === 'date') {
|
|
809
|
+
this.$emit('beforeChange', val)
|
|
810
|
+
if (this.beforeChange) {
|
|
811
|
+
const fn = this.beforeChange(this.getStringValue({
|
|
812
|
+
day: item.value
|
|
813
|
+
}))
|
|
814
|
+
|
|
815
|
+
if (fn && fn.then) {
|
|
816
|
+
fn.then(flag => {
|
|
817
|
+
this.selectDayAction(item)
|
|
818
|
+
})
|
|
819
|
+
} else {
|
|
820
|
+
// 是同步方法,则返回为 true 执行
|
|
821
|
+
if (fn) {
|
|
822
|
+
this.selectDayAction(item)
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
} else {
|
|
826
|
+
this.selectDayAction(item)
|
|
827
|
+
}
|
|
828
|
+
} else {
|
|
829
|
+
this.selectDayAction(item)
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
selectDayAction(item) {
|
|
835
|
+
this.day = item.value
|
|
836
|
+
if (!this.type || this.type === 'date') {
|
|
837
|
+
this.submitValue = this.iValue
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
selectTime() {
|
|
841
|
+
if (!this.day && !this.min && !this.max) {
|
|
842
|
+
this.day = new Date().getDate()
|
|
843
|
+
} else if (!this.day && this.min && this.max) {
|
|
844
|
+
this.$tip.error(this.t('to.calendar.tip.error.selectDate'))
|
|
845
|
+
return
|
|
846
|
+
}
|
|
847
|
+
this.$emit('beforeChange', this.getStringValue())
|
|
848
|
+
if (this.beforeChange) {
|
|
849
|
+
|
|
850
|
+
const fn = this.beforeChange(this.getStringValue())
|
|
851
|
+
|
|
852
|
+
if (fn && fn.then) {
|
|
853
|
+
fn(this.getStringValue()).then(flag => {
|
|
854
|
+
this.selectTimeAction()
|
|
855
|
+
})
|
|
856
|
+
} else {
|
|
857
|
+
// 是同步方法,则返回为 true 执行
|
|
858
|
+
if (fn) {
|
|
859
|
+
this.selectTimeAction()
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
} else {
|
|
863
|
+
this.selectTimeAction()
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
selectTimeAction() {
|
|
867
|
+
this.timeLayer = false
|
|
868
|
+
this.submitValue = this.iValue
|
|
869
|
+
this.$emit('close')
|
|
870
|
+
},
|
|
871
|
+
// 样式设置
|
|
872
|
+
setYearClass(item) {
|
|
873
|
+
return {
|
|
874
|
+
cur: this.curYear === item,
|
|
875
|
+
on: this.year === item
|
|
876
|
+
};
|
|
877
|
+
},
|
|
878
|
+
setMonthClass(item) {
|
|
879
|
+
let arr = []
|
|
880
|
+
if (this.year === this.curYear && this.curMonth === item) {
|
|
881
|
+
arr.push('cur')
|
|
882
|
+
}
|
|
883
|
+
if (this.range && this.type === 'month') {
|
|
884
|
+
if (this.year === this.start.year && item === this.start.month) {
|
|
885
|
+
if (this.end.month) {
|
|
886
|
+
arr.push('start')
|
|
887
|
+
} else {
|
|
888
|
+
arr.push('on')
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
if (this.year === this.end.year && item === this.end.month) {
|
|
892
|
+
arr.push('end')
|
|
893
|
+
}
|
|
894
|
+
const value = this.getValue({
|
|
895
|
+
year: this.year,
|
|
896
|
+
month: item,
|
|
897
|
+
day: 1
|
|
898
|
+
})
|
|
899
|
+
if ((value > this.getValue(this.start) || value === this.getValue(this.start)) && value < this.getValue(this.end)) {
|
|
900
|
+
arr.push('range')
|
|
901
|
+
}
|
|
902
|
+
} else {
|
|
903
|
+
if (this.month === item) {
|
|
904
|
+
arr.push('on')
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
if (item && (this.min || this.max)) {
|
|
909
|
+
let curData = this.year + '/' + (item > 9 ? item : '0' + item) + '/01'
|
|
910
|
+
let date = new Date()
|
|
911
|
+
let hour = date.getHours()
|
|
912
|
+
let minute = date.getMinutes()
|
|
913
|
+
let second = date.getSeconds()
|
|
914
|
+
curData = curData + ' ' + (hour > 9 ? hour : '0' + hour) + ':' + (minute > 9 ? minute : '0' + minute) + ':' + (second > 9 ? second : '0' + second)
|
|
915
|
+
let curTime = new Date(curData).getTime()
|
|
916
|
+
let min = new Date(this.min).getTime()
|
|
917
|
+
let maxTime = new Date(this.max).getTime()
|
|
918
|
+
let cur = curData.split(' ')[0]
|
|
919
|
+
let year = new Date(this.max).getFullYear()
|
|
920
|
+
let month = new Date(this.max).getMonth() + 1
|
|
921
|
+
let day = new Date(this.max).getDate()
|
|
922
|
+
let max = year + '/' + (month > 9 ? month : '0' + month) + '/' + (day > 9 ? day : '0' + day)
|
|
923
|
+
if (min === maxTime && cur !== max) {
|
|
924
|
+
if (curTime > maxTime) {
|
|
925
|
+
arr.push('to-dis')
|
|
926
|
+
}
|
|
927
|
+
if (curTime < min) {
|
|
928
|
+
arr.push('to-dis')
|
|
929
|
+
}
|
|
930
|
+
} else if (min !== maxTime && cur !== max) {
|
|
931
|
+
if (curTime > maxTime) {
|
|
932
|
+
arr.push('to-dis')
|
|
933
|
+
}
|
|
934
|
+
if (curTime < min) {
|
|
935
|
+
arr.push('to-dis')
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return arr;
|
|
940
|
+
},
|
|
941
|
+
setDayClass(item) {
|
|
942
|
+
let arr = []
|
|
943
|
+
if (item.sat) {
|
|
944
|
+
arr.push('sat')
|
|
945
|
+
}
|
|
946
|
+
if (item.sun) {
|
|
947
|
+
arr.push('sun')
|
|
948
|
+
}
|
|
949
|
+
if (this.year === this.curYear && this.month === this.curMonth && this.curDay === item.value) {
|
|
950
|
+
arr.push('cur')
|
|
951
|
+
}
|
|
952
|
+
if (this.range) {
|
|
953
|
+
if (this.year === this.start.year && this.month === this.start.month && item.value === this.start.day) {
|
|
954
|
+
if (this.end.day) {
|
|
955
|
+
arr.push('start')
|
|
956
|
+
} else {
|
|
957
|
+
arr.push('on')
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
if (this.year === this.end.year && this.month === this.end.month && item.value === this.end.day) {
|
|
961
|
+
arr.push('end')
|
|
962
|
+
}
|
|
963
|
+
const value = this.getValue({
|
|
964
|
+
year: this.year,
|
|
965
|
+
month: this.month,
|
|
966
|
+
day: item.value
|
|
967
|
+
})
|
|
968
|
+
if (value > this.getValue(this.start) && value < this.getValue(this.end)) {
|
|
969
|
+
arr.push('range')
|
|
970
|
+
}
|
|
971
|
+
} else {
|
|
972
|
+
if (this.day === item.value) {
|
|
973
|
+
arr.push('on')
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
return arr;
|
|
977
|
+
},
|
|
978
|
+
|
|
979
|
+
// 界面控制
|
|
980
|
+
nextMonth() {
|
|
981
|
+
if (this.month === 12) {
|
|
982
|
+
this.year += 1;
|
|
983
|
+
this.month = 1;
|
|
984
|
+
} else {
|
|
985
|
+
this.month += 1;
|
|
986
|
+
}
|
|
987
|
+
this.setDayData();
|
|
988
|
+
},
|
|
989
|
+
lastMonth() {
|
|
990
|
+
if (this.month === 1) {
|
|
991
|
+
this.year -= 1;
|
|
992
|
+
this.month = 12;
|
|
993
|
+
} else {
|
|
994
|
+
this.month -= 1;
|
|
995
|
+
}
|
|
996
|
+
this.setDayData();
|
|
997
|
+
},
|
|
998
|
+
lastYears() {
|
|
999
|
+
this.yearsPage -= 1;
|
|
1000
|
+
this.setYearData(this.year + 10 * this.yearsPage);
|
|
1001
|
+
},
|
|
1002
|
+
nextYears() {
|
|
1003
|
+
this.yearsPage += 1;
|
|
1004
|
+
this.setYearData(this.year + 10 * this.yearsPage);
|
|
1005
|
+
},
|
|
1006
|
+
nextYear() {
|
|
1007
|
+
this.year += 1
|
|
1008
|
+
let year = new Date(this.value).getFullYear()
|
|
1009
|
+
let month = new Date(this.value).getMonth() + 1
|
|
1010
|
+
let day = new Date(this.value).getDate()
|
|
1011
|
+
if (this.year === year && this.month === month) {
|
|
1012
|
+
this.day = day
|
|
1013
|
+
} else {
|
|
1014
|
+
this.day = null
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
lastYear() {
|
|
1018
|
+
this.year -= 1
|
|
1019
|
+
let year = new Date(this.value).getFullYear()
|
|
1020
|
+
let month = new Date(this.value).getMonth() + 1
|
|
1021
|
+
let day = new Date(this.value).getDate()
|
|
1022
|
+
if (this.year === year && this.month === month) {
|
|
1023
|
+
this.day = day
|
|
1024
|
+
} else {
|
|
1025
|
+
this.day = null
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
toggleMonthSelector() {
|
|
1029
|
+
if (!this.monthLayer) {
|
|
1030
|
+
// 打开
|
|
1031
|
+
this.monthLayer = true;
|
|
1032
|
+
this.tempYear = this.year;
|
|
1033
|
+
this.setYearData(this.year);
|
|
1034
|
+
} else {
|
|
1035
|
+
// 关闭
|
|
1036
|
+
this.monthLayer = false;
|
|
1037
|
+
}
|
|
1038
|
+
},
|
|
1039
|
+
showTimeLayer() {
|
|
1040
|
+
this.timeLayer = true;
|
|
1041
|
+
this.$nextTick(function() {
|
|
1042
|
+
this.$refs.hourScroll.adjust()
|
|
1043
|
+
this.$refs.minuteScroll.adjust()
|
|
1044
|
+
this.$refs.secondScroll.adjust()
|
|
1045
|
+
})
|
|
1046
|
+
},
|
|
1047
|
+
closeTimeLayer() {
|
|
1048
|
+
if (this.type === 'time') {
|
|
1049
|
+
this.timeLayer = false
|
|
1050
|
+
this.$emit('close')
|
|
1051
|
+
} else {
|
|
1052
|
+
this.timeLayer = false
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
|
|
1056
|
+
// 内置方法
|
|
1057
|
+
// 验证日期格式
|
|
1058
|
+
isDate(date) {
|
|
1059
|
+
const DateExp = /^[1-2][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/
|
|
1060
|
+
if (DateExp.test(date)) {
|
|
1061
|
+
return (new Date(date).getDate() === Number(date.substring(date.length - 2)))
|
|
1062
|
+
} else {
|
|
1063
|
+
return false
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
isMonth(date) {
|
|
1067
|
+
const DateExp = /^[1-2][0-9]{3}-(0[1-9]|1[0-2])$/
|
|
1068
|
+
if (DateExp.test(date)) {
|
|
1069
|
+
return (new Date(date + '-01').getDate() === Number(1))
|
|
1070
|
+
} else {
|
|
1071
|
+
return false
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
isDatetime(time) {
|
|
1075
|
+
if (typeof time === 'string') {
|
|
1076
|
+
var reg = /^(\d{1,4})(-|\/)(\d{2})\2(\d{1,2}) (\d{2}):(\d{2}):(\d{2})$/;
|
|
1077
|
+
var r = time.match(reg);
|
|
1078
|
+
if (r == null) return false;
|
|
1079
|
+
var d = new Date(r[1], r[3] - 1, r[4], r[5], r[6], r[7]);
|
|
1080
|
+
return (d.getFullYear() === Number(r[1]) && (d.getMonth() + 1) === Number(r[3]) && d.getDate() === Number(r[4]) && d.getHours() === Number(r[5]) && d.getMinutes() === Number(r[6]) && d.getSeconds() === Number(r[7]));
|
|
1081
|
+
} else {
|
|
1082
|
+
return true
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
isAnyDate(val) {
|
|
1086
|
+
if ((this.isDate(val) && (this.type === '')) || (this.isDatetime(val) && this.type === 'datetime') || (this.isMonth(val) && this.type === 'month')) {
|
|
1087
|
+
return true
|
|
1088
|
+
} else {
|
|
1089
|
+
return false
|
|
1090
|
+
}
|
|
1091
|
+
},
|
|
1092
|
+
|
|
1093
|
+
// 获取一个月的天数
|
|
1094
|
+
getMonthDays(date) {
|
|
1095
|
+
const thisMonthFirstDay = new Date(date);
|
|
1096
|
+
const nextMonthFirstDay = new Date(date);
|
|
1097
|
+
thisMonthFirstDay.setMonth(thisMonthFirstDay.getMonth(), 1);
|
|
1098
|
+
nextMonthFirstDay.setMonth(nextMonthFirstDay.getMonth() + 1, 1);
|
|
1099
|
+
return (nextMonthFirstDay.valueOf() - thisMonthFirstDay.valueOf()) / (1000 * 60 * 60 * 24);
|
|
1100
|
+
},
|
|
1101
|
+
// 格式化日期
|
|
1102
|
+
formatDate(date, fmt) {
|
|
1103
|
+
if (!fmt) {
|
|
1104
|
+
if (this.type === 'datetime') {
|
|
1105
|
+
fmt = 'yyyy-MM-dd HH:mm:ss'
|
|
1106
|
+
} else {
|
|
1107
|
+
fmt = 'yyyy-MM-dd'
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
if (/(y+)/.test(fmt)) {
|
|
1111
|
+
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
|
|
1112
|
+
}
|
|
1113
|
+
const o = {
|
|
1114
|
+
'M+': date.getMonth() + 1,
|
|
1115
|
+
'd+': date.getDate(),
|
|
1116
|
+
'H+': date.getHours(),
|
|
1117
|
+
'm+': date.getMinutes(),
|
|
1118
|
+
's+': date.getSeconds()
|
|
1119
|
+
};
|
|
1120
|
+
for (const k in o) {
|
|
1121
|
+
if (new RegExp('(' + k + ')').test(fmt)) {
|
|
1122
|
+
const str = o[k] + '';
|
|
1123
|
+
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : this.addZero(str));
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
return fmt;
|
|
1127
|
+
},
|
|
1128
|
+
// 生成循环数字
|
|
1129
|
+
genNumbers(min, max, step = 1) {
|
|
1130
|
+
let arr = []
|
|
1131
|
+
for (let i = min; i <= max; i += step) {
|
|
1132
|
+
arr.push(String(i))
|
|
1133
|
+
}
|
|
1134
|
+
return arr
|
|
1135
|
+
},
|
|
1136
|
+
// 给个位数的数字前面补 0
|
|
1137
|
+
addZero(str) {
|
|
1138
|
+
return ('00' + str).substr(str.toString().length);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
</script>
|