@kyfe/hroa-ui 0.0.1 → 0.0.3

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 (288) hide show
  1. package/README.md +49 -22
  2. package/dist/404.html +20 -0
  3. package/dist/ERP-components/index.html +34 -0
  4. package/dist/H5-components/custom//346/211/223/345/274/200/350/267/250/345/243/260/350/201/212/345/244/251.html +34 -0
  5. package/dist/H5-components/index.html +34 -0
  6. package/dist/H5-components/initial-stage/introduce.html +71 -0
  7. package/dist/H5-components/initial-stage/updateLog.html +42 -0
  8. package/dist/H5-components/views/tic-rich-input.html +95 -0
  9. package/dist/H5-components/views//346/213/226/346/213/275dom/345/205/203/347/264/240.html +52 -0
  10. package/dist/H5-components/views//346/214/211/351/222/256/347/277/273/351/241/265/347/273/204/344/273/266.html +48 -0
  11. package/dist/H5-components/views//346/273/221/345/212/250/347/277/273/351/241/265/347/273/204/344/273/266.html +51 -0
  12. package/dist/assets/css/0.styles.df919f3e.css +8 -0
  13. package/dist/assets/img/hr-pager.34bafc88.png +0 -0
  14. package/dist/assets/img/search.83621669.svg +1 -0
  15. package/dist/assets/img/slide-pager.8e2433c6.png +0 -0
  16. package/dist/assets/img/tic-rich-input.8beff81a.png +0 -0
  17. package/dist/assets/img/v-dragable.b824e34a.png +0 -0
  18. package/dist/assets/js/1.b735a6b9.js +1 -0
  19. package/dist/assets/js/12.23c4fee9.js +1 -0
  20. package/dist/assets/js/13.3da0c9aa.js +1 -0
  21. package/dist/assets/js/14.3356e8f7.js +1 -0
  22. package/dist/assets/js/15.d6eecfd8.js +1 -0
  23. package/dist/assets/js/16.4ffe823f.js +1 -0
  24. package/dist/assets/js/17.7b93bad9.js +1 -0
  25. package/dist/assets/js/18.11371dfb.js +1 -0
  26. package/dist/assets/js/19.416e5407.js +1 -0
  27. package/dist/assets/js/2.dc0cacdb.js +1 -0
  28. package/dist/assets/js/20.74e92b24.js +1 -0
  29. package/dist/assets/js/21.a60b56ab.js +1 -0
  30. package/dist/assets/js/22.2fae118b.js +1 -0
  31. package/dist/assets/js/23.6e3d1710.js +1 -0
  32. package/dist/assets/js/24.4160ee24.js +1 -0
  33. package/dist/assets/js/25.0ffd750f.js +1 -0
  34. package/dist/assets/js/26.32cd369d.js +1 -0
  35. package/dist/assets/js/27.8fcb6434.js +1 -0
  36. package/dist/assets/js/28.359c258c.js +1 -0
  37. package/dist/assets/js/29.739e5995.js +1 -0
  38. package/dist/assets/js/3.cca146d6.js +1 -0
  39. package/dist/assets/js/30.6a338bb7.js +1 -0
  40. package/dist/assets/js/31.f29dd7e6.js +1 -0
  41. package/dist/assets/js/32.39b11d5d.js +1 -0
  42. package/dist/assets/js/33.8a822667.js +1 -0
  43. package/dist/assets/js/34.9e1e9fdb.js +1 -0
  44. package/dist/assets/js/35.00b584d6.js +1 -0
  45. package/dist/assets/js/36.4005f115.js +1 -0
  46. package/dist/assets/js/37.a76ba098.js +1 -0
  47. package/dist/assets/js/38.b2331905.js +1 -0
  48. package/dist/assets/js/39.d1ef70eb.js +1 -0
  49. package/dist/assets/js/4.2e3cdcda.js +1 -0
  50. package/dist/assets/js/40.80762a79.js +1 -0
  51. package/dist/assets/js/41.b30a6572.js +1 -0
  52. package/dist/assets/js/42.2abb93f1.js +1 -0
  53. package/dist/assets/js/43.3060afbe.js +1 -0
  54. package/dist/assets/js/44.4ca5cdaa.js +1 -0
  55. package/dist/assets/js/45.2aefab82.js +1 -0
  56. package/dist/assets/js/46.94373d07.js +1 -0
  57. package/dist/assets/js/47.1a325aa2.js +1 -0
  58. package/dist/assets/js/48.63967e1a.js +1 -0
  59. package/dist/assets/js/49.632d6f06.js +1 -0
  60. package/dist/assets/js/5.84ceb550.js +1 -0
  61. package/dist/assets/js/50.122dcadf.js +1 -0
  62. package/dist/assets/js/51.de943550.js +1 -0
  63. package/dist/assets/js/52.70b10851.js +1 -0
  64. package/dist/assets/js/53.8852d650.js +1 -0
  65. package/dist/assets/js/54.2a74d28d.js +1 -0
  66. package/dist/assets/js/55.e48fe797.js +1 -0
  67. package/dist/assets/js/56.ebdbcffb.js +1 -0
  68. package/dist/assets/js/57.e087b0fe.js +1 -0
  69. package/dist/assets/js/58.3801ee85.js +1 -0
  70. package/dist/assets/js/59.7b5d18c0.js +1 -0
  71. package/dist/assets/js/6.61f28a2c.js +1 -0
  72. package/dist/assets/js/60.69f85710.js +1 -0
  73. package/dist/assets/js/61.ccded94e.js +1 -0
  74. package/dist/assets/js/62.49aaec93.js +1 -0
  75. package/dist/assets/js/63.ed0dd65b.js +1 -0
  76. package/dist/assets/js/64.50827258.js +1 -0
  77. package/dist/assets/js/65.fb0e39c2.js +1 -0
  78. package/dist/assets/js/66.0f253a81.js +1 -0
  79. package/dist/assets/js/67.871e932d.js +1 -0
  80. package/dist/assets/js/68.daa5a202.js +1 -0
  81. package/dist/assets/js/69.b097197f.js +1 -0
  82. package/dist/assets/js/7.49cc9ae9.js +1 -0
  83. package/dist/assets/js/70.765eda7b.js +1 -0
  84. package/dist/assets/js/71.63871fac.js +1 -0
  85. package/dist/assets/js/72.8b18b0c9.js +1 -0
  86. package/dist/assets/js/73.19e03de2.js +1 -0
  87. package/dist/assets/js/74.d53dccaa.js +1 -0
  88. package/dist/assets/js/75.acd6fc61.js +1 -0
  89. package/dist/assets/js/76.078ca037.js +1 -0
  90. package/dist/assets/js/77.d841f01e.js +1 -0
  91. package/dist/assets/js/78.a7365451.js +1 -0
  92. package/dist/assets/js/79.dd3a87ea.js +1 -0
  93. package/dist/assets/js/8.9cb30c6d.js +1 -0
  94. package/dist/assets/js/80.fb936b5b.js +1 -0
  95. package/dist/assets/js/81.2e26e94f.js +1 -0
  96. package/dist/assets/js/82.2a3a6e2c.js +1 -0
  97. package/dist/assets/js/83.db18cd89.js +1 -0
  98. package/dist/assets/js/84.1b4f6da9.js +1 -0
  99. package/dist/assets/js/85.7ad98dbe.js +1 -0
  100. package/dist/assets/js/86.4cc432c1.js +1 -0
  101. package/dist/assets/js/87.73d3f488.js +1 -0
  102. package/dist/assets/js/88.912a9f32.js +1 -0
  103. package/dist/assets/js/89.9177aadb.js +1 -0
  104. package/dist/assets/js/9.5eb3dd52.js +9 -0
  105. package/dist/assets/js/90.d7d98ef8.js +1 -0
  106. package/dist/assets/js/91.41d2835a.js +1 -0
  107. package/dist/assets/js/92.2e7bac23.js +1 -0
  108. package/dist/assets/js/app.9bfd80ac.js +16 -0
  109. package/dist/assets/js/vendors~docsearch.c220fc7a.js +3 -0
  110. package/dist/guide/about//346/255/244/346/226/207/346/241/243/351/241/271/347/233/256.html +41 -0
  111. package/dist/guide/index.html +34 -0
  112. package/dist/index.html +40 -0
  113. package/dist/local-js/axios@0.19.0.min.js +9 -0
  114. package/dist/local-js/ks@3.0.7.umd.min.js +1 -0
  115. package/dist/local-js/ksui@3.0.37.umd.min.js +10 -0
  116. package/dist/local-js/ksui@3.0.41.umd.min.js +10 -0
  117. package/dist/local-js/quill.js +3 -0
  118. package/dist/local-js/vant@2.5.6.min.js +7 -0
  119. package/dist/local-js/vconsole.min.js +10 -0
  120. package/dist/local-js/vue-router@3.1.3.min.js +6 -0
  121. package/dist/local-js/vue@2.6.10.runtime.min.js +6 -0
  122. package/dist/local-js/vue@2.7.16.min.js +11932 -0
  123. package/dist/local-js/vuex@3.1.1.min.js +6 -0
  124. package/dist/utils/ERP/ERP/345/267/245/345/205/267/346/226/271/346/263/225.html +38 -0
  125. package/dist/utils/H5/H5/345/267/245/345/205/267/346/226/271/346/263/225.html +55 -0
  126. package/dist/utils/H5/copyText /345/244/215/345/210/266.html" +45 -0
  127. package/dist/utils/index.html +34 -0
  128. package/dist//346/226/207/346/241/243/345/272/223/346/226/207/344/273/266/345/244/271.html +46 -0
  129. package/lib/hr-at-input/index.css +6 -0
  130. package/lib/hr-at-input/index.js +1 -0
  131. package/lib/hr-bottom-button/index.css +1 -1
  132. package/lib/hr-bottom-button/index.js +1 -1
  133. package/lib/hr-clipboard/index.css +1 -1
  134. package/lib/hr-clipboard/index.js +1 -1
  135. package/lib/hr-condition-filtrate/index.js +1 -1
  136. package/lib/hr-condition-filtrate-popup/index.css +1 -0
  137. package/lib/hr-condition-filtrate-popup/index.js +1 -0
  138. package/lib/hr-elasticity-box/index.css +1 -0
  139. package/lib/hr-elasticity-box/index.js +1 -0
  140. package/lib/hr-elasticity-box-item/index.css +1 -0
  141. package/lib/hr-elasticity-box-item/index.js +1 -0
  142. package/lib/hr-employee-choose/index.css +1 -0
  143. package/lib/hr-employee-choose/index.js +1 -0
  144. package/lib/hr-img-list/index.css +1 -0
  145. package/lib/hr-img-list/index.js +1 -0
  146. package/lib/hr-info-card/index.css +1 -0
  147. package/lib/hr-info-card/index.js +1 -0
  148. package/lib/hr-license-plate-number/index.css +1 -0
  149. package/lib/hr-license-plate-number/index.js +1 -0
  150. package/lib/hr-multiterm-choose/index.css +1 -0
  151. package/lib/hr-multiterm-choose/index.js +1 -0
  152. package/lib/hr-no-data/index.css +1 -0
  153. package/lib/hr-no-data/index.js +1 -0
  154. package/lib/hr-open-ks/index.css +1 -1
  155. package/lib/hr-open-ks/index.js +1 -1
  156. package/lib/hr-popup/index.css +1 -0
  157. package/lib/hr-popup/index.js +1 -0
  158. package/lib/hr-preview-file/index.css +1 -0
  159. package/lib/hr-preview-file/index.js +1 -0
  160. package/lib/hr-rate/index.css +1 -0
  161. package/lib/hr-rate/index.js +1 -0
  162. package/lib/hr-reason-textarea/index.css +1 -0
  163. package/lib/hr-reason-textarea/index.js +1 -0
  164. package/lib/hr-select/index.js +1 -1
  165. package/lib/hr-select-list/index.css +1 -0
  166. package/lib/hr-select-list/index.js +9 -0
  167. package/lib/hr-single-choose/index.css +1 -0
  168. package/lib/hr-single-choose/index.js +1 -0
  169. package/lib/hr-slide-pager/index.js +1 -1
  170. package/lib/hr-sort/index.css +1 -0
  171. package/lib/hr-sort/index.js +1 -0
  172. package/lib/hr-stack-image/index.js +1 -1
  173. package/lib/hr-tab-nav/index.css +1 -1
  174. package/lib/hr-tab-nav/index.js +1 -1
  175. package/lib/index/index.css +8 -1
  176. package/lib/index/index.js +9 -1
  177. package/package.json +67 -66
  178. package/packages/hr-at-input/index.js +7 -0
  179. package/packages/hr-at-input/src/blot/atPerson.js +43 -0
  180. package/packages/hr-at-input/src/index.vue +472 -0
  181. package/packages/hr-at-input/src/quill.snow.css +945 -0
  182. package/packages/hr-at-input/src/utils/index.js +60 -0
  183. package/packages/hr-at-input//346/224/257/346/214/201@/351/200/211/344/272/272/350/276/223/345/205/245/346/241/206.md +0 -0
  184. package/packages/hr-bottom-button/index.js +6 -6
  185. package/packages/hr-bottom-button/src/index.vue +108 -84
  186. package/packages/hr-button/index.js +12 -12
  187. package/packages/hr-button/src/hr-button.vue +38 -38
  188. package/packages/hr-clipboard/index.js +8 -3
  189. package/packages/hr-clipboard/src/index.vue +46 -0
  190. package/packages/hr-clipboard/src/util.js +9 -9
  191. package/packages/hr-condition-filtrate/enum/index.js +10 -10
  192. package/packages/hr-condition-filtrate/index.js +6 -6
  193. package/packages/hr-condition-filtrate/src/employee-choose/index.vue +101 -101
  194. package/packages/hr-condition-filtrate/src/index.vue +245 -245
  195. package/packages/hr-condition-filtrate/src/multiterm-choose/index.vue +166 -166
  196. package/packages/hr-condition-filtrate/src/org-tree-choose/index.vue +101 -101
  197. package/packages/hr-condition-filtrate/src/single-choose/index.vue +143 -143
  198. package/packages/hr-condition-filtrate/src/text-input/index.vue +60 -60
  199. package/packages/hr-condition-filtrate/src/time-selector/date-range-select.vue +154 -154
  200. package/packages/hr-condition-filtrate/src/time-selector/index.vue +380 -380
  201. package/packages/hr-condition-filtrate/src/time-selector/utils/constant.js +30 -30
  202. package/packages/hr-condition-filtrate/src/time-selector/utils/tools.js +212 -212
  203. package/packages/hr-condition-filtrate-popup/index.js +7 -0
  204. package/packages/hr-condition-filtrate-popup/src/index.vue +236 -0
  205. package/packages/hr-elasticity-box/index.js +7 -0
  206. package/packages/hr-elasticity-box/src/elasticity-box-item.vue +61 -0
  207. package/packages/hr-elasticity-box/src/index.vue +53 -0
  208. package/packages/hr-elasticity-box-item/index.js +7 -0
  209. package/packages/hr-emotional-picture/index.js +6 -6
  210. package/packages/hr-emotional-picture/src/index.vue +66 -66
  211. package/packages/hr-employee-choose/index.js +7 -0
  212. package/packages/hr-employee-choose/src/image/arrow-right.png +0 -0
  213. package/packages/hr-employee-choose/src/index.vue +119 -0
  214. package/packages/hr-img-list/index.js +3 -0
  215. package/packages/hr-img-list/src/index.vue +144 -0
  216. package/packages/hr-img-list//345/244/232/345/233/276/345/210/227/350/241/250.md +0 -0
  217. package/packages/hr-info-card/index.js +7 -0
  218. package/packages/hr-info-card/src/index.vue +67 -0
  219. package/packages/hr-license-plate-number/index.js +8 -0
  220. package/packages/hr-license-plate-number/src/enum.js +44 -0
  221. package/packages/hr-license-plate-number/src/index.vue +164 -0
  222. package/packages/hr-license-plate-number/src/vnp-keyboard.vue +182 -0
  223. package/packages/hr-license-plate-number//350/275/246/347/211/214/345/217/267/345/274/271/347/252/227.md +0 -0
  224. package/packages/hr-module-card/index.js +12 -12
  225. package/packages/hr-module-card/src/index.vue +132 -132
  226. package/packages/hr-module-card//346/250/241/345/235/227/345/215/241/347/211/207/347/273/204/344/273/266.md +29 -29
  227. package/packages/hr-multiterm-choose/index.js +8 -0
  228. package/packages/hr-multiterm-choose/src/index.vue +169 -0
  229. package/packages/hr-multiterm-choose//345/244/232/351/200/211/346/241/206.md +0 -0
  230. package/packages/hr-no-data/index.js +7 -0
  231. package/packages/hr-no-data/src/index.vue +48 -0
  232. package/packages/hr-notice-bar/index.js +6 -6
  233. package/packages/hr-notice-bar/src/bem.js +37 -37
  234. package/packages/hr-notice-bar/src/index.js +51 -51
  235. package/packages/hr-notice-bar//351/200/232/347/237/245/346/240/217/347/273/204/344/273/266.md +2 -2
  236. package/packages/hr-open-ks/index.js +7 -3
  237. package/packages/hr-open-ks/src/{main.vue → index.vue} +97 -85
  238. package/packages/hr-open-ks/src/util.js +31 -31
  239. package/packages/hr-pager/index.js +6 -6
  240. package/packages/hr-pager/src/index.vue +95 -95
  241. package/packages/hr-popup/index.js +3 -0
  242. package/packages/hr-popup/src/index.vue +60 -0
  243. package/packages/hr-popup//345/274/271/345/207/272/345/261/202.md +0 -0
  244. package/packages/hr-preview-file/index.js +7 -0
  245. package/packages/hr-preview-file/src/index.vue +58 -0
  246. package/packages/hr-preview-file/src/util.js +50 -0
  247. package/packages/hr-rate/index.js +7 -0
  248. package/packages/hr-rate/src/index.vue +42 -0
  249. 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
  250. package/packages/hr-reason-textarea/index.js +7 -0
  251. package/packages/hr-reason-textarea/src/index.vue +128 -0
  252. package/packages/hr-search-input/index.js +7 -7
  253. package/packages/hr-search-input/src/index.vue +144 -144
  254. package/packages/hr-select/index.js +7 -3
  255. package/packages/hr-select/src/index.vue +41 -0
  256. package/packages/hr-select-list/index.js +3 -0
  257. package/packages/hr-select-list/src/index.vue +168 -0
  258. 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
  259. package/packages/hr-single-choose/index.js +8 -0
  260. package/packages/hr-single-choose/src/index.vue +143 -0
  261. package/packages/hr-single-choose//345/215/225/351/200/211/346/241/206.md +0 -0
  262. package/packages/hr-slide-pager/guide/image/turn-left.png +0 -0
  263. package/packages/hr-slide-pager/guide/image/turn-right.png +0 -0
  264. package/packages/hr-slide-pager/guide/index.vue +58 -58
  265. package/packages/hr-slide-pager/index.js +6 -6
  266. package/packages/hr-slide-pager/src/index.vue +375 -370
  267. package/packages/hr-sort/index.js +3 -0
  268. package/packages/hr-sort/src/main.vue +133 -0
  269. package/packages/hr-sort//346/216/222/345/272/217.md +0 -0
  270. package/packages/hr-stack-image/index.js +3 -3
  271. package/packages/hr-stack-image/src/main.vue +76 -76
  272. package/packages/hr-tab-nav/index.js +7 -7
  273. package/packages/hr-tab-nav/src/index.vue +114 -96
  274. package/packages/hr-view-item/index.js +12 -12
  275. package/packages/hr-view-item/src/index.vue +89 -89
  276. package/packages/index.js +54 -53
  277. package/packages/utils/directive.js +58 -58
  278. package/packages/utils/index.js +73 -73
  279. package/dist/demo.html +0 -8
  280. package/dist/hrui.common.js +0 -3892
  281. package/dist/hrui.common.js.map +0 -1
  282. package/dist/hrui.umd.js +0 -3902
  283. package/dist/hrui.umd.js.map +0 -1
  284. package/dist/hrui.umd.min.js +0 -2
  285. package/dist/hrui.umd.min.js.map +0 -1
  286. package/packages/hr-clipboard/src/icon.png +0 -0
  287. package/packages/hr-clipboard/src/main.vue +0 -64
  288. package/packages/hr-select/src/main.vue +0 -62
@@ -1,380 +1,380 @@
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
+ <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>