This commit is contained in:
2024-08-13 18:35:48 +08:00
parent 4575d12071
commit 29e8758dc9
18 changed files with 767 additions and 583 deletions

View File

@@ -1,8 +1,10 @@
<template>
<!-- addon-before-cancel -->
<component
:is="componentName"
v-model:visible="dataVisible"
:on-before-ok="submit"
:on-before-cancel="beforeCancel"
@cancel="close"
ok-text="保存"
cancel-text="关闭"
@@ -46,7 +48,7 @@ const dataVisible = ref(false)
const form = ref({})
const actionTitle = ref("")
const dataLoading = ref(true)
const emit = defineEmits(["success", "error"])
const emit = defineEmits(["success", "error", "beforeCancel"])
provide("form", toRaw(form))
@@ -134,6 +136,11 @@ const open = () => {
dataVisible.value = true
}
}
// ~~~~addMethod~~~~
const beforeCancel = () => {
emit("beforeCancel")
return true
}
const close = () => {
dataVisible.value = false
formColumns.value = []

View File

@@ -140,7 +140,7 @@
class="ma-crud-table-tr"
:class="
isFunction(options.rowCustomClass)
? options.rowCustomClass(record, rowIndex) ?? []
? (options.rowCustomClass(record, rowIndex) ?? [])
: options.rowCustomClass
"
@contextmenu.prevent="openContextMenu($event, record)"
@@ -215,7 +215,7 @@
<ma-setting ref="crudSettingRef" />
<ma-form ref="crudFormRef" @success="requestSuccess">
<ma-form ref="crudFormRef" @success="requestSuccess" v-bind="$attrs">
<template v-for="slot in Object.keys($slots)" #[slot]="component">
<slot :name="slot" v-bind="component" />
</template>