|
@@ -3,10 +3,10 @@
|
|
|
<table class="time_table table" v-on:mouseleave="mouseleave">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th rowspan="2" style="width:120px">日期/时间</th>
|
|
|
+ <th rowspan="2" style="width: 120px">日期/时间</th>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <th class="unselectable" v-for="(num, index) in numData" :key="index" style="width:30px">{{ num }}</th>
|
|
|
+ <th class="unselectable" v-for="(num, index) in numData" :key="index" style="width: 30px">{{ num }}</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
@@ -41,8 +41,8 @@ export default {
|
|
|
type: String,
|
|
|
default() {
|
|
|
return '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -52,39 +52,39 @@ export default {
|
|
|
timeData: [
|
|
|
{
|
|
|
date: '周一',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周二',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周三',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周四',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周五',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周六',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周日',
|
|
|
- time: []
|
|
|
- }
|
|
|
+ time: [],
|
|
|
+ },
|
|
|
],
|
|
|
selectFlag: false,
|
|
|
max: {
|
|
|
x: 0,
|
|
|
- y: 0
|
|
|
+ y: 0,
|
|
|
},
|
|
|
- dataString: ''
|
|
|
+ dataString: '',
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -102,7 +102,7 @@ export default {
|
|
|
showOne(index, key) {
|
|
|
// this.timeData[index].time[key].isSelected = !this.timeData[index].time[key].isSelected
|
|
|
},
|
|
|
- mousedown: function(index, key) {
|
|
|
+ mousedown: function (index, key) {
|
|
|
this.selectStart = []
|
|
|
this.selectFlag = true
|
|
|
if (this.timeData[index].time[key].value == false) {
|
|
@@ -114,10 +114,10 @@ export default {
|
|
|
}
|
|
|
this.selectStart.push({
|
|
|
index: index,
|
|
|
- key: key
|
|
|
+ key: key,
|
|
|
})
|
|
|
},
|
|
|
- mouseover: function(index, key) {
|
|
|
+ mouseover: function (index, key) {
|
|
|
// x 垂直方向 y 水平方向
|
|
|
if (this.selectFlag) {
|
|
|
if (index >= this.max.x) {
|
|
@@ -128,11 +128,11 @@ export default {
|
|
|
}
|
|
|
var start = {
|
|
|
x: this.selectStart[0].index,
|
|
|
- y: this.selectStart[0].key
|
|
|
+ y: this.selectStart[0].key,
|
|
|
}
|
|
|
var end = {
|
|
|
x: index,
|
|
|
- y: key
|
|
|
+ y: key,
|
|
|
}
|
|
|
for (var i = end.x; i <= this.max.x; i++) {
|
|
|
for (var j = end.y; j <= this.max.y; j++) {
|
|
@@ -153,14 +153,14 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- mouseup: function(index, key) {
|
|
|
+ mouseup: function (index, key) {
|
|
|
var start = {
|
|
|
x: this.selectStart[0].index,
|
|
|
- y: this.selectStart[0].key
|
|
|
+ y: this.selectStart[0].key,
|
|
|
}
|
|
|
var end = {
|
|
|
x: index,
|
|
|
- y: key
|
|
|
+ y: key,
|
|
|
}
|
|
|
/* 渲染选中的区域 */
|
|
|
var data = []
|
|
@@ -179,7 +179,7 @@ export default {
|
|
|
this.timeData[5].time,
|
|
|
this.timeData[6].time
|
|
|
)
|
|
|
- this.dataString = arr.map(item => {
|
|
|
+ this.dataString = arr.map((item) => {
|
|
|
if (item.isSelected) {
|
|
|
return 1
|
|
|
} else {
|
|
@@ -191,10 +191,10 @@ export default {
|
|
|
this.selectFlag = false
|
|
|
this.max = {
|
|
|
x: 0,
|
|
|
- y: 0
|
|
|
+ y: 0,
|
|
|
}
|
|
|
},
|
|
|
- mouseleave: function() {
|
|
|
+ mouseleave: function () {
|
|
|
this.selectFlag = false
|
|
|
},
|
|
|
setItemDate(sum) {
|
|
@@ -221,32 +221,32 @@ export default {
|
|
|
this.timeData = [
|
|
|
{
|
|
|
date: '周一',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周二',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周三',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周四',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周五',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周六',
|
|
|
- time: []
|
|
|
+ time: [],
|
|
|
},
|
|
|
{
|
|
|
date: '周日',
|
|
|
- time: []
|
|
|
- }
|
|
|
+ time: [],
|
|
|
+ },
|
|
|
]
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
if (i < 24) {
|
|
@@ -265,20 +265,21 @@ export default {
|
|
|
this.timeData[6].time.push({ isSelected: arr[i] == 1 ? true : false, move: false, value: false })
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
scheduleTime: {
|
|
|
immediate: true, // immediate选项可以开启首次赋值监听
|
|
|
handler(newVal, oldVal) {
|
|
|
- if(newVal == '' || newVal == null || newVal == undefined){
|
|
|
- // this.scheduleTime=oldVal
|
|
|
- this.$emit('update:scheduleTime', oldVal)
|
|
|
+ if (newVal == '' || newVal == null || newVal == undefined) {
|
|
|
+ // this.scheduleTime=oldVal
|
|
|
+ this.$emit('update:scheduleTime', oldVal)
|
|
|
+ } else {
|
|
|
+ this.init()
|
|
|
}
|
|
|
- this.init()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|