Refactor layout components for improved readability and consistency
This commit is contained in:
@@ -330,8 +330,8 @@ function handleDeleteSemester (id: number) {
|
||||
// 開始編輯子檔 (複製資料到暫存表單)
|
||||
function startDetailEdit () {
|
||||
if (!selectedSemester.value) return
|
||||
// Deep copy 以避免直接修改原始資料 (Vue 的響應式特性)
|
||||
detailForm.value = JSON.parse(JSON.stringify(selectedSemester.value))
|
||||
// 需要深拷貝來避免直接改到原始資料,且保留巢狀結構的語意
|
||||
detailForm.value = structuredClone(selectedSemester.value)
|
||||
isDetailEditing.value = true
|
||||
}
|
||||
|
||||
@@ -353,24 +353,6 @@ function saveDetailEdit () {
|
||||
detailForm.value = null
|
||||
}
|
||||
|
||||
// 編輯模式:新增課程項目
|
||||
function addCourseToDetail () {
|
||||
if (!detailForm.value) return
|
||||
detailForm.value.courses.push({
|
||||
code: '',
|
||||
name: '',
|
||||
credits: 3,
|
||||
score: 0
|
||||
})
|
||||
}
|
||||
|
||||
// 編輯模式:移除課程項目
|
||||
function removeCourseFromDetail (index: number) {
|
||||
if (!detailForm.value) return
|
||||
detailForm.value.courses.splice(index, 1)
|
||||
}
|
||||
|
||||
|
||||
const {
|
||||
errorSummary,
|
||||
fieldErrors,
|
||||
@@ -412,7 +394,6 @@ const dialogSubtitle = computed(() => {
|
||||
// 載入/儲存時鎖定、檢視模式 readonly
|
||||
const isFormLocked = computed(() => isLoading.value || isSaving.value)
|
||||
const {
|
||||
closeDialog,
|
||||
confirmClose,
|
||||
confirmCloseVisible,
|
||||
confirmDelete,
|
||||
@@ -422,7 +403,6 @@ const {
|
||||
confirmSaveVisible,
|
||||
confirmSwitch,
|
||||
confirmSwitchVisible,
|
||||
currentEditingRecord,
|
||||
handleDialogVisibility,
|
||||
hasNextRecord,
|
||||
hasPrevRecord,
|
||||
|
||||
@@ -474,7 +474,6 @@ const dialogSubtitle = computed(() => {
|
||||
// 載入/儲存時鎖定、檢視模式 readonly
|
||||
const isFormLocked = computed(() => isLoading.value || isSaving.value)
|
||||
const {
|
||||
closeDialog,
|
||||
confirmClose,
|
||||
confirmCloseVisible,
|
||||
confirmDelete,
|
||||
@@ -484,7 +483,6 @@ const {
|
||||
confirmSaveVisible,
|
||||
confirmSwitch,
|
||||
confirmSwitchVisible,
|
||||
currentEditingRecord,
|
||||
handleDialogVisibility,
|
||||
hasNextRecord,
|
||||
hasPrevRecord,
|
||||
|
||||
@@ -484,7 +484,6 @@ const dialogSubtitle = computed(() => {
|
||||
// 載入/儲存時鎖定、檢視模式 readonly
|
||||
const isFormLocked = computed(() => isLoading.value || isSaving.value)
|
||||
const {
|
||||
closeDialog,
|
||||
confirmClose,
|
||||
confirmCloseVisible,
|
||||
confirmDelete,
|
||||
@@ -494,7 +493,6 @@ const {
|
||||
confirmSaveVisible,
|
||||
confirmSwitch,
|
||||
confirmSwitchVisible,
|
||||
currentEditingRecord,
|
||||
handleDialogVisibility,
|
||||
hasNextRecord,
|
||||
hasPrevRecord,
|
||||
|
||||
@@ -402,11 +402,11 @@ import { mdiBroom, mdiDelete, mdiEye, mdiMagnify, mdiPencil } from '@mdi/js'
|
||||
import { computed, nextTick, ref } from 'vue'
|
||||
import { useDisplay } from 'vuetify'
|
||||
import MaintenanceCrudDialogs from '@/components/maintenance/MaintenanceCrudDialogs.vue'
|
||||
import { useMaintenanceCrudFlow } from '@/composables/maintenance/useMaintenanceCrudFlow'
|
||||
import { useStudentMaintenanceForm } from '@/composables/maintenance/useStudentMaintenanceForm'
|
||||
import MntDialogCard from '@/components/maintenance/MntDialogCard.vue'
|
||||
import MntPageCards from '@/components/maintenance/MntPageCards.vue'
|
||||
import MntRecordNavToolbar from '@/components/maintenance/MntRecordNavToolbar.vue'
|
||||
import { useMaintenanceCrudFlow } from '@/composables/maintenance/useMaintenanceCrudFlow'
|
||||
import { useStudentMaintenanceForm } from '@/composables/maintenance/useStudentMaintenanceForm'
|
||||
import { type StudentRecord, useStudentStore } from '@/stores/students'
|
||||
|
||||
// 下拉選項:系所/年級/入學年度/狀態
|
||||
@@ -525,7 +525,6 @@ const dialogSubtitle = computed(() => {
|
||||
// 載入/儲存時鎖定、檢視模式 readonly
|
||||
const isFormLocked = computed(() => isLoading.value || isSaving.value)
|
||||
const {
|
||||
closeDialog,
|
||||
confirmClose,
|
||||
confirmCloseVisible,
|
||||
confirmDelete,
|
||||
@@ -535,7 +534,6 @@ const {
|
||||
confirmSaveVisible,
|
||||
confirmSwitch,
|
||||
confirmSwitchVisible,
|
||||
currentEditingRecord,
|
||||
handleDialogVisibility,
|
||||
hasNextRecord,
|
||||
hasPrevRecord,
|
||||
|
||||
Reference in New Issue
Block a user