b25b036d
wuxw
v1.9 优化日期
|
1
|
<template>
|
03f63ab4
wuxw
优化到商户信息
|
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<div>
<el-form-item :label="$t('scheduleClassesWeek.scheduleCycle')">
<el-select v-model="scheduleCycle" :placeholder="$t('scheduleClassesWeek.scheduleCyclePlaceholder')"
@change="changeInspectionPeriodWeek" style="width:100%">
<el-option v-for="index in 4" :key="index" :label="`${index}${$t('scheduleClassesWeek.week')}`"
:value="index" />
</el-select>
</el-form-item>
<div v-for="week in scheduleCycle" :key="week">
<el-form-item :label="getWeek(week)">
<div class="schedule-weeks-container">
<template v-for="(item, index) in days">
|
257e836f
wuxw
v1.9 优化排版英文bug
|
15
|
<div v-if="item.weekFlag == 1" :key="index" class="schedule-week-item" @click="changeWorkdayWeekInfo(item)">
|
03f63ab4
wuxw
优化到商户信息
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<div class="day-name">{{ getWorkDay(item.day) }}</div>
<div class="workday-name">{{ item.workdayName }}</div>
<div v-for="(time, timeIndex) in item.times" :key="timeIndex" class="time-range">
{{ time.startTime }}-{{ time.endTime }}
</div>
</div>
</template>
</div>
</el-form-item>
</div>
</div>
</template>
<script>
export default {
name: 'ScheduleClassesWeek',
|
03f63ab4
wuxw
优化到商户信息
|
32
33
34
35
36
37
|
data() {
return {
scheduleCycle: 1,
days: []
}
},
|
03f63ab4
wuxw
优化到商户信息
|
38
39
40
41
42
|
methods: {
initData(scheduleCycle) {
this.scheduleCycle = scheduleCycle
this.changeInspectionPeriodWeek()
},
|
9fc8656f
wuxw
优化排版功能
|
43
|
notify(params) {
|
9fc8656f
wuxw
优化排版功能
|
44
|
this.scheduleCycle = parseInt(params.scheduleCycle);
|
257e836f
wuxw
v1.9 优化排版英文bug
|
45
|
this.days = params.days
|
9fc8656f
wuxw
优化排版功能
|
46
|
|
257e836f
wuxw
v1.9 优化排版英文bug
|
47
|
// 使用深拷贝确保数据是响应式的,并确保每个 item 都有 times 数组
|
9fc8656f
wuxw
优化排版功能
|
48
49
50
|
if (params.days && params.days.length > 0) {
return;
}
|
257e836f
wuxw
v1.9 优化排版英文bug
|
51
|
|
9fc8656f
wuxw
优化排版功能
|
52
53
|
this.changeInspectionPeriodWeek();
},
|
03f63ab4
wuxw
优化到商户信息
|
54
|
changeInspectionPeriodWeek() {
|
257e836f
wuxw
v1.9 优化排版英文bug
|
55
56
|
let _days = this.days;
_days.splice(0, _days.length);
|
03f63ab4
wuxw
优化到商户信息
|
57
58
|
for (let weekIndex = 0; weekIndex < this.scheduleCycle; weekIndex++) {
for (let cycleIndex = 0; cycleIndex < 7; cycleIndex++) {
|
257e836f
wuxw
v1.9 优化排版英文bug
|
59
|
_days.push({
|
03f63ab4
wuxw
优化到商户信息
|
60
61
62
63
64
65
66
67
|
weekFlag: weekIndex + 1,
day: cycleIndex + 1,
workday: '2002',
workdayName: this.$t('scheduleClassesWeek.rest'),
times: []
})
}
}
|
9fc8656f
wuxw
优化排版功能
|
68
|
this.$emit('cycleChange', this.scheduleCycle)
|
03f63ab4
wuxw
优化到商户信息
|
69
70
|
},
changeWorkdayWeekInfo(item) {
|
9fc8656f
wuxw
优化排版功能
|
71
|
this.$emit('editDay', item)
|
03f63ab4
wuxw
优化到商户信息
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
},
getWeek(week) {
return `${week}${this.$t('scheduleClassesWeek.week')}`
},
getWorkDay(day) {
const days = [
this.$t('common.monday'),
this.$t('common.tuesday'),
this.$t('common.wednesday'),
this.$t('common.thursday'),
this.$t('common.friday'),
this.$t('common.saturday'),
this.$t('common.sunday')
]
return days[day - 1]
},
getDaysData() {
return this.days
}
}
}
</script>
<style lang="scss" scoped>
.schedule-weeks-container {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.schedule-week-item {
width: calc(14.28% - 10px);
padding: 10px;
border: 1px solid #ebeef5;
border-radius: 4px;
cursor: pointer;
text-align: center;
transition: all 0.3s;
&:hover {
border-color: #409eff;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.day-name {
font-weight: bold;
margin-bottom: 5px;
}
.workday-name {
margin-bottom: 5px;
}
.time-range {
font-size: 12px;
color: #666;
}
}
</style>
|