@@ -24,24 +24,24 @@ export default {
24
24
let locale = getLocale (this .locale )
25
25
26
26
return [
27
- {id: ' minute' , items: locale .minuteItems , rank : 0 },
28
- {id: ' hour' , items: locale .hourItems , rank : 1 },
29
- {id: ' day' , items: locale .dayItems , rank : 2 },
30
- {id: ' month' , items: locale .monthItems , rank : 4 },
31
- {id: ' dayOfWeek' , items: locale .dayOfWeekItems , rank : 3 },
27
+ {id: ' minute' , items: locale .minuteItems },
28
+ {id: ' hour' , items: locale .hourItems },
29
+ {id: ' day' , items: locale .dayItems },
30
+ {id: ' month' , items: locale .monthItems },
31
+ {id: ' dayOfWeek' , items: locale .dayOfWeekItems },
32
32
]
33
33
}
34
34
},
35
- ranks : {
35
+ periods : {
36
36
type: Array ,
37
37
default : () => {
38
38
return [
39
- { text: ' Minute' , value: - 1 },
40
- { text: ' Hour' , value: 0 },
41
- { text: ' Day' , value: 1 },
42
- { text: ' Week' , value: 2 },
43
- { text: ' Month' , value: 3 },
44
- { text: ' Year' , value: 4 },
39
+ { text: ' Minute' , value: [] },
40
+ { text: ' Hour' , value: [ ' minute ' ] },
41
+ { text: ' Day' , value: [ ' hour ' , ' minute ' ] },
42
+ { text: ' Week' , value: [ ' day ' , ' hour ' , ' minute ' ] },
43
+ { text: ' Month' , value: [ ' dayOfWeek ' , ' day ' , ' hour ' , ' minute ' ] },
44
+ { text: ' Year' , value: [ ' month ' , ' dayOfWeek ' , ' day ' , ' hour ' , ' minute ' ] },
45
45
]
46
46
}
47
47
}
@@ -56,7 +56,7 @@ export default {
56
56
return {
57
57
selected: selected,
58
58
error: ' ' ,
59
- selectedRank : this .ranks [this .ranks .length - 1 ].value
59
+ selectedPeriod : this .periods [this .periods .length - 1 ].value
60
60
}
61
61
},
62
62
@@ -71,7 +71,13 @@ export default {
71
71
}, {})
72
72
},
73
73
computedFields (){
74
- return this .fields .map ((f ) => new Field (f .id , f .items , f .rank ))
74
+ return this .fields .map ((f ) => new Field (f .id , f .items ))
75
+ },
76
+ filteredFields (){
77
+ return this .selectedPeriod .map ((fieldId ) => {
78
+ let i = this .fieldIndex [fieldId]
79
+ return this .computedFields [i]
80
+ })
75
81
}
76
82
},
77
83
@@ -88,7 +94,7 @@ export default {
88
94
},
89
95
deep: true
90
96
},
91
- selectedRank : {
97
+ selectedPeriod : {
92
98
handler : function (){
93
99
this .selectedToCron (this .selected )
94
100
},
@@ -102,7 +108,7 @@ export default {
102
108
}
103
109
104
110
let fieldProps = []
105
- for (let field of this .computedFields ){
111
+ for (let field of this .filteredFields ){
106
112
let i = this .fieldIndex [field .id ]
107
113
let values = this .selected [field .id ]
108
114
@@ -129,16 +135,16 @@ export default {
129
135
error: this .error ,
130
136
fields: fieldProps,
131
137
132
- rankAttrs : {
133
- value: this .selectedRank
138
+ periodAttrs : {
139
+ value: this .selectedPeriod
134
140
},
135
- rankEvents : {
141
+ periodEvents : {
136
142
input : (evt ) => {
137
- this .selectedRank = evt
143
+ this .selectedPeriod = evt
138
144
}
139
145
},
140
- rankData : {
141
- items: this .ranks
146
+ periodData : {
147
+ items: this .periods
142
148
},
143
149
})
144
150
},
@@ -160,7 +166,7 @@ export default {
160
166
161
167
for (var i = 0 ; i < this .splitValue .length ; i++ ){
162
168
let field = this .computedFields [i]
163
- if (field . rank > this .selectedRank ){
169
+ if (! this .selectedPeriod . includes ( field . id ) ){
164
170
continue
165
171
}
166
172
@@ -178,7 +184,7 @@ export default {
178
184
179
185
let strings = []
180
186
for (let field of this .computedFields ){
181
- if (field . rank > this .selectedRank ){
187
+ if (! this .selectedPeriod . includes ( field . id ) ){
182
188
strings .push (' *' )
183
189
continue
184
190
}
0 commit comments