eoss-mobiles 0.1.13

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 (285) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +28 -0
  3. package/lib/action-sheet.js +313 -0
  4. package/lib/button-group.js +421 -0
  5. package/lib/button.js +278 -0
  6. package/lib/calendar.js +301 -0
  7. package/lib/cascader.js +336 -0
  8. package/lib/cell.js +366 -0
  9. package/lib/checkbox.js +2170 -0
  10. package/lib/circle.js +299 -0
  11. package/lib/config/api.js +31 -0
  12. package/lib/count-down.js +299 -0
  13. package/lib/date.js +956 -0
  14. package/lib/empty.js +274 -0
  15. package/lib/eoss-mobile.common.js +15072 -0
  16. package/lib/field.js +440 -0
  17. package/lib/flow.js +5664 -0
  18. package/lib/form.js +714 -0
  19. package/lib/grid-item.js +274 -0
  20. package/lib/grid.js +317 -0
  21. package/lib/image-preview.js +325 -0
  22. package/lib/index.js +1 -0
  23. package/lib/list.js +315 -0
  24. package/lib/loading.js +279 -0
  25. package/lib/nav-bar.js +283 -0
  26. package/lib/pagination.js +323 -0
  27. package/lib/picker.js +2714 -0
  28. package/lib/popover.js +306 -0
  29. package/lib/popup.js +297 -0
  30. package/lib/radio.js +2137 -0
  31. package/lib/rate.js +300 -0
  32. package/lib/search.js +316 -0
  33. package/lib/selector.js +3496 -0
  34. package/lib/skeleton.js +277 -0
  35. package/lib/stepper.js +300 -0
  36. package/lib/switch.js +304 -0
  37. package/lib/tab.js +274 -0
  38. package/lib/table-column.js +2991 -0
  39. package/lib/table.js +2652 -0
  40. package/lib/tabs.js +315 -0
  41. package/lib/tag.js +281 -0
  42. package/lib/theme-chalk/action-sheet.css +0 -0
  43. package/lib/theme-chalk/base.css +1 -0
  44. package/lib/theme-chalk/button-group.css +1 -0
  45. package/lib/theme-chalk/button.css +1 -0
  46. package/lib/theme-chalk/calendar.css +1 -0
  47. package/lib/theme-chalk/cascader.css +1 -0
  48. package/lib/theme-chalk/cell.css +1 -0
  49. package/lib/theme-chalk/checkbox.css +1 -0
  50. package/lib/theme-chalk/circle.css +1 -0
  51. package/lib/theme-chalk/count-down.css +0 -0
  52. package/lib/theme-chalk/date.css +0 -0
  53. package/lib/theme-chalk/empty.css +0 -0
  54. package/lib/theme-chalk/field.css +1 -0
  55. package/lib/theme-chalk/flow.css +1 -0
  56. package/lib/theme-chalk/fonts/iconfont.scss +530 -0
  57. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  58. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  59. package/lib/theme-chalk/form.css +0 -0
  60. package/lib/theme-chalk/grid-item.css +1 -0
  61. package/lib/theme-chalk/grid.css +0 -0
  62. package/lib/theme-chalk/icon.css +1 -0
  63. package/lib/theme-chalk/image-preview.css +0 -0
  64. package/lib/theme-chalk/index.css +1 -0
  65. package/lib/theme-chalk/list.css +0 -0
  66. package/lib/theme-chalk/loading.css +0 -0
  67. package/lib/theme-chalk/nav-bar.css +0 -0
  68. package/lib/theme-chalk/navbar.css +1 -0
  69. package/lib/theme-chalk/pagination.css +1 -0
  70. package/lib/theme-chalk/picker.css +1 -0
  71. package/lib/theme-chalk/popover.css +0 -0
  72. package/lib/theme-chalk/popup.css +0 -0
  73. package/lib/theme-chalk/radio.css +1 -0
  74. package/lib/theme-chalk/rate.css +0 -0
  75. package/lib/theme-chalk/search.css +0 -0
  76. package/lib/theme-chalk/selector.css +1 -0
  77. package/lib/theme-chalk/skeleton.css +0 -0
  78. package/lib/theme-chalk/stepper.css +1 -0
  79. package/lib/theme-chalk/switch.css +1 -0
  80. package/lib/theme-chalk/tab.css +0 -0
  81. package/lib/theme-chalk/table-column.css +0 -0
  82. package/lib/theme-chalk/table.css +1 -0
  83. package/lib/theme-chalk/tabs.css +1 -0
  84. package/lib/theme-chalk/tag.css +1 -0
  85. package/lib/theme-chalk/theme.css +0 -0
  86. package/lib/theme-chalk/tree.css +1 -0
  87. package/lib/theme-chalk/uploader.css +0 -0
  88. package/lib/uploader.js +307 -0
  89. package/lib/utils/axios.js +199 -0
  90. package/lib/utils/date-util.js +320 -0
  91. package/lib/utils/http.js +74 -0
  92. package/lib/utils/rules.js +21 -0
  93. package/lib/utils/store.js +24 -0
  94. package/lib/utils/util.js +1315 -0
  95. package/package.json +153 -0
  96. package/packages/action-sheet/index.js +5 -0
  97. package/packages/action-sheet/src/main.vue +32 -0
  98. package/packages/button/index.js +5 -0
  99. package/packages/button/src/main.vue +15 -0
  100. package/packages/button-group/index.js +5 -0
  101. package/packages/button-group/src/main.vue +80 -0
  102. package/packages/calendar/index.js +5 -0
  103. package/packages/calendar/src/main.vue +34 -0
  104. package/packages/cascader/index.js +5 -0
  105. package/packages/cascader/src/main.vue +40 -0
  106. package/packages/cell/index.js +5 -0
  107. package/packages/cell/src/main.vue +72 -0
  108. package/packages/checkbox/index.js +5 -0
  109. package/packages/checkbox/src/main.vue +149 -0
  110. package/packages/circle/index.js +5 -0
  111. package/packages/circle/src/main.vue +27 -0
  112. package/packages/count-down/index.js +5 -0
  113. package/packages/count-down/src/main.vue +27 -0
  114. package/packages/date/index.js +5 -0
  115. package/packages/date/src/date-time.vue +290 -0
  116. package/packages/date/src/main.vue +319 -0
  117. package/packages/empty/index.js +5 -0
  118. package/packages/empty/src/main.vue +16 -0
  119. package/packages/field/index.js +5 -0
  120. package/packages/field/src/main.vue +130 -0
  121. package/packages/flow/index.js +5 -0
  122. package/packages/flow/src/components/Handle.vue +1031 -0
  123. package/packages/flow/src/components/Message.vue +96 -0
  124. package/packages/flow/src/components/Opinion.vue +112 -0
  125. package/packages/flow/src/components/Reject.vue +202 -0
  126. package/packages/flow/src/components/StartFlow.vue +440 -0
  127. package/packages/flow/src/components/TaskRead.vue +237 -0
  128. package/packages/flow/src/main.vue +43 -0
  129. package/packages/form/index.js +5 -0
  130. package/packages/form/src/main.vue +158 -0
  131. package/packages/grid/index.js +5 -0
  132. package/packages/grid/src/main.vue +28 -0
  133. package/packages/grid-item/index.js +5 -0
  134. package/packages/grid-item/src/main.vue +16 -0
  135. package/packages/image-preview/index.js +5 -0
  136. package/packages/image-preview/src/main.vue +34 -0
  137. package/packages/list/index.js +5 -0
  138. package/packages/list/src/main.vue +32 -0
  139. package/packages/loading/index.js +5 -0
  140. package/packages/loading/src/main.vue +20 -0
  141. package/packages/nav-bar/index.js +5 -0
  142. package/packages/nav-bar/src/main.vue +16 -0
  143. package/packages/pagination/index.js +5 -0
  144. package/packages/pagination/src/main.vue +29 -0
  145. package/packages/picker/index.js +5 -0
  146. package/packages/picker/src/main.vue +500 -0
  147. package/packages/popover/index.js +5 -0
  148. package/packages/popover/src/main.vue +32 -0
  149. package/packages/popup/index.js +5 -0
  150. package/packages/popup/src/main.vue +27 -0
  151. package/packages/radio/index.js +5 -0
  152. package/packages/radio/src/main.vue +147 -0
  153. package/packages/rate/index.js +5 -0
  154. package/packages/rate/src/main.vue +27 -0
  155. package/packages/search/index.js +5 -0
  156. package/packages/search/src/main.vue +39 -0
  157. package/packages/selector/index.js +5 -0
  158. package/packages/selector/src/main.vue +77 -0
  159. package/packages/selector/src/selector-field.vue +225 -0
  160. package/packages/selector/src/selector-tree.vue +472 -0
  161. package/packages/selector/src/tree.vue +179 -0
  162. package/packages/skeleton/index.js +5 -0
  163. package/packages/skeleton/src/main.vue +17 -0
  164. package/packages/stepper/index.js +5 -0
  165. package/packages/stepper/src/main.vue +25 -0
  166. package/packages/switch/index.js +5 -0
  167. package/packages/switch/src/main.vue +29 -0
  168. package/packages/tab/index.js +5 -0
  169. package/packages/tab/src/main.vue +16 -0
  170. package/packages/table/index.js +5 -0
  171. package/packages/table/src/main.vue +830 -0
  172. package/packages/table-column/index.js +5 -0
  173. package/packages/table-column/src/main.vue +742 -0
  174. package/packages/table-column/src/mixins/table.js +12 -0
  175. package/packages/tabs/index.js +5 -0
  176. package/packages/tabs/src/main.vue +34 -0
  177. package/packages/tag/index.js +5 -0
  178. package/packages/tag/src/main.vue +16 -0
  179. package/packages/theme-chalk/README.md +33 -0
  180. package/packages/theme-chalk/lib/action-sheet.css +0 -0
  181. package/packages/theme-chalk/lib/base.css +1 -0
  182. package/packages/theme-chalk/lib/button-group.css +1 -0
  183. package/packages/theme-chalk/lib/button.css +1 -0
  184. package/packages/theme-chalk/lib/calendar.css +1 -0
  185. package/packages/theme-chalk/lib/cascader.css +1 -0
  186. package/packages/theme-chalk/lib/cell.css +1 -0
  187. package/packages/theme-chalk/lib/checkbox.css +1 -0
  188. package/packages/theme-chalk/lib/circle.css +1 -0
  189. package/packages/theme-chalk/lib/count-down.css +0 -0
  190. package/packages/theme-chalk/lib/date.css +0 -0
  191. package/packages/theme-chalk/lib/empty.css +0 -0
  192. package/packages/theme-chalk/lib/field.css +1 -0
  193. package/packages/theme-chalk/lib/flow.css +1 -0
  194. package/packages/theme-chalk/lib/fonts/iconfont.scss +530 -0
  195. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  196. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  197. package/packages/theme-chalk/lib/form.css +0 -0
  198. package/packages/theme-chalk/lib/grid-item.css +1 -0
  199. package/packages/theme-chalk/lib/grid.css +0 -0
  200. package/packages/theme-chalk/lib/icon.css +1 -0
  201. package/packages/theme-chalk/lib/image-preview.css +0 -0
  202. package/packages/theme-chalk/lib/index.css +1 -0
  203. package/packages/theme-chalk/lib/list.css +0 -0
  204. package/packages/theme-chalk/lib/loading.css +0 -0
  205. package/packages/theme-chalk/lib/nav-bar.css +0 -0
  206. package/packages/theme-chalk/lib/navbar.css +1 -0
  207. package/packages/theme-chalk/lib/pagination.css +1 -0
  208. package/packages/theme-chalk/lib/picker.css +1 -0
  209. package/packages/theme-chalk/lib/popover.css +0 -0
  210. package/packages/theme-chalk/lib/popup.css +0 -0
  211. package/packages/theme-chalk/lib/radio.css +1 -0
  212. package/packages/theme-chalk/lib/rate.css +0 -0
  213. package/packages/theme-chalk/lib/search.css +0 -0
  214. package/packages/theme-chalk/lib/selector.css +1 -0
  215. package/packages/theme-chalk/lib/skeleton.css +0 -0
  216. package/packages/theme-chalk/lib/stepper.css +1 -0
  217. package/packages/theme-chalk/lib/switch.css +1 -0
  218. package/packages/theme-chalk/lib/tab.css +0 -0
  219. package/packages/theme-chalk/lib/table-column.css +0 -0
  220. package/packages/theme-chalk/lib/table.css +1 -0
  221. package/packages/theme-chalk/lib/tabs.css +1 -0
  222. package/packages/theme-chalk/lib/tag.css +1 -0
  223. package/packages/theme-chalk/lib/theme.css +0 -0
  224. package/packages/theme-chalk/lib/tree.css +1 -0
  225. package/packages/theme-chalk/lib/uploader.css +0 -0
  226. package/packages/theme-chalk/package.json +35 -0
  227. package/packages/theme-chalk/src/action-sheet.scss +0 -0
  228. package/packages/theme-chalk/src/base.scss +182 -0
  229. package/packages/theme-chalk/src/button-group.scss +26 -0
  230. package/packages/theme-chalk/src/button.scss +3 -0
  231. package/packages/theme-chalk/src/calendar.scss +12 -0
  232. package/packages/theme-chalk/src/cascader.scss +12 -0
  233. package/packages/theme-chalk/src/cell.scss +14 -0
  234. package/packages/theme-chalk/src/checkbox.scss +10 -0
  235. package/packages/theme-chalk/src/circle.scss +7 -0
  236. package/packages/theme-chalk/src/common/var.scss +1525 -0
  237. package/packages/theme-chalk/src/count-down.scss +0 -0
  238. package/packages/theme-chalk/src/date.scss +0 -0
  239. package/packages/theme-chalk/src/empty.scss +0 -0
  240. package/packages/theme-chalk/src/field.scss +28 -0
  241. package/packages/theme-chalk/src/flow.scss +542 -0
  242. package/packages/theme-chalk/src/fonts/iconfont.scss +530 -0
  243. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  244. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  245. package/packages/theme-chalk/src/form.scss +15 -0
  246. package/packages/theme-chalk/src/grid-item.scss +8 -0
  247. package/packages/theme-chalk/src/grid.scss +0 -0
  248. package/packages/theme-chalk/src/icon.scss +1661 -0
  249. package/packages/theme-chalk/src/image-preview.scss +0 -0
  250. package/packages/theme-chalk/src/index.scss +38 -0
  251. package/packages/theme-chalk/src/list.scss +0 -0
  252. package/packages/theme-chalk/src/loading.scss +0 -0
  253. package/packages/theme-chalk/src/mixins/color.scss +117 -0
  254. package/packages/theme-chalk/src/mixins/mixins.scss +25 -0
  255. package/packages/theme-chalk/src/nav-bar.scss +0 -0
  256. package/packages/theme-chalk/src/navbar.scss +6 -0
  257. package/packages/theme-chalk/src/pagination.scss +10 -0
  258. package/packages/theme-chalk/src/picker.scss +27 -0
  259. package/packages/theme-chalk/src/popover.scss +0 -0
  260. package/packages/theme-chalk/src/popup.scss +0 -0
  261. package/packages/theme-chalk/src/radio.scss +7 -0
  262. package/packages/theme-chalk/src/rate.scss +0 -0
  263. package/packages/theme-chalk/src/search.scss +0 -0
  264. package/packages/theme-chalk/src/selector.scss +218 -0
  265. package/packages/theme-chalk/src/skeleton.scss +0 -0
  266. package/packages/theme-chalk/src/stepper.scss +10 -0
  267. package/packages/theme-chalk/src/switch.scss +6 -0
  268. package/packages/theme-chalk/src/tab.scss +0 -0
  269. package/packages/theme-chalk/src/table-column.scss +0 -0
  270. package/packages/theme-chalk/src/table.scss +42 -0
  271. package/packages/theme-chalk/src/tabs.scss +21 -0
  272. package/packages/theme-chalk/src/tag.scss +13 -0
  273. package/packages/theme-chalk/src/theme.scss +2 -0
  274. package/packages/theme-chalk/src/tree.scss +115 -0
  275. package/packages/theme-chalk/src/uploader.scss +0 -0
  276. package/packages/uploader/index.js +5 -0
  277. package/packages/uploader/src/main.vue +31 -0
  278. package/src/config/api.js +29 -0
  279. package/src/index.js +130 -0
  280. package/src/utils/axios.js +198 -0
  281. package/src/utils/date-util.js +312 -0
  282. package/src/utils/http.js +66 -0
  283. package/src/utils/rules.js +18 -0
  284. package/src/utils/store.js +21 -0
  285. package/src/utils/util.js +1346 -0
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <van-count-down v-bind="$attrs" ref="countDown" v-on="$listeners">
3
+ <template v-if="$scopedSlots.default" slot="default" slot-scope="timeData">
4
+ <slot name="default" :timeData="timeData" />
5
+ </template>
6
+ </van-count-down>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'EmCountDown',
12
+ inheritAttrs: false,
13
+ methods: {
14
+ start() {
15
+ this.$refs.countDown.start();
16
+ },
17
+ pause() {
18
+ this.$refs.countDown.pause();
19
+ },
20
+ reset() {
21
+ this.$refs.countDown.reset();
22
+ }
23
+ }
24
+ };
25
+ </script>
26
+
27
+ <style></style>
@@ -0,0 +1,5 @@
1
+ import EmDate from './src/main';
2
+
3
+ EmDate.install = Vue => Vue.component(EmDate.name, EmDate);
4
+
5
+ export default EmDate;
@@ -0,0 +1,290 @@
1
+ <template>
2
+ <!-- 弹出层 -->
3
+ <!-- 时间选择 -->
4
+ <van-picker
5
+ ref="picker"
6
+ show-toolbar
7
+ title="请选择时间"
8
+ :columns="columns"
9
+ @change="onChange"
10
+ @cancel="cancelOn"
11
+ @confirm="onConfirm"
12
+ >
13
+ <template slot="title">{{ title }}</template>
14
+ </van-picker>
15
+ </template>
16
+ <script>
17
+ export default {
18
+ name: 'EmDateTime',
19
+ props: {
20
+ values: { type: [String, Object,Date] },
21
+ joinStr:{ type: String},
22
+ minDate:{ type: [String, Object,Date]},
23
+ maxDate:{ type: [String, Object,Date]},
24
+ title: { type: String, default: '请选择时间' }
25
+ },
26
+ data() {
27
+ return {
28
+ columns: [], //所有时间
29
+ Mdays: '', //弹窗关闭时月份所在值
30
+ Dindex: null
31
+ };
32
+ },
33
+ watch: {
34
+ isPicker(val) {
35
+ this.columns = [];
36
+ this.getcolumns();
37
+ },
38
+ values(val) {
39
+ if (val == '') {
40
+ this.Mdays = '';
41
+ this.Dindex = null;
42
+ }
43
+ }
44
+ },
45
+ mounted() {
46
+ this.columns = [];
47
+ this.getcolumns();
48
+ },
49
+ methods: {
50
+ getCountDays(year, month) {
51
+ //获取某年某月多少天
52
+ var day = new Date(year, month, 0);
53
+ return day.getDate();
54
+ },
55
+ getDateVal(date) {
56
+ var newY = date.getFullYear();
57
+ var newM = date.getMonth();
58
+ var newD = date.getDate();
59
+ var newh = date.getHours();
60
+ var newm = date.getMinutes();
61
+ var news = date.getSeconds();
62
+ return { newY, newM, newD, newh, newm, news };
63
+ },
64
+ getcolumns() {
65
+ const _that = this;
66
+ let newDate = this.values;
67
+ if (typeof this.values == 'string') {
68
+ newDate = newDate.replace('年', '/');
69
+ newDate = newDate.replace('月', '/');
70
+ newDate = newDate.replace('日', ' ');
71
+ newDate = newDate.replace('时', ':');
72
+ newDate = newDate.replace('分', ':');
73
+ newDate = newDate.replace('秒', '');
74
+ newDate = newDate.replace(/-/g, '/');
75
+ newDate = newDate.trim();
76
+ }
77
+ // var strtime = this.values;
78
+ var date = new Date(newDate);
79
+ var vmoduletime = date.getTime();
80
+ if (this.values != '') {
81
+ var vmoduledate = new Date(vmoduletime);
82
+ } else {
83
+ var vmoduledate = new Date(); //没有传入时间则默认当前时刻
84
+ }
85
+ var minY,
86
+ minM,
87
+ minD,
88
+ minh,
89
+ minm,
90
+ mins,
91
+ maxY,
92
+ maxM,
93
+ maxD,
94
+ maxh,
95
+ maxm,
96
+ maxs = '';
97
+ if (this.minDate) {
98
+ const { newY, newM, newD, newh, newm, news } = this.getDateVal(
99
+ this.minDate
100
+ );
101
+ minY = newY;
102
+ minM = newM;
103
+ minD = newD;
104
+ minh = newh;
105
+ minm = newm;
106
+ mins = news;
107
+ }
108
+ if (this.maxDate) {
109
+ const { newY, newM, newD, newh, newm, news } = this.getDateVal(
110
+ this.maxDate
111
+ );
112
+ maxY = newY;
113
+ maxM = newM;
114
+ maxD = newD;
115
+ maxh = newh;
116
+ maxm = newm;
117
+ maxs = news;
118
+ }
119
+
120
+ var Y = vmoduledate.getFullYear();
121
+ var M = vmoduledate.getMonth();
122
+ var D = vmoduledate.getDate();
123
+ var h = vmoduledate.getHours();
124
+ var m = vmoduledate.getMinutes();
125
+ var s = vmoduledate.getSeconds();
126
+ var year = {}; //获取前后十年数组
127
+ year.values = [];
128
+ var Currentday = new Date().getFullYear();
129
+ for (
130
+ var i = minY || Currentday - 10;
131
+ i < (maxY + 1 || Currentday + 10);
132
+ i++
133
+ ) {
134
+ year.values.push(i + (_that.joinStr ? '' : '年'));
135
+ }
136
+ year.defaultIndex = year.values.indexOf(Y + (_that.joinStr ? '' : '年')); //设置默认选项当前年
137
+ _that.columns.push(year);
138
+ var month = {}; //获取12月数组
139
+ month.defaultIndex = M;
140
+ month.values = Object.keys(Array.apply(null, { length: 13 })).map(
141
+ // function(item) {
142
+ // if (
143
+ // ((minM != undefined ? minM + Number(item) + 1 : '') ||
144
+ // Number(item) + 1) <
145
+ // (maxM + 1 <= 10 && maxM != undefined ? maxM+ 1 : 10)
146
+ // ) {
147
+ // return (
148
+ // '0' +
149
+ // (minM != undefined ? minM + Number(item) + 1 : Number(item) + 1) +
150
+ // (_that.joinStr ? '' : '月')
151
+ // );
152
+ // } else if (
153
+ // 10 <=
154
+ // ((minM != '' ? minM + Number(item) + 1 : '') ||
155
+ // Number(item) + 1) &&
156
+ // ((minM != '' ? minM + Number(item) + 1 : '') || Number(item) + 1) <
157
+ // ( maxM
158
+ // ? maxM + 2
159
+ // : 12)
160
+ // ) {
161
+ // return (
162
+ // (minM != undefined ? minM + Number(item) + 1 : Number(item) + 1) +
163
+ // (_that.joinStr ? '' : '月')
164
+ // );
165
+ // }
166
+ // // else {
167
+ // // return (+item + 0).toString() + (_that.joinStr ? '' : '月');
168
+ // // }
169
+ // }
170
+ function(item) {
171
+ if (Number(item) < 10) {
172
+ return '0' + Number(item) + (_that.joinStr ? '' : '月');
173
+ } else if (10 <= Number(item)&& Number(item) <= 12) {
174
+ return Number(item)+ (_that.joinStr ? '' : '月');
175
+ }
176
+ }
177
+ );
178
+ month.values.splice(0, 1);
179
+ month.values = month.values.filter(x => x != undefined);
180
+ this.columns.push(month);
181
+ //获取当月的天数
182
+ var days = this.getCountDays(Y, this.Mdays == '' ? M + 1 : this.Mdays);
183
+ var day = {}; //创建当月天数数组
184
+ day.defaultIndex = this.Dindex == null ? D - 1 : this.Dindex;
185
+ day.values = Object.keys(Array.apply(null, { length: days + 1 })).map(
186
+ function(item) {
187
+ if (+item + 1 <= 10) {
188
+ return '0' + item + (_that.joinStr ? '' : '日');
189
+ } else if (+item + 1 == 11) {
190
+ return +item + (_that.joinStr ? '' : '日');
191
+ } else {
192
+ return (+item + 0).toString() + (_that.joinStr ? '' : '日');
193
+ }
194
+ }
195
+ );
196
+ day.values.splice(0, 1);
197
+ this.columns.push(day);
198
+ var hour = {}; //创建小时数组
199
+ hour.defaultIndex = h;
200
+ hour.values = Object.keys(Array.apply(null, { length: 24 })).map(function(
201
+ item
202
+ ) {
203
+ if (+item + 1 <= 10) {
204
+ return '0' + item + (_that.joinStr ? '' : '时');
205
+ } else if (+item + 1 == 11) {
206
+ return +item + (_that.joinStr ? '' : '时');
207
+ } else {
208
+ return (+item + 0).toString() + (_that.joinStr ? '' : '时');
209
+ }
210
+ });
211
+ this.columns.push(hour);
212
+ var mi = {}; //创建分钟数组
213
+ mi.defaultIndex = m;
214
+ mi.values = Object.keys(Array.apply(null, { length: 60 })).map(function(
215
+ item
216
+ ) {
217
+ if (+item + 1 <= 10) {
218
+ return '0' + item + (_that.joinStr ? '' : '分');
219
+ } else if (+item + 1 == 11) {
220
+ return +item + (_that.joinStr ? '' : '分');
221
+ } else {
222
+ return (+item + 0).toString() + (_that.joinStr ? '' : '分');
223
+ }
224
+ });
225
+ this.columns.push(mi);
226
+ var ss = {}; //创建秒数数组
227
+ ss.defaultIndex = s;
228
+ ss.values = Object.keys(Array.apply(null, { length: 60 })).map(function(
229
+ item
230
+ ) {
231
+ if (+item + 1 <= 10) {
232
+ return '0' + item + (_that.joinStr ? '' : '秒');
233
+ } else if (+item + 1 == 11) {
234
+ return +item + (_that.joinStr ? '' : '秒');
235
+ } else {
236
+ return (+item + 0).toString() + (_that.joinStr ? '' : '秒');
237
+ }
238
+ });
239
+ this.columns.push(ss);
240
+ },
241
+ onChange(values, a) {
242
+ const _that = this;
243
+ //a为所有列备选项值的数组
244
+ var days = this.getCountDays(a[0].substr(0, 4), a[1].substr(0, 2));
245
+ var newdays = {};
246
+ newdays.values = Object.keys(Array.apply(null, { length: days + 1 })).map(
247
+ function(item) {
248
+ if (+item + 1 <= 10) {
249
+ return '0' + item + (_that.joinStr ? '' : '日');
250
+ } else if (+item + 1 == 11) {
251
+ return +item + (_that.joinStr ? '' : '日');
252
+ } else {
253
+ return (+item + 0).toString() + (_that.joinStr ? '' : '日');
254
+ }
255
+ }
256
+ );
257
+ newdays.values.splice(0, 1);
258
+ this.$refs.picker.setColumnValues(2, newdays.values); //设置第三列的值
259
+ this.$refs.picker.setColumnIndex(2, a[2].substr(0, 2) - 1); //设置第三列索引
260
+ },
261
+ // 关闭弹框
262
+ confirmOn() {
263
+ var currentM = this.$refs.picker.getColumnValue(1);
264
+ this.Mdays = currentM.substr(0, 2);
265
+ this.Dindex = this.$refs.picker.getColumnIndex(2);
266
+ },
267
+ //时间选择器关闭
268
+ cancelOn() {
269
+ this.$emit('cancel');
270
+ },
271
+ // 时间选择器确定
272
+ onConfirm(val, index) {
273
+ var endval =
274
+ val[0].substr(0, 4) +
275
+ (this.joinStr || '年') +
276
+ val[1].substr(0, 2) +
277
+ (this.joinStr || '月') +
278
+ val[2].substr(0, 2) +
279
+ (this.joinStr ? ' ' : '日 ') +
280
+ val[3].substr(0, 2) +
281
+ (this.joinStr ? ':' : '时') +
282
+ val[4].substr(0, 2) +
283
+ (this.joinStr ? ':' : '分') +
284
+ val[5].substr(0, 2) +
285
+ (this.joinStr ? '' : '秒');
286
+ this.$emit('confirm', endval);
287
+ }
288
+ }
289
+ };
290
+ </script>
@@ -0,0 +1,319 @@
1
+ <template>
2
+ <div class="em-date">
3
+ <em-input
4
+ readonly
5
+ clickable
6
+ v-bind="$attrs"
7
+ :label="label"
8
+ :value="pickerValue"
9
+ :label-align="labelAlign"
10
+ :input-align="inputAlign"
11
+ :label-width="labelWidth"
12
+ :center="center"
13
+ :required="required"
14
+ :hideLabel="hideLabel"
15
+ :disabled="disabled"
16
+ :placeholder="disabled ? '暂无数据' : placeholder || `请选择${label}`"
17
+ @click="handlePicker"
18
+ />
19
+ <van-popup v-model="showPicker" round @close="onCancel" position="bottom">
20
+ <EmDateTime
21
+ v-if="type == 'datetimeSecond'"
22
+ :values="value"
23
+ :joinStr="joinStr"
24
+ :title="label"
25
+ :min-date="$attrs['min-date']"
26
+ :max-date="$attrs['max-date']"
27
+ @confirm="onConfirm"
28
+ @cancel="() => (showPicker = false)"
29
+ />
30
+ <van-datetime-picker
31
+ v-else
32
+ show-toolbar
33
+ v-model="newValue"
34
+ :loading="newLoading"
35
+ :type="type"
36
+ v-bind="$attrs"
37
+ v-on="$listeners"
38
+ @cancel="onCancel"
39
+ @confirm="onConfirm"
40
+ >
41
+ <template v-for="(index, name) in $slots" :slot="name">
42
+ <slot :name="name" />
43
+ </template>
44
+ </van-datetime-picker>
45
+ </van-popup>
46
+ </div>
47
+ </template>
48
+
49
+ <script>
50
+ import EmDateTime from './date-time.vue';
51
+ export default {
52
+ name: 'EmDate',
53
+ components: { EmDateTime },
54
+ inheritAttrs: false,
55
+ data() {
56
+ return {
57
+ showPicker: false,
58
+ newLoading: false,
59
+ changeValue: true,
60
+ newValueKey: '',
61
+ newValue: '',
62
+ lastValue: '',
63
+ dateValues: '',
64
+ newColumns: [],
65
+ newDefaultIndex: 0,
66
+ isOnConfirm: false,
67
+ count: 0,
68
+ pickerValue: ''
69
+ };
70
+ },
71
+ props: {
72
+ disabled: {
73
+ type: Boolean,
74
+ default: false
75
+ },
76
+ required: {
77
+ type: Boolean,
78
+ default: false
79
+ },
80
+ hideLabel:{
81
+ type:Boolean,
82
+ default: false
83
+ },
84
+ // 绑定值
85
+ value: {
86
+ type: [String, Array, Object, Date],
87
+ default: ''
88
+ },
89
+ // 展示标题
90
+ label: {
91
+ type: String,
92
+ default: '日期选择'
93
+ },
94
+ // 输入框占位提示文字
95
+ placeholder: {
96
+ type: String,
97
+ default: ''
98
+ },
99
+ // 多级选择展示拼接字符
100
+ joinStr: {
101
+ type: String,
102
+ default: undefined
103
+ },
104
+
105
+ loading: {
106
+ type: Boolean,
107
+ default: false
108
+ },
109
+ //左侧文本宽度
110
+ labelWidth: {
111
+ type: String
112
+ },
113
+ // 左侧文本对齐方式
114
+ labelAlign: {
115
+ type: String
116
+ },
117
+ // 右侧内容对齐方式
118
+ inputAlign: {
119
+ type: String
120
+ },
121
+ // 是否使内容垂直居中
122
+ center: {
123
+ type: Boolean
124
+ },
125
+ type:{
126
+ type:String,
127
+ default:'datetime'
128
+ }
129
+ },
130
+
131
+ watch: {
132
+ loading: {
133
+ handler(val) {
134
+ this.newLoading = val;
135
+ },
136
+ deep: true,
137
+ immediate: true
138
+ },
139
+ value: {
140
+ handler() {
141
+ this.changeValue && this.getValFun();
142
+ },
143
+ deep: true,
144
+ immediate: true
145
+ }
146
+ },
147
+
148
+ mounted() {
149
+ console.log(this.value,'asddd')
150
+ this.lastValue = this.value;
151
+ },
152
+ methods: {
153
+ getValFun(val) {
154
+ const _that = this;
155
+ if (_that.isOnConfirm) return;
156
+ if (!val) {
157
+ if (
158
+ (_that.value != undefined && _that.value) ||
159
+ (_that.value == undefined && _that.value)
160
+ ) {
161
+ console.log(1)
162
+ _that.pickerValue = _that.getValue(_that.value);
163
+ } else {
164
+ console.log(2)
165
+ _that.pickerValue = _that.value;
166
+ }
167
+ } else {
168
+ console.log(3)
169
+ _that.pickerValue = _that.getValue(_that.val);
170
+ }
171
+
172
+ const { type } = _that;
173
+ if (type === 'time') {
174
+ _that.newValue = _that.value != undefined ? _that.value : _that.value;
175
+ return;
176
+ }
177
+ // if(_that.count == 0 || _that.value != undefined) {
178
+ // _that.count++
179
+ let date = _that.value;
180
+ if (typeof date == 'string') {
181
+ if (type != 'year') {
182
+ date = date.replace('年', '/');
183
+ } else {
184
+ date = date.replace('年', '');
185
+ }
186
+ if (type == 'year-month') {
187
+ date = date.replace('月', '');
188
+ } else {
189
+ date = date.replace('月', '/');
190
+ }
191
+ date = date.replace('日', ' ');
192
+ date = date.replace('时', ':');
193
+ date = date.replace('分', ':');
194
+ date = date.replace('秒', '');
195
+
196
+ // date = date.replace(/-/g, '/');
197
+ date = date.trim();
198
+ }
199
+ _that.isOnConfirm = false;
200
+ _that.newValue =
201
+ date != undefined && date
202
+ ? new Date(date || '')
203
+ : date == undefined && _that.value
204
+ ? new Date(_that.value || '')
205
+ : new Date();
206
+ // }
207
+ },
208
+ onCancel() {
209
+ this.$emit('input', this.lastValue);
210
+ this.getValFun(this.lastValue);
211
+ this.showPicker = false;
212
+ },
213
+ onConfirm(value) {
214
+ this.showPicker = false;
215
+ this.pickerValue = this.getValue(value);
216
+ this.isOnConfirm = true;
217
+ this.lastValue = value;
218
+ this.changeValue = false;
219
+ console.log(this.pickerValue,'this.pickerValue')
220
+ console.log(this.value,'this.value')
221
+ this.$emit('input', this.pickerValue);
222
+ if (this.type === 'datetimeSecond') this.$emit('confirm');
223
+ },
224
+ getValue(val) {
225
+ const { type } = this;
226
+ let value = '';
227
+ if (!this.value && !val && this.value == undefined) return;
228
+ console.log(val,'1-1')
229
+ if ((val&& typeof val == 'string')) {
230
+ return val;
231
+ }
232
+ console.log('1-2')
233
+ if ((this.value&& typeof this.value == 'string')) {
234
+ return this.value;
235
+ }
236
+ let newValue =new Date(val || this.value) ;
237
+
238
+ if (typeof newValue == 'string') {
239
+ newValue = newValue.replace('年', '/');
240
+ newValue = newValue.replace('月', '/');
241
+ newValue = newValue.replace('日', ' ');
242
+ newValue = newValue.replace('时', ':');
243
+ newValue = newValue.replace('分', ':');
244
+ newValue = newValue.replace('秒', '');
245
+ newValue = newValue.replace(/-/g, '/');
246
+ newValue = newValue.trim();
247
+ }
248
+ let date = new Date(newValue);
249
+ let y = date.getFullYear();
250
+ let m =
251
+ date.getMonth() + 1 < 10
252
+ ? '0' + (date.getMonth() + 1)
253
+ : date.getMonth() + 1;
254
+ let d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
255
+ let h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
256
+ let minute =
257
+ date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
258
+ let s =
259
+ date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
260
+ if (type == 'date' && newValue != 'Invalid Date') {
261
+ value =
262
+ y +
263
+ (this.joinStr || '年') +
264
+ m +
265
+ (this.joinStr || '月') +
266
+ d +
267
+ (this.joinStr ? ' ' : '日 ');
268
+ } else if (type === 'year-month' && newValue != 'Invalid Date') {
269
+ value = y + (this.joinStr || '年') + m + (this.joinStr ? ' ' : '月');
270
+ } else if (type === 'month-day' && newValue != 'Invalid Date') {
271
+ value = m + (this.joinStr || '月') + d + (this.joinStr ? ' ' : '日');
272
+ } else if (type === 'time' && newValue.split(':').length >= 2) {
273
+ let time = [newValue.split(':')[0], newValue.split(':')[1]];
274
+ value = this.joinStr
275
+ ? time.join(':')
276
+ : time.join(':').replace(':', '时') + '分';
277
+ } else if (
278
+ (type === 'datetime' || type === 'datetimeSecond') &&
279
+ newValue != 'Invalid Date'
280
+ ) {
281
+ value =
282
+ y +
283
+ (this.joinStr || '年') +
284
+ m +
285
+ (this.joinStr || '月') +
286
+ d +
287
+ (this.joinStr ? ' ' : '日 ') +
288
+ h +
289
+ (this.joinStr ? ':' : '时') +
290
+ minute +
291
+ (this.joinStr ? (type === 'datetimeSecond' ? ':' : '') : '分') +
292
+ (type === 'datetimeSecond' ? s + (this.joinStr ? '' : '秒') : '');
293
+ } else if (type === 'datehour' && newValue != 'Invalid Date') {
294
+ value =
295
+ y +
296
+ (this.joinStr || '年') +
297
+ m +
298
+ (this.joinStr || '月') +
299
+ d +
300
+ (this.joinStr ? ' ' : '日 ') +
301
+ h +
302
+ (this.joinStr ? ' ' : '时');
303
+ } else if (type === 'year' && newValue != 'Invalid Date') {
304
+ value = y + (this.joinStr ? '' : '年');
305
+ }
306
+ return value;
307
+ },
308
+
309
+ handlePicker() {
310
+ if (this.disabled) return;
311
+ this.showPicker = true;
312
+
313
+ this.$emit('showPicker');
314
+ }
315
+ }
316
+ };
317
+ </script>
318
+
319
+ <style></style>
@@ -0,0 +1,5 @@
1
+ import EmEmpty from './src/main';
2
+
3
+ EmEmpty.install = Vue => Vue.component(EmEmpty.name, EmEmpty);
4
+
5
+ export default EmEmpty;
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <van-empty v-bind="$attrs" v-on="$listeners">
3
+ <template v-for="(index, name) in $slots" :slot="name">
4
+ <slot :name="name" />
5
+ </template>
6
+ </van-empty>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'EmEmpty',
12
+ inheritAttrs: false
13
+ };
14
+ </script>
15
+
16
+ <style></style>
@@ -0,0 +1,5 @@
1
+ import EmInput from './src/main';
2
+
3
+ EmInput.install = Vue => Vue.component(EmInput.name, EmInput);
4
+
5
+ export default EmInput;