|
@@ -24,7 +24,7 @@ interface DialogProps {
|
|
|
// 临时用的close
|
|
|
const { dialogClose } = useDialog()
|
|
|
|
|
|
-const emits = defineEmits(['formSubmit'])
|
|
|
+const emits = defineEmits(['formSubmit', 'customSubmit'])
|
|
|
|
|
|
// 新增的URL与更新URL,因为有时候更新和新增在一起,有时候是分开的,所以在这里去区分
|
|
|
const addUrl = ref<string>('')
|
|
@@ -50,9 +50,15 @@ const dialogConfig = reactive({
|
|
|
})
|
|
|
|
|
|
/**
|
|
|
- * 游戏配置提交
|
|
|
+ * 表单提交
|
|
|
+ * 根据传入的配置决定是由用户自定义提交过程,还是由组件内部进行提交
|
|
|
*/
|
|
|
-const submitGameChange = () => {
|
|
|
+const submitForm = () => {
|
|
|
+ // if (props.config.customSubmit) {
|
|
|
+ // emits('customSubmit', dialogFormRef.value?.getFormData(), dialogConfig.type)
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+
|
|
|
dialogFormRef.value
|
|
|
?.submitFormData()
|
|
|
.then((formData) => {
|
|
@@ -62,6 +68,15 @@ const submitGameChange = () => {
|
|
|
dialogConfig.dialogVisible = false
|
|
|
})
|
|
|
}
|
|
|
+//
|
|
|
+const handleSubmit = () => {
|
|
|
+ // 待定,并没有使用
|
|
|
+ if (props.config.customSubmit) {
|
|
|
+ emits('customSubmit', dialogFormRef.value?.getFormData(), dialogConfig.type)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ submitForm()
|
|
|
+}
|
|
|
|
|
|
// 表单关闭
|
|
|
const closeDialog = () => {
|
|
@@ -136,7 +151,7 @@ defineExpose({
|
|
|
<div class="dialog-footer">
|
|
|
<slot name="otherBtn"></slot>
|
|
|
<slot name="btnGroup">
|
|
|
- <el-button class="dialogBtn" type="primary" @click="submitGameChange()">
|
|
|
+ <el-button class="dialogBtn" type="primary" @click="handleSubmit()">
|
|
|
{{ configBtnText }}
|
|
|
</el-button>
|
|
|
<el-button class="dialogBtn" @click="closeDialog">取消</el-button>
|