feat: 分时段登录组件增加全选功能

This commit is contained in:
“怀磊”
2021-10-27 14:43:45 +08:00
committed by 老广
parent b13e5995c9
commit 233aaaa82b
3 changed files with 15 additions and 2 deletions

View File

@@ -2,7 +2,6 @@
<div class="c-weektime">
<div class="c-schedue" />
<div :class="{'c-schedue': true, 'c-schedue-notransi': mode}" :style="styleValue" />
<table class="c-weektime-table" :class="{'c-min-table': colspan < 2}">
<thead class="c-weektime-head">
<tr>
@@ -34,6 +33,7 @@
<div class="g-clearfix c-weektime-con">
<span class="g-pull-left">{{ this.$t('common.WeekCronSelect.CanDragSelect') }}</span>
<a class="g-pull-right" @click.prevent="clearWeektime">{{ this.$t('common.WeekCronSelect.ClearSelection') }}</a>
<a class="g-pull-right g-pull-margin" @click.prevent="selectAll">{{ this.$t('common.WeekCronSelect.SelectAll') }}</a>
</div>
</td>
</tr>
@@ -221,6 +221,15 @@ export default {
this.timeRange = []
this.$emit('change', this.timeRange)
},
// 全选
selectAll() {
this.weektimeData.forEach(item => {
item.child.forEach(t => {
this.$set(t, 'check', true)
})
})
this.setTimeRange()
},
setTimeRange() {
this.timeRange = this.weektimeData.map(item => {
return {
@@ -301,7 +310,6 @@ export default {
}
</script>
<style lang="scss" scoped>
.c-weektime {
min-width: 640px;
position: relative;
@@ -392,6 +400,9 @@ export default {
float: right;
color: #409eff!important;
}
.g-pull-margin {
margin-right: 12px;
}
.g-tip-text {
color: #999;
}

View File

@@ -441,6 +441,7 @@
"Saturday": "星期六",
"Sunday": "星期天",
"ClearSelection": "清空选择",
"SelectAll": "全选",
"CanDragSelect": "可拖动鼠标选择时间段",
"WeekOrTime": "星期/时间"
},

View File

@@ -464,6 +464,7 @@
"Saturday": "Saturday",
"Sunday": "Sunday",
"ClearSelection": "Clear selection",
"SelectAll": "Select all",
"CanDragSelect": "Can drag the mouse to select a time period",
"WeekOrTime": "Week/Time"
}