Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

Commit 3b61110

Browse files
committed
Merge branch 'feature/timetable' into merge-test
2 parents a2b699f + 5e09735 commit 3b61110

1 file changed

Lines changed: 50 additions & 7 deletions

File tree

src/pages/TimeTable/components/AdminTimeTable.vue

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const timetableData = ref(null)
1010
const today = new Date('2025-06-05') // 오늘
1111
const today_day = today.getDay() // 오늘의 요일 (일요일=0)
1212
const selectDate = ref(null)
13+
// 선택한 target만 보이게
14+
const targets = ref({ 1: true, 2: true, 3: true, special: true, korean: true })
15+
const selectTargets = ref(['1', '2', '3', 'special', 'korean'])
1316
1417
// 주 변경시 시간표 데이터 갱신
1518
watch(
@@ -70,6 +73,17 @@ watch(
7073
{ immediate: true },
7174
)
7275
76+
// ================================= target 선택 =================================
77+
const handleSelect = (t) => {
78+
// true/false 설정
79+
targets.value[t] = !targets.value[t]
80+
// true인 키 값으로 배열 생성
81+
const targetsKey = Object.keys(targets.value).filter((target) => targets.value[target])
82+
console.log(targetsKey)
83+
// selectTargets 대입
84+
selectTargets.value = targetsKey
85+
}
86+
7387
// ===================================== 선택 =====================================
7488
// 선택 시작
7589
function startSelection(grade, idx, day, hour, schedule) {
@@ -131,6 +145,39 @@ function endSelection() {
131145
<div style="background-color: aliceblue">
132146
TimeTable
133147
148+
<div style="display: flex; gap: 5px">
149+
<button
150+
@click="handleSelect(1)"
151+
:style="targets[1] ? { backgroundColor: 'aqua' } : { backgroundColor: 'gray' }"
152+
>
153+
1학년
154+
</button>
155+
<button
156+
@click="handleSelect(2)"
157+
:style="targets[2] ? { backgroundColor: 'aqua' } : { backgroundColor: 'gray' }"
158+
>
159+
2학년
160+
</button>
161+
<button
162+
@click="handleSelect(3)"
163+
:style="targets[3] ? { backgroundColor: 'aqua' } : { backgroundColor: 'gray' }"
164+
>
165+
3학년
166+
</button>
167+
<button
168+
@click="handleSelect('special')"
169+
:style="targets['special'] ? { backgroundColor: 'aqua' } : { backgroundColor: 'gray' }"
170+
>
171+
특강
172+
</button>
173+
<button
174+
@click="handleSelect('korean')"
175+
:style="targets['korean'] ? { backgroundColor: 'aqua' } : { backgroundColor: 'gray' }"
176+
>
177+
한국어
178+
</button>
179+
</div>
180+
134181
<div>
135182
<button @click="handleBefore">지난주</button>
136183
<p>{{ selectDate.toISOString().split('T')[0] }}</p>
@@ -145,7 +192,7 @@ function endSelection() {
145192
<th
146193
v-for="(d, idx) in ['MON', 'TUE', 'WED', 'THU', 'FRI']"
147194
:key="idx"
148-
colspan="5"
195+
:colspan="selectTargets.length"
149196
style="border: 1px solid #000; padding: 10px"
150197
>
151198
{{ day(d) }} ({{ searchDate(idx + 1).slice(5) }})
@@ -155,11 +202,7 @@ function endSelection() {
155202
<tr>
156203
<th style="border: 1px solid #000; padding: 10px"></th>
157204
<template v-for="_ in 5" :key="_">
158-
<th
159-
v-for="g in ['1', '2', '3', 'special', 'korean']"
160-
:key="g"
161-
style="border: 1px solid #000; padding: 10px"
162-
>
205+
<th v-for="g in selectTargets" :key="g" style="border: 1px solid #000; padding: 10px">
163206
{{ setTarget(String(g)) }}
164207
</th>
165208
</template>
@@ -178,7 +221,7 @@ function endSelection() {
178221
<template v-for="(d, idx) in ['MON', 'TUE', 'WED', 'THU', 'FRI']" :key="idx">
179222
<!-- 학년 -->
180223
<td
181-
v-for="g in ['1', '2', '3', 'special', 'korean']"
224+
v-for="g in selectTargets"
182225
:key="g"
183226
@mousedown="
184227
timetableData?.[g]?.[d][String(hour)].length > 1 ||

0 commit comments

Comments
 (0)