2
2
* @Author : chaoxiaoshu-mx leukotrichia@163 .com
3
3
* @Date : 2023-02-02 08:39 :13
4
4
* @LastEditors : chaoxiaoshu-mx leukotrichia@163 .com
5
- * @LastEditTime : 2023-03-29 15: 42 : 30
5
+ * @LastEditTime : 2023-04-06 10: 48 : 08
6
6
* @FilePath : \ThingsPanel-Backend-Vue\src\view\pages\automation\components\time\WeeklySelector.vue
7
7
* @Description : 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com /OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
8
8
-->
12
12
<el-option v-for="(week, index) in weekOptions" :key="index" :label="week.label" :value="week.value"></el-option>
13
13
</el-select>
14
14
15
- <el-time-picker ref="timeRef" v-if="weekValue!=''" value-format="HH:mm"
16
- v-model="timeValue" :placeholder="$t('AUTOMATION.PLACEHOLDER.SELECT_TIME')" @change="handleChange"></el-time-picker>
15
+ <el-time-picker ref="timeRef" v-if="weekValue!=''" value-format="HH:mm" v-model="timeValue"
16
+ :placeholder="$t('AUTOMATION.PLACEHOLDER.SELECT_TIME')" @change="handleChange"></el-time-picker>
17
17
</div>
18
18
</template>
19
19
20
20
<script>
21
21
import { message_error } from '@/utils/helpers';
22
+ import { Week } from "../../control/Const";
22
23
export default {
23
24
name: "WeeklySelector",
24
25
props: {
@@ -32,24 +33,25 @@ export default {
32
33
data() {
33
34
return {
34
35
weekValue: "",
36
+ timeValue: "",
35
37
weekOptions: [
36
- { label: this.$t('AUTOMATION.WEEK.MONDAY'), value: 1 },
37
- { label: this.$t('AUTOMATION.WEEK.TUESDAY'), value: 2 },
38
- { label: this.$t('AUTOMATION.WEEK.WEDNESDAY'), value: 3 },
39
- { label: this.$t('AUTOMATION.WEEK.THURSDAY'), value: 4 },
40
- { label: this.$t('AUTOMATION.WEEK.FRIDAY'), value: 5 },
41
- { label: this.$t('AUTOMATION.WEEK.SATURDAY'), value: 6 },
42
- { label: this.$t('AUTOMATION.WEEK.SUDNAY'), value: 7 }
43
- ],
44
- timeValue: ""
38
+ { label: this.$t('AUTOMATION.WEEK.MONDAY'), value: Week.MONDAY },
39
+ { label: this.$t('AUTOMATION.WEEK.TUESDAY'), value: Week.THURSDAY },
40
+ { label: this.$t('AUTOMATION.WEEK.WEDNESDAY'), value: Week.WEDNESDAY },
41
+ { label: this.$t('AUTOMATION.WEEK.THURSDAY'), value: Week.THURSDAY },
42
+ { label: this.$t('AUTOMATION.WEEK.FRIDAY'), value: Week.FRIDAY },
43
+ { label: this.$t('AUTOMATION.WEEK.SATURDAY'), value: Week.SATURDAY },
44
+ { label: this.$t('AUTOMATION.WEEK.SUDNAY'), value: Week.SUNDAY }
45
+ ]
45
46
}
46
47
},
47
48
watch: {
48
49
data: {
49
50
handler(newValue) {
50
- if (newValue) {
51
+ if (newValue && newValue.week && newValue.time ) {
51
52
console.log("RepeatTimeSelector", newValue);
52
- this.formData = JSON.parse(JSON.stringify(newValue));
53
+ this.weekValue = Number(newValue.week);
54
+ this.timeValue = newValue.time;
53
55
}
54
56
},
55
57
immediate: true
0 commit comments