Refactor MasterDetailMntC.vue for improved readability and consistency

This commit is contained in:
skytek_xinliang
2026-03-30 09:18:55 +08:00
parent 7591ecd062
commit 16b58fbf7a
66 changed files with 2071 additions and 777 deletions
+6 -6
View File
@@ -107,7 +107,7 @@ const dialogModel = computed({
set: (v: boolean) => emit('update:modelValue', v),
})
function normalizeOptions (options: Array<Option | string | number>) {
function normalizeOptions(options: Array<Option | string | number>) {
return options.map((o) => {
if (typeof o === 'string' || typeof o === 'number') {
return { title: String(o), value: o }
@@ -121,7 +121,7 @@ const normalizedPermissionOptions = computed(() => normalizeOptions(props.permis
const form = reactive<GenericRecord>({})
function resetForm (next: GenericRecord) {
function resetForm(next: GenericRecord) {
for (const key of Object.keys(form)) {
delete form[key]
}
@@ -129,7 +129,7 @@ function resetForm (next: GenericRecord) {
}
const getDefaultStatus = (): OptionValue | '' => normalizedStatusOptions.value[0]?.value ?? ''
function getDefaultPermission (): OptionValue | '' {
function getDefaultPermission(): OptionValue | '' {
return normalizedPermissionOptions.value[0]?.value ?? ''
}
@@ -153,7 +153,7 @@ const formPermission = computed<OptionValue | ''>({
},
})
function syncFromItem () {
function syncFromItem() {
const item = props.item ?? {}
resetForm({ ...item })
@@ -182,12 +182,12 @@ watch(
}
)
function handleCancel () {
function handleCancel() {
emit('cancel')
dialogModel.value = false
}
function handleSubmit () {
function handleSubmit() {
emit('submit', { ...form })
if (props.closeOnSubmit) {