@kyfe/hroa-ui 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/dist/hroa-ui.common.js +133 -2576
  2. package/dist/hroa-ui.css +1 -1
  3. package/dist/hroa-ui.umd.js +133 -2576
  4. package/dist/hroa-ui.umd.min.js +2 -2
  5. package/lib/hr-add-list/index.js +1 -1
  6. package/lib/hr-bottom-button/index.js +1 -1
  7. package/lib/hr-breadcrumb/index.js +1 -1
  8. package/lib/hr-button/index.js +1 -1
  9. package/lib/hr-checkbox/index.js +1 -1
  10. package/lib/hr-checkbox-group/index.js +1 -1
  11. package/lib/hr-clipboard/index.js +1 -1
  12. package/lib/hr-collapse-card/index.js +1 -1
  13. package/lib/hr-condition-filtrate/index.js +1 -1
  14. package/lib/hr-condition-filtrate-popup/index.js +1 -1
  15. package/lib/hr-date-filter/index.css +1 -1
  16. package/lib/hr-date-filter/index.js +1 -1
  17. package/lib/hr-dropdown-date/index.css +1 -1
  18. package/lib/hr-dropdown-date/index.js +1 -1
  19. package/lib/hr-elasticity-box/index.js +1 -1
  20. package/lib/hr-elasticity-box-item/index.js +1 -1
  21. package/lib/hr-emotional-picture/index.js +1 -1
  22. package/lib/hr-employee-choose/index.js +1 -1
  23. package/lib/hr-file-list/index.js +1 -1
  24. package/lib/hr-full-screen/index.js +1 -1
  25. package/lib/hr-img-list/index.css +1 -1
  26. package/lib/hr-img-list/index.js +1 -1
  27. package/lib/hr-info-card/index.js +1 -1
  28. package/lib/hr-information/index.js +1 -1
  29. package/lib/hr-license-plate-number/index.js +1 -1
  30. package/lib/hr-module-card/index.js +1 -1
  31. package/lib/hr-multiterm-choose/index.css +1 -1
  32. package/lib/hr-multiterm-choose/index.js +1 -1
  33. package/lib/hr-no-data/index.js +1 -1
  34. package/lib/hr-notice-bar/index.js +1 -1
  35. package/lib/hr-notification-dialog/index.js +1 -1
  36. package/lib/hr-open-ks/index.js +1 -1
  37. package/lib/hr-pager/index.js +1 -1
  38. package/lib/hr-popup/index.js +1 -1
  39. package/lib/hr-preview-file/index.js +1 -1
  40. package/lib/hr-radiobox/index.js +1 -1
  41. package/lib/hr-radiobox-group/index.js +1 -1
  42. package/lib/hr-rate/index.js +1 -1
  43. package/lib/hr-reason-textarea/index.js +1 -1
  44. package/lib/hr-search-input/index.js +1 -1
  45. package/lib/hr-search-tips/index.js +1 -1
  46. package/lib/hr-select/index.js +1 -1
  47. package/lib/hr-select-list/index.js +1 -1
  48. package/lib/hr-single-choose/index.css +1 -1
  49. package/lib/hr-single-choose/index.js +1 -1
  50. package/lib/hr-slide-pager/index.js +1 -1
  51. package/lib/hr-sort/index.js +1 -1
  52. package/lib/hr-stack-image/index.js +1 -1
  53. package/lib/hr-tab-nav/index.js +1 -1
  54. package/lib/hr-time-picker/index.js +1 -1
  55. package/lib/hr-view-item/index.js +1 -1
  56. package/lib/hr-virtual-list/index.js +1 -1
  57. package/lib/index/index.css +1 -1
  58. package/lib/index/index.js +2 -2
  59. package/lib/utils/index.js +1 -1
  60. package/package.json +12 -9
  61. package/lib/getJsModule/index.css +0 -1
  62. package/lib/getJsModule/index.js +0 -9
  63. package/packages/getJsModule.js +0 -11
  64. package/packages/hr-add-list/image/add.svg +0 -1
  65. package/packages/hr-add-list/image/close.svg +0 -1
  66. package/packages/hr-add-list/index.js +0 -7
  67. package/packages/hr-add-list/src/index.vue +0 -125
  68. package/packages/hr-add-list//346/226/260/345/242/236/345/244/232/347/254/224/346/225/260/346/215/256.md +0 -0
  69. package/packages/hr-bottom-button/index.js +0 -7
  70. package/packages/hr-bottom-button/src/index.vue +0 -128
  71. package/packages/hr-breadcrumb/index.js +0 -3
  72. package/packages/hr-breadcrumb/src/index.vue +0 -87
  73. package/packages/hr-breadcrumb//351/235/242/345/214/205/345/261/221.md +0 -0
  74. package/packages/hr-button/index.js +0 -13
  75. package/packages/hr-button/src/hr-button.vue +0 -39
  76. package/packages/hr-checkbox/index.js +0 -8
  77. package/packages/hr-checkbox/src/active-icon.png +0 -0
  78. package/packages/hr-checkbox/src/checkbox-group.vue +0 -74
  79. package/packages/hr-checkbox/src/checkbox.vue +0 -226
  80. package/packages/hr-checkbox/src/data.js +0 -46
  81. package/packages/hr-checkbox//345/244/215/351/200/211/346/241/206-/345/215/225/351/200/211/346/241/206.md +0 -0
  82. package/packages/hr-checkbox-group/index.js +0 -8
  83. package/packages/hr-clipboard/index.js +0 -8
  84. package/packages/hr-clipboard/src/index.vue +0 -46
  85. package/packages/hr-clipboard/src/util.js +0 -9
  86. package/packages/hr-collapse-card/index.js +0 -3
  87. package/packages/hr-collapse-card/src/images/icon_up.png +0 -0
  88. package/packages/hr-collapse-card/src/index.vue +0 -151
  89. package/packages/hr-collapse-card//346/212/230/345/217/240/345/215/241/347/211/207.md +0 -0
  90. package/packages/hr-condition-filtrate/enum/index.js +0 -11
  91. package/packages/hr-condition-filtrate/image/arrow-right.png +0 -0
  92. package/packages/hr-condition-filtrate/index.js +0 -7
  93. package/packages/hr-condition-filtrate/src/employee-choose/index.vue +0 -101
  94. package/packages/hr-condition-filtrate/src/index.vue +0 -246
  95. package/packages/hr-condition-filtrate/src/multiterm-choose/index.vue +0 -167
  96. package/packages/hr-condition-filtrate/src/org-tree-choose/index.vue +0 -102
  97. package/packages/hr-condition-filtrate/src/single-choose/index.vue +0 -144
  98. package/packages/hr-condition-filtrate/src/text-input/index.vue +0 -60
  99. package/packages/hr-condition-filtrate/src/time-selector/date-range-select.vue +0 -154
  100. package/packages/hr-condition-filtrate/src/time-selector/images/date-icon.png +0 -0
  101. package/packages/hr-condition-filtrate/src/time-selector/index.vue +0 -380
  102. package/packages/hr-condition-filtrate/src/time-selector/utils/constant.js +0 -30
  103. package/packages/hr-condition-filtrate/src/time-selector/utils/tools.js +0 -213
  104. package/packages/hr-condition-filtrate-popup/index.js +0 -7
  105. package/packages/hr-condition-filtrate-popup/src/index.vue +0 -236
  106. package/packages/hr-date-filter/index.js +0 -7
  107. package/packages/hr-date-filter/src/date-select.vue +0 -153
  108. package/packages/hr-date-filter/src/index.vue +0 -243
  109. package/packages/hr-date-filter/src/style.less +0 -130
  110. package/packages/hr-date-filter/src/utils.js +0 -109
  111. package/packages/hr-dropdown-date/index.js +0 -7
  112. package/packages/hr-dropdown-date/src/calendar/calendar.js +0 -128
  113. package/packages/hr-dropdown-date/src/calendar/calendar.vue +0 -485
  114. package/packages/hr-dropdown-date/src/calendar/images/arrow@3x.png +0 -0
  115. package/packages/hr-dropdown-date/src/calendar/index.js +0 -5
  116. package/packages/hr-dropdown-date/src/date-picker/date-range-select.vue +0 -92
  117. package/packages/hr-dropdown-date/src/date-picker/month-range-select.vue +0 -128
  118. package/packages/hr-dropdown-date/src/date-picker/month-select.vue +0 -98
  119. package/packages/hr-dropdown-date/src/date-picker/style.less +0 -120
  120. package/packages/hr-dropdown-date/src/date-picker/utils.js +0 -109
  121. package/packages/hr-dropdown-date/src/index.vue +0 -482
  122. package/packages/hr-dropdown-date/src/week.js +0 -194
  123. package/packages/hr-elasticity-box/index.js +0 -7
  124. package/packages/hr-elasticity-box/src/elasticity-box-item.vue +0 -61
  125. package/packages/hr-elasticity-box/src/index.vue +0 -52
  126. package/packages/hr-elasticity-box-item/index.js +0 -7
  127. package/packages/hr-emotional-picture/index.js +0 -7
  128. package/packages/hr-emotional-picture/src/index.vue +0 -66
  129. package/packages/hr-emotional-picture//346/203/205/346/204/237/345/233/276/347/273/204/344/273/266.md +0 -0
  130. package/packages/hr-employee-choose/index.js +0 -7
  131. package/packages/hr-employee-choose/src/image/arrow-right.png +0 -0
  132. package/packages/hr-employee-choose/src/index.vue +0 -119
  133. package/packages/hr-file-list/index.js +0 -3
  134. package/packages/hr-file-list/src/file-type/other.vue +0 -45
  135. package/packages/hr-file-list/src/file-type/picture.vue +0 -38
  136. package/packages/hr-file-list/src/file-type/video.vue +0 -60
  137. package/packages/hr-file-list/src/index.vue +0 -246
  138. package/packages/hr-file-list/src/utils/enum.js +0 -95
  139. package/packages/hr-file-list/src/utils/fun.js +0 -16
  140. package/packages/hr-file-list//346/226/207/344/273/266/345/210/227/350/241/250.md +0 -0
  141. package/packages/hr-full-screen/index.js +0 -7
  142. package/packages/hr-full-screen/src/index.vue +0 -117
  143. package/packages/hr-img-list/index.js +0 -3
  144. package/packages/hr-img-list/src/index.vue +0 -144
  145. package/packages/hr-img-list//345/244/232/345/233/276/345/210/227/350/241/250.md +0 -0
  146. package/packages/hr-info-card/index.js +0 -7
  147. package/packages/hr-info-card/src/index.vue +0 -67
  148. package/packages/hr-information/index.js +0 -7
  149. package/packages/hr-information/src/index.vue +0 -72
  150. package/packages/hr-license-plate-number/index.js +0 -8
  151. package/packages/hr-license-plate-number/src/enum.js +0 -44
  152. package/packages/hr-license-plate-number/src/index.vue +0 -164
  153. package/packages/hr-license-plate-number/src/vnp-keyboard.vue +0 -182
  154. package/packages/hr-license-plate-number//350/275/246/347/211/214/345/217/267/345/274/271/347/252/227.md +0 -0
  155. package/packages/hr-module-card/index.js +0 -13
  156. package/packages/hr-module-card/src/index.vue +0 -132
  157. package/packages/hr-module-card//346/250/241/345/235/227/345/215/241/347/211/207/347/273/204/344/273/266.md +0 -29
  158. package/packages/hr-multiterm-choose/index.js +0 -8
  159. package/packages/hr-multiterm-choose/src/active-icon.png +0 -0
  160. package/packages/hr-multiterm-choose/src/index.vue +0 -224
  161. package/packages/hr-multiterm-choose//345/244/232/351/200/211/346/241/206.md +0 -0
  162. package/packages/hr-no-data/index.js +0 -7
  163. package/packages/hr-no-data/src/index.vue +0 -48
  164. package/packages/hr-notice-bar/index.js +0 -7
  165. package/packages/hr-notice-bar/src/bem.js +0 -38
  166. package/packages/hr-notice-bar/src/index.js +0 -52
  167. package/packages/hr-notice-bar//351/200/232/347/237/245/346/240/217/347/273/204/344/273/266.md +0 -3
  168. package/packages/hr-notification-dialog/images/header.png +0 -0
  169. package/packages/hr-notification-dialog/index.js +0 -7
  170. package/packages/hr-notification-dialog/src/index.vue +0 -293
  171. package/packages/hr-notification-dialog//345/274/271/347/252/227/346/217/220/347/244/272/347/273/204/344/273/266.md +0 -0
  172. package/packages/hr-open-ks/index.js +0 -7
  173. package/packages/hr-open-ks/src/icon.png +0 -0
  174. package/packages/hr-open-ks/src/index.vue +0 -97
  175. package/packages/hr-open-ks/src/util.js +0 -31
  176. package/packages/hr-pager/images/next-page.png +0 -0
  177. package/packages/hr-pager/images/prev-page.png +0 -0
  178. package/packages/hr-pager/index.js +0 -7
  179. package/packages/hr-pager/src/index.vue +0 -120
  180. package/packages/hr-pager//346/214/211/351/222/256/347/277/273/351/241/265/347/273/204/344/273/266.md +0 -0
  181. package/packages/hr-popup/index.js +0 -3
  182. package/packages/hr-popup/src/index.vue +0 -64
  183. package/packages/hr-popup//345/274/271/345/207/272/345/261/202.md +0 -0
  184. package/packages/hr-preview-file/index.js +0 -7
  185. package/packages/hr-preview-file/src/index.vue +0 -58
  186. package/packages/hr-preview-file/src/util.js +0 -50
  187. package/packages/hr-radiobox/index.js +0 -8
  188. package/packages/hr-radiobox/src/data.js +0 -46
  189. package/packages/hr-radiobox/src/radiobox-group.vue +0 -64
  190. package/packages/hr-radiobox/src/radiobox.vue +0 -191
  191. package/packages/hr-radiobox-group/index.js +0 -8
  192. package/packages/hr-rate/index.js +0 -7
  193. package/packages/hr-rate/src/index.vue +0 -42
  194. package/packages/hr-rate//350/257/204/345/210/206/347/273/204/344/273/266/357/274/210/345/270/246/346/226/207/346/241/210/357/274/211.md +0 -0
  195. package/packages/hr-reason-textarea/index.js +0 -7
  196. package/packages/hr-reason-textarea/src/index.vue +0 -128
  197. package/packages/hr-search-input/image/input-close-icon.png +0 -0
  198. package/packages/hr-search-input/image/search-icon.png +0 -0
  199. package/packages/hr-search-input/index.js +0 -8
  200. package/packages/hr-search-input/src/index.vue +0 -144
  201. package/packages/hr-search-tips/index.js +0 -3
  202. package/packages/hr-search-tips/src/index.vue +0 -213
  203. package/packages/hr-search-tips//350/277/234/347/250/213/346/250/241/347/263/212/346/220/234/347/264/242.md +0 -0
  204. package/packages/hr-select/index.js +0 -7
  205. package/packages/hr-select/src/index.vue +0 -41
  206. package/packages/hr-select-list/index.js +0 -3
  207. package/packages/hr-select-list/src/index.vue +0 -214
  208. package/packages/hr-select-list//344/270/213/346/213/211/351/200/211/346/213/251(/351/273/230/350/256/244/345/244/232/351/200/211).md +0 -0
  209. package/packages/hr-single-choose/index.js +0 -8
  210. package/packages/hr-single-choose/src/index.vue +0 -195
  211. package/packages/hr-single-choose//345/215/225/351/200/211/346/241/206.md +0 -0
  212. package/packages/hr-slide-pager/guide/image/turn-left.png +0 -0
  213. package/packages/hr-slide-pager/guide/image/turn-right.png +0 -0
  214. package/packages/hr-slide-pager/guide/index.vue +0 -59
  215. package/packages/hr-slide-pager/guide//346/226/260/346/211/213/346/214/207/345/274/225.md +0 -0
  216. package/packages/hr-slide-pager/index.js +0 -7
  217. package/packages/hr-slide-pager/src/index.vue +0 -374
  218. package/packages/hr-slide-pager//346/273/221/345/212/250/347/277/273/351/241/265/347/273/204/344/273/266.md +0 -0
  219. package/packages/hr-sort/index.js +0 -3
  220. package/packages/hr-sort/src/main.vue +0 -133
  221. package/packages/hr-sort//346/216/222/345/272/217.md +0 -0
  222. package/packages/hr-stack-image/index.js +0 -3
  223. package/packages/hr-stack-image/src/main.vue +0 -77
  224. package/packages/hr-stack-image//345/261/202/345/217/240/345/233/276/347/211/207/347/273/204/344/273/266.md +0 -0
  225. package/packages/hr-tab-nav/index.js +0 -8
  226. package/packages/hr-tab-nav/src/index.vue +0 -190
  227. package/packages/hr-time-picker/index.js +0 -3
  228. package/packages/hr-time-picker/src/index.vue +0 -85
  229. package/packages/hr-time-picker//346/227/266/351/227/264/351/200/211/346/213/251/345/231/250.md +0 -0
  230. package/packages/hr-view-item/index.js +0 -13
  231. package/packages/hr-view-item/src/index.vue +0 -89
  232. package/packages/hr-view-item//350/241/250/345/215/225/351/241/271item/345/261/225/347/244/272.md +0 -0
  233. package/packages/hr-virtual-list/index.js +0 -7
  234. package/packages/hr-virtual-list/src/cc-item.vue +0 -105
  235. package/packages/hr-virtual-list/src/index.vue +0 -227
  236. package/packages/hr-virtual-list//350/231/232/346/213/237/345/210/227/350/241/250.md +0 -0
  237. package/packages/index.js +0 -23
  238. package/packages/utils/directive/common.js +0 -0
  239. package/packages/utils/directive/index.js +0 -2
  240. package/packages/utils/directive/specific.js +0 -54
  241. package/packages/utils/index.js +0 -7
  242. package/packages/utils/tool/common.js +0 -65
  243. package/packages/utils/tool/index.js +0 -2
  244. package/packages/utils/tool/specific.js +0 -0
@@ -1,154 +0,0 @@
1
- <script>
2
- import { formatToDate, formatToString } from './utils/tools'
3
- // import { hrDayJs } from './tools'
4
-
5
- export default {
6
- name: 'DateRangeSelect',
7
- props: {
8
- defaultValue: {
9
- type: Array,
10
- default: () => ([])
11
- },
12
- min: [String, Number, Date],
13
- max: [String, Number, Date],
14
- },
15
- data () {
16
- return {
17
- currentDate: [],
18
- currentMin: new Date(),
19
- currentMax: new Date()
20
- }
21
- },
22
- watch: {
23
- defaultValue () {
24
- this.init()
25
- }
26
- },
27
- created () {
28
- this.disposeVantBug()
29
- this.init()
30
- this.handleSelect(this.currentDate)
31
- },
32
- methods: {
33
- init () {
34
- if (this.defaultValue.length) {
35
- this.currentDate = [formatToDate(this.defaultValue[0]), formatToDate(this.defaultValue[1])]
36
- }
37
- if (!this.min) {
38
- let _date = new Date()
39
- let y = _date.getFullYear()
40
- let m = _date.getMonth() + 1
41
- this.currentMin = (m - 6) < 1 ? new Date(y - 1, 12 + m - 5, 1) : new Date(y, m - 5, 1)
42
- } else {
43
- this.currentMin = formatToDate(this.min)
44
- }
45
- if (!this.max) {
46
- let _date = new Date()
47
- let y = _date.getFullYear()
48
- let m = _date.getMonth() + 1
49
- this.currentMax = (m + 6) > 12 ? new Date(y + 1, m + 6 - 12, 0) : new Date(y, m + 6, 0)
50
- } else {
51
- this.currentMax = formatToDate(this.max)
52
- }
53
- },
54
- disposeVantBug () {
55
- this.$nextTick(() => {
56
- const select = document.querySelector('.van-calendar__body')
57
- console.log(select, 'select')
58
- select.scrollTop += 1
59
- })
60
- },
61
- handleSelect (e) {
62
- console.log(e, 'swq')
63
- this.$emit('select', { date: e, str: [formatToString(e[0]), formatToString(e[1])] })
64
- }
65
- },
66
- render () {
67
- return <van-calendar class="ks-daterange-select"
68
- default-date={this.currentDate}
69
- poppable={false}
70
- show-confirm={false}
71
- show-title={false}
72
- show-subtitle={false}
73
- min-date={this.currentMin}
74
- max-date={this.currentMax}
75
- lazy-render={false}
76
- allow-same-day={true}
77
- safe-area-inset-bottom={true}
78
- row-height="44"
79
- type="range"
80
- onSelect={this.handleSelect} />
81
- }
82
- }
83
- </script>
84
-
85
- <style lang="less">
86
- .ks-daterange-select {
87
- .van-calendar__day {
88
- margin: 3px 0;
89
- }
90
- .van-calendar__day--middle {
91
- color: #7972fe !important;
92
- &::after {
93
- top: 0 !important;
94
- bottom: 0 !important;
95
- }
96
- }
97
- .van-calendar__day--start,
98
- .van-calendar__day--end {
99
- margin-left: calc((14.285% - 44px) / 2);
100
- margin-right: calc((14.285% - 44px) / 2);
101
- }
102
- .van-calendar__day--start-end {
103
- margin-left: calc((14.285% - 54px) / 2);
104
- margin-right: calc((14.285% - 54px) / 2);
105
- }
106
- }
107
- .van-calendar__day {
108
- margin: 3px 0;
109
- }
110
- .van-calendar__day--start {
111
- position: relative;
112
- border-radius: 40px;
113
- width: 44px;
114
- margin-left: calc((14.285% - 44px) / 2);
115
- margin-right: calc((14.285% - 44px) / 2);
116
- &::after {
117
- position: absolute;
118
- left: 50%;
119
- top: 0;
120
- bottom: 0;
121
- width: 85%;
122
- content: " ";
123
- background-color: rgba(121, 114, 254, 0.1);
124
- }
125
- }
126
- .van-calendar__day--end {
127
- position: relative;
128
- border-radius: 40px;
129
- width: 44px;
130
- margin-left: calc((14.285% - 44px) / 2);
131
- margin-right: calc((14.285% - 44px) / 2);
132
- &::after {
133
- position: absolute;
134
- right: 50%;
135
- top: 0;
136
- bottom: 0;
137
- width: 85%;
138
- content: " ";
139
- background-color: rgba(121, 114, 254, 0.1);
140
- }
141
- }
142
- .filter-data-pop {
143
- .time-pop-box {
144
- height: 100%;
145
- width: 100%;
146
- display: flex;
147
- flex-direction: column;
148
- .date-content {
149
- flex: 1;
150
- overflow: hidden;
151
- }
152
- }
153
- }
154
- </style>
@@ -1,380 +0,0 @@
1
- <script>
2
- import DateRangeSelect from './date-range-select.vue'
3
- import { hrDayJs } from './utils/tools'
4
- import { DATE_SHORTCUT_PARAMS } from '../../enum/index.js'
5
-
6
-
7
- export default {
8
- name: 'TimeSelector',
9
- components: {
10
- DateRangeSelect,
11
- },
12
- props: {
13
- comItem: {
14
- type: Object,
15
- default: () => ({})
16
- },
17
- type: {
18
- type: String,
19
- default: 'daterange'
20
- },
21
- min: {
22
- type: String,
23
- default: '2020/01/01'
24
- },
25
- isTab: { // 是否显示快捷按钮
26
- type: Boolean,
27
- default: true
28
- },
29
- defaultValue: {
30
- type: Number,
31
- default: 1
32
- },
33
- defaultType: {
34
- type: String,
35
- default: 'month'
36
- },
37
- title: {
38
- type: String,
39
- default () {
40
- return '请选择'
41
- }
42
- },
43
- },
44
- data () {
45
- return {
46
- startDate: '',
47
- endDate: '',
48
- show: false,
49
- defaultDate: [],
50
- active: '',
51
- maxDate: hrDayJs(new Date())
52
- .subtract(-1, 'month')
53
- .format('YYYY/MM/DD'),
54
- selectValue: [],
55
- dateKey: 1
56
- }
57
- },
58
- mounted () {
59
- this.initDate();
60
- },
61
- methods: {
62
- handleChoose (active) {
63
- const param = DATE_SHORTCUT_PARAMS[active]
64
- const { count, type } = param
65
- this.startDate = hrDayJs().subtract(count, type).format('YYYY/MM/DD')
66
- this.endDate = hrDayJs().format('YYYY/MM/DD')
67
- this.active = active
68
- this.defaultDate = [this.startDate + ' 00:00:00', this.endDate + ' 23:59:59']
69
- this.$emit('input', this.defaultDate)
70
- },
71
- initDate () {
72
- let startDate = hrDayJs(new Date()).subtract(this.defaultValue, this.defaultType).format('YYYY/MM')
73
- let endDate = hrDayJs(new Date()).format('YYYY/MM/DD')
74
- this.defaultDate = [startDate + '/01 00:00:00', endDate + ' 23:59:59']
75
- this.selectValue = { str: [startDate, endDate] }
76
- this.startDate = null
77
- this.endDate = null
78
- this.active = ''
79
- // this.comItem.value = []
80
- },
81
- closePop () {
82
- this.show = false
83
- },
84
- showPop () {
85
- this.show = true
86
- },
87
- // 校验时间差
88
- timeDifference (date1, date2) {
89
- date1 = new Date(date1)
90
- date2 = new Date(date2)
91
- var newYear = date1.getFullYear()
92
- var newMonth = date1.getMonth() + 2
93
- if (newMonth >= 11) {
94
- newYear += 1
95
- newMonth -= 11
96
- date1.setFullYear(newYear)
97
- date1.setMonth(newMonth - 1)
98
- } else {
99
- date1.setFullYear(newYear)
100
- date1.setMonth(newMonth)
101
- }
102
- if (date1.getTime() >= date2.getTime()) {
103
- return true
104
- } else {
105
- return false
106
- }
107
- },
108
- // 时间选择器确认事件
109
- onSelect (value) {
110
- this.selectValue = value
111
- },
112
- submit () {
113
- console.log('submit', this.selectValue)
114
- let value = this.selectValue
115
- if (value.str && value.str.length && value.str[1]) {
116
- let res = this.timeDifference(value.str[0] + ' 00:00:00', value.str[1] + ' 00:00:00')
117
- if (res) {
118
- this.startDate = value.str[0]
119
- this.endDate = value.str[1]
120
- let val = [value.str[0] + ' 00:00:00', value.str[1] + ' 23:59:59']
121
- this.defaultDate = val
122
- this.$emit('input', val)
123
- this.active = ''
124
- this.show = false
125
- } else {
126
- this.$toast('选择时间不能超过2个月')
127
- }
128
-
129
- } else {
130
- this.$toast('请选择结束时间')
131
- }
132
- },
133
- reset () {
134
- this.initDate()
135
- this.dateKey++
136
- }
137
- },
138
- render () {
139
- {/* 渲染时间范围选择框 */ }
140
- const renderRangeInputBox = () => {
141
- return <div class="input-box">
142
- <span>{this.startDate}</span>
143
- <span class="mid-key"> - </span>
144
- <span>{this.endDate}</span>
145
- </div>
146
- }
147
-
148
- {/* 渲染单个时间选择框 */ }
149
- const renderInputBox = () => {
150
- return <div class="input-box">
151
- <span>{this.defaultDate}</span>
152
- </div>
153
- }
154
-
155
- {/* 快捷选项 */ }
156
- const renderSelectorShortcutBox = () => {
157
- return <div class="selector-shortcut">
158
- {
159
- Object.keys(DATE_SHORTCUT_PARAMS).map((key) => {
160
- return <div class={["shortcut-item", key == this.active ? 'active' : '']}
161
- onClick={this.handleChoose.bind(this, key)}
162
- key={key}>{DATE_SHORTCUT_PARAMS[key].text}</div>
163
- })
164
- }
165
- </div>
166
- }
167
-
168
- return <div class="time-selector">
169
- {/* 头部 */}
170
- <div class="selector-title">{this.title}</div>
171
- {/* 选择框 */}
172
- <div class="selector-input" onClick={this.showPop}>
173
- {this.type == 'daterange' && renderRangeInputBox()}
174
- {this.type == 'date' && renderInputBox()}
175
- <span class="input-icon"></span>
176
- </div>
177
- {/* 是否显示快捷按钮 */}
178
- {this.isTab && renderSelectorShortcutBox()}
179
- {/* 时间选择框 */}
180
- <div class="selector-popup">
181
- <van-popup
182
- value={this.show}
183
- onInput={(value) => { this.show = value }}
184
- style="height: 100%"
185
- get-container="body"
186
- position="right">
187
- <div class="popup-date">
188
- <header class="ksui-header">
189
- <div class="back-icon" onClick={() => { this.show = false }}>
190
- <van-icon size={15} name="arrow-left" />
191
- <span>选择时间段</span>
192
- </div>
193
- </header>
194
- <div class="date-content">
195
- <DateRangeSelect defaultValue={this.defaultDate}
196
- v-show={this.show}
197
- key={this.dateKey}
198
- min={this.min}
199
- max={this.maxDate}
200
- ref="dateRangeSelect"
201
- onSelect={this.onSelect} />
202
- </div>
203
- <div class="date-footer">
204
- <van-button type="default" onClick={this.reset} class="footer-btn left-btn">重置</van-button>
205
- <van-button type="primary" onClick={this.submit} class="footer-btn">确定</van-button>
206
- </div>
207
- </div >
208
- </van-popup>
209
- </div>
210
- </div >
211
- }
212
- }
213
- </script>
214
-
215
- <style lang="less" scoped>
216
- /deep/.van-calendar__body {
217
- .van-calendar__day--disabled {
218
- color: #ccc;
219
- }
220
- }
221
- /deep/.ksui-header {
222
- .back-icon {
223
- font-weight: 600 !important;
224
- font-size: 16px !important;
225
- .van-icon {
226
- font-weight: 600 !important;
227
- }
228
- }
229
- }
230
- .time-selector {
231
- width: 100%;
232
- text-align: center;
233
- line-height: 38px;
234
- .selector-title {
235
- line-height: 20px;
236
- margin-bottom: 12px;
237
- text-align: left;
238
- font-size: 14px;
239
- font-weight: 600;
240
- color: #03050d;
241
- .title-black {
242
- font-size: 14px;
243
- font-weight: normal;
244
- color: #6e6d72;
245
- }
246
- }
247
- .selector-input {
248
- background: #f3f4f6;
249
- border-radius: 8px;
250
- color: #232323;
251
- display: flex;
252
- justify-content: space-between;
253
- padding: 0 20px;
254
- align-items: center;
255
- line-height: 32px;
256
- .input-box {
257
- font-size: 14px;
258
- color: #333333;
259
- display: flex;
260
- justify-content: space-between;
261
- width: 100%;
262
- span {
263
- flex: 3;
264
- }
265
- .mid-key {
266
- flex: 1;
267
- }
268
- }
269
- .input-icon {
270
- display: inline-block;
271
- width: 14px;
272
- height: 14px;
273
- background: url("./images/date-icon.png") no-repeat;
274
- background-size: 100%;
275
- }
276
- }
277
- .selector-shortcut {
278
- display: flex;
279
- flex-wrap: wrap;
280
- // justify-content: space-between;
281
- justify-content: flex-start;
282
-
283
- margin-top: 12px;
284
- .shortcut-item {
285
- width: calc((100% - 16px) / 3);
286
- text-align: center;
287
- background: #f3f4f6;
288
- border-radius: 8px;
289
- margin-bottom: 11px;
290
- margin-right: 8px;
291
- line-height: 28px;
292
- font-size: 12px;
293
- color: #03050d;
294
-
295
- &.active {
296
- // border: 1px solid #7972fe;
297
- background: rgba(121, 114, 254, 0.08);
298
- color: #7972fe;
299
- position: relative;
300
- &::after {
301
- content: " ";
302
- position: absolute;
303
- left: 0;
304
- top: 0;
305
- width: 200%;
306
- height: 200%;
307
- border: 1px solid #7972fe;
308
- border-radius: 16px;
309
- -webkit-transform-origin: 0 0;
310
- transform-origin: 0 0;
311
- -webkit-transform: scale(0.5);
312
- transform: scale(0.5);
313
- }
314
- }
315
- }
316
- .shortcut-item:nth-child(3n) {
317
- margin-right: 0;
318
- }
319
- }
320
- }
321
- .popup-date {
322
- .back-icon {
323
- font-size: 14px;
324
- color: #03050d;
325
- font-weight: 500;
326
- display: inline-block;
327
- padding: 12px;
328
- i {
329
- position: relative;
330
- top: -1px;
331
- }
332
- span {
333
- margin-left: 2px;
334
- position: relative;
335
- top: -3px;
336
- }
337
- }
338
- /deep/ .van-calendar__bottom-info {
339
- bottom: 1px !important;
340
- }
341
- }
342
- .date-footer {
343
- width: 100%;
344
- padding: 14px 20px;
345
- // height: 64px;
346
- flex-shrink: 0;
347
- display: flex;
348
- justify-content: space-around;
349
- align-items: center;
350
- overflow: hidden;
351
- box-sizing: border-box;
352
- .footer-btn {
353
- height: 36px;
354
- width: 44%;
355
- border-radius: 8px;
356
- height: 40px;
357
- }
358
- .left-btn {
359
- color: #8b83fc;
360
- position: relative;
361
- border: none;
362
- font-size: 16px;
363
- height: 40px;
364
- &::after {
365
- content: " ";
366
- position: absolute;
367
- left: 0;
368
- top: 0;
369
- width: 200%;
370
- height: 200%;
371
- border: 1px solid #7972fe;
372
- border-radius: 16px;
373
- -webkit-transform-origin: 0 0;
374
- transform-origin: 0 0;
375
- -webkit-transform: scale(0.5);
376
- transform: scale(0.5);
377
- }
378
- }
379
- }
380
- </style>
@@ -1,30 +0,0 @@
1
- export const SECONDS_A_MINUTE = 60
2
- export const SECONDS_A_HOUR = SECONDS_A_MINUTE * 60
3
- export const SECONDS_A_DAY = SECONDS_A_HOUR * 24
4
- export const SECONDS_A_WEEK = SECONDS_A_DAY * 7
5
-
6
- export const MILLISECONDS_A_SECOND = 1e3
7
- export const MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND
8
- export const MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND
9
- export const MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND
10
- export const MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND
11
-
12
- // English locales
13
- export const MS = 'millisecond'
14
- export const S = 'second'
15
- export const MIN = 'minute'
16
- export const H = 'hour'
17
- export const D = 'day'
18
- export const W = 'week'
19
- export const M = 'month'
20
- export const Q = 'quarter'
21
- export const Y = 'year'
22
- export const DATE = 'date'
23
-
24
- export const FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ'
25
-
26
- export const INVALID_DATE_STRING = 'Invalid Date'
27
-
28
- // regex
29
- export const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/
30
- export const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g