eoss-mobiles 0.3.98 → 0.3.99

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 (204) hide show
  1. package/lib/eoss-mobile.common.js +263 -123
  2. package/lib/flow.js +223 -83
  3. package/lib/index.js +1 -1
  4. package/lib/picker.js +6 -6
  5. package/lib/radio.js +5 -5
  6. package/lib/selector.js +28 -28
  7. package/lib/theme-chalk/fonts/iconfont.scss +98 -98
  8. package/lib/theme-chalk/fonts/iconfont1.scss +90 -90
  9. package/package.json +1 -1
  10. package/packages/action-sheet/index.js +5 -5
  11. package/packages/action-sheet/src/main.vue +32 -32
  12. package/packages/button/index.js +5 -5
  13. package/packages/button/src/main.vue +15 -15
  14. package/packages/button-group/index.js +5 -5
  15. package/packages/button-group/src/main.vue +80 -80
  16. package/packages/calendar/index.js +5 -5
  17. package/packages/calendar/src/main.vue +34 -34
  18. package/packages/cascader/index.js +5 -5
  19. package/packages/cascader/src/main.vue +39 -39
  20. package/packages/cell/index.js +5 -5
  21. package/packages/cell/src/main.vue +77 -77
  22. package/packages/checkbox/index.js +5 -5
  23. package/packages/checkbox/src/main.vue +232 -232
  24. package/packages/circle/index.js +5 -5
  25. package/packages/circle/src/main.vue +27 -27
  26. package/packages/count-down/index.js +5 -5
  27. package/packages/count-down/src/main.vue +27 -27
  28. package/packages/date/index.js +5 -5
  29. package/packages/date/src/date-time.vue +290 -290
  30. package/packages/date/src/main.vue +401 -401
  31. package/packages/empty/index.js +5 -5
  32. package/packages/empty/src/main.vue +16 -16
  33. package/packages/esign/index.js +5 -5
  34. package/packages/esign/src/main.vue +144 -144
  35. package/packages/field/index.js +5 -5
  36. package/packages/flow/index.js +5 -5
  37. package/packages/flow/src/components/Circulate.vue +595 -595
  38. package/packages/flow/src/components/Handle.vue +2404 -2404
  39. package/packages/flow/src/components/Message.vue +208 -208
  40. package/packages/flow/src/components/ProcessSettings.vue +342 -342
  41. package/packages/flow/src/components/TaskRead.vue +100 -4
  42. package/packages/flow/src/components/supervise.vue +139 -139
  43. package/packages/flow/src/flowMix.js +288 -288
  44. package/packages/flow/src/main.vue +116 -116
  45. package/packages/flow-btn/index.js +5 -5
  46. package/packages/flow-btn/src/main.vue +494 -494
  47. package/packages/flow-list/index.js +5 -5
  48. package/packages/flow-list/src/main.vue +248 -248
  49. package/packages/form/index.js +5 -5
  50. package/packages/grid/index.js +5 -5
  51. package/packages/grid/src/main.vue +486 -486
  52. package/packages/grid-item/index.js +5 -5
  53. package/packages/grid-item/src/main.vue +16 -16
  54. package/packages/image/index.js +5 -5
  55. package/packages/image/src/main.vue +12 -12
  56. package/packages/image-preview/index.js +5 -5
  57. package/packages/list/index.js +5 -5
  58. package/packages/list/src/main.vue +32 -32
  59. package/packages/loading/index.js +5 -5
  60. package/packages/loading/src/main.vue +19 -19
  61. package/packages/nav-bar/index.js +5 -5
  62. package/packages/nav-bar/src/main.vue +24 -24
  63. package/packages/notice-bar/index.js +5 -5
  64. package/packages/notice-bar/src/main.vue +15 -15
  65. package/packages/pagination/index.js +5 -5
  66. package/packages/pagination/src/main.vue +73 -73
  67. package/packages/picker/index.js +5 -5
  68. package/packages/picker/src/main.vue +604 -604
  69. package/packages/popover/index.js +5 -5
  70. package/packages/popover/src/main.vue +32 -32
  71. package/packages/popup/index.js +5 -5
  72. package/packages/popup/src/main.vue +27 -27
  73. package/packages/pull-refresh/index.js +5 -5
  74. package/packages/pull-refresh/src/main.vue +31 -31
  75. package/packages/radio/index.js +5 -5
  76. package/packages/radio/src/main.vue +179 -179
  77. package/packages/rate/index.js +5 -5
  78. package/packages/rate/src/main.vue +26 -26
  79. package/packages/retrial-auth/index.js +5 -5
  80. package/packages/retrial-auth/src/main.vue +257 -257
  81. package/packages/search/index.js +5 -5
  82. package/packages/search/src/main.vue +39 -39
  83. package/packages/selector/index.js +5 -5
  84. package/packages/selector/src/main.vue +186 -186
  85. package/packages/selector/src/selector-tree.vue +1117 -1117
  86. package/packages/selector/src/tree.vue +405 -405
  87. package/packages/skeleton/index.js +5 -5
  88. package/packages/skeleton/src/main.vue +17 -17
  89. package/packages/stepper/index.js +5 -5
  90. package/packages/stepper/src/main.vue +25 -25
  91. package/packages/swipe/index.js +5 -5
  92. package/packages/swipe/src/main.vue +42 -42
  93. package/packages/switch/index.js +5 -5
  94. package/packages/switch/src/main.vue +38 -38
  95. package/packages/tab/index.js +5 -5
  96. package/packages/tab/src/main.vue +16 -16
  97. package/packages/table/index.js +5 -5
  98. package/packages/table/src/main.vue +1006 -1006
  99. package/packages/table-column/index.js +5 -5
  100. package/packages/table-column/src/main.vue +931 -931
  101. package/packages/table-column/src/mixins/table.js +12 -12
  102. package/packages/tabs/index.js +5 -5
  103. package/packages/tabs/src/main.vue +34 -34
  104. package/packages/tag/index.js +5 -5
  105. package/packages/tag/src/main.vue +16 -16
  106. package/packages/theme-chalk/gulpfile.js +25 -0
  107. package/packages/theme-chalk/src/base.scss +195 -195
  108. package/packages/theme-chalk/src/button-group.scss +25 -25
  109. package/packages/theme-chalk/src/button.scss +2 -2
  110. package/packages/theme-chalk/src/calendar.scss +11 -11
  111. package/packages/theme-chalk/src/cascader.scss +11 -11
  112. package/packages/theme-chalk/src/cell.scss +14 -14
  113. package/packages/theme-chalk/src/checkbox.scss +9 -9
  114. package/packages/theme-chalk/src/circle.scss +6 -6
  115. package/packages/theme-chalk/src/common/var.scss +1525 -1525
  116. package/packages/theme-chalk/src/esign.scss +51 -51
  117. package/packages/theme-chalk/src/field.scss +98 -98
  118. package/packages/theme-chalk/src/flow-btn.scss +99 -99
  119. package/packages/theme-chalk/src/flow-list.scss +122 -122
  120. package/packages/theme-chalk/src/fonts/iconfont.scss +98 -98
  121. package/packages/theme-chalk/src/fonts/iconfont1.scss +90 -90
  122. package/packages/theme-chalk/src/form.scss +33 -33
  123. package/packages/theme-chalk/src/grid-item.scss +16 -16
  124. package/packages/theme-chalk/src/grid.scss +46 -46
  125. package/packages/theme-chalk/src/icon.scss +1661 -1661
  126. package/packages/theme-chalk/src/mixins/color.scss +117 -117
  127. package/packages/theme-chalk/src/navbar.scss +5 -5
  128. package/packages/theme-chalk/src/pagination.scss +12 -12
  129. package/packages/theme-chalk/src/picker.scss +31 -31
  130. package/packages/theme-chalk/src/radio.scss +6 -6
  131. package/packages/theme-chalk/src/retrial-auth.scss +28 -28
  132. package/packages/theme-chalk/src/selector.scss +247 -247
  133. package/packages/theme-chalk/src/stepper.scss +9 -9
  134. package/packages/theme-chalk/src/switch.scss +5 -5
  135. package/packages/theme-chalk/src/table.scss +86 -86
  136. package/packages/theme-chalk/src/tabs.scss +31 -31
  137. package/packages/theme-chalk/src/tag.scss +12 -12
  138. package/packages/theme-chalk/src/theme.scss +1 -1
  139. package/packages/theme-chalk/src/tree.scss +127 -127
  140. package/packages/uploader/index.js +5 -5
  141. package/src/config/api.js +190 -190
  142. package/src/index.js +1 -1
  143. package/src/utils/axios.js +217 -217
  144. package/src/utils/date-util.js +312 -312
  145. package/src/utils/http.js +106 -106
  146. package/src/utils/rules.js +18 -18
  147. package/src/utils/store.js +21 -21
  148. package/CHANGELOG.md +0 -95
  149. package/packages/theme-chalk/lib/action-sheet.css +0 -0
  150. package/packages/theme-chalk/lib/base.css +0 -1
  151. package/packages/theme-chalk/lib/button-group.css +0 -1
  152. package/packages/theme-chalk/lib/button.css +0 -1
  153. package/packages/theme-chalk/lib/calendar.css +0 -1
  154. package/packages/theme-chalk/lib/cascader.css +0 -1
  155. package/packages/theme-chalk/lib/cell.css +0 -1
  156. package/packages/theme-chalk/lib/checkbox.css +0 -1
  157. package/packages/theme-chalk/lib/circle.css +0 -1
  158. package/packages/theme-chalk/lib/count-down.css +0 -0
  159. package/packages/theme-chalk/lib/date.css +0 -0
  160. package/packages/theme-chalk/lib/empty.css +0 -0
  161. package/packages/theme-chalk/lib/esign.css +0 -1
  162. package/packages/theme-chalk/lib/field.css +0 -1
  163. package/packages/theme-chalk/lib/flow-btn.css +0 -1
  164. package/packages/theme-chalk/lib/flow-list-task-read.css +0 -1
  165. package/packages/theme-chalk/lib/flow-list.css +0 -1
  166. package/packages/theme-chalk/lib/flow.css +0 -1
  167. package/packages/theme-chalk/lib/fonts/iconfont.scss +0 -98
  168. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  169. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  170. package/packages/theme-chalk/lib/fonts/iconfont1.scss +0 -90
  171. package/packages/theme-chalk/lib/form.css +0 -1
  172. package/packages/theme-chalk/lib/grid-item.css +0 -1
  173. package/packages/theme-chalk/lib/grid.css +0 -1
  174. package/packages/theme-chalk/lib/icon.css +0 -1
  175. package/packages/theme-chalk/lib/image-preview.css +0 -0
  176. package/packages/theme-chalk/lib/image.css +0 -0
  177. package/packages/theme-chalk/lib/index.css +0 -1
  178. package/packages/theme-chalk/lib/list.css +0 -0
  179. package/packages/theme-chalk/lib/loading.css +0 -0
  180. package/packages/theme-chalk/lib/nav-bar.css +0 -0
  181. package/packages/theme-chalk/lib/navbar.css +0 -1
  182. package/packages/theme-chalk/lib/notice-bar.css +0 -0
  183. package/packages/theme-chalk/lib/pagination.css +0 -1
  184. package/packages/theme-chalk/lib/picker.css +0 -1
  185. package/packages/theme-chalk/lib/popover.css +0 -0
  186. package/packages/theme-chalk/lib/popup.css +0 -0
  187. package/packages/theme-chalk/lib/pull-refresh.css +0 -0
  188. package/packages/theme-chalk/lib/radio.css +0 -1
  189. package/packages/theme-chalk/lib/rate.css +0 -0
  190. package/packages/theme-chalk/lib/retrial-auth.css +0 -1
  191. package/packages/theme-chalk/lib/search.css +0 -0
  192. package/packages/theme-chalk/lib/selector.css +0 -1
  193. package/packages/theme-chalk/lib/skeleton.css +0 -0
  194. package/packages/theme-chalk/lib/stepper.css +0 -1
  195. package/packages/theme-chalk/lib/swipe.css +0 -0
  196. package/packages/theme-chalk/lib/switch.css +0 -1
  197. package/packages/theme-chalk/lib/tab.css +0 -0
  198. package/packages/theme-chalk/lib/table-column.css +0 -0
  199. package/packages/theme-chalk/lib/table.css +0 -1
  200. package/packages/theme-chalk/lib/tabs.css +0 -1
  201. package/packages/theme-chalk/lib/tag.css +0 -1
  202. package/packages/theme-chalk/lib/theme.css +0 -0
  203. package/packages/theme-chalk/lib/tree.css +0 -1
  204. package/packages/theme-chalk/lib/uploader.css +0 -0
@@ -1,290 +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>
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>