update src/views/infra/apiAccessLog/ApiAccessLogModel.vue.
Signed-off-by: yanchangshan <5333290+yanchangshan@user.noreply.gitee.com>pull/2/head
parent
54f97dcbc3
commit
441a79e909
|
@ -1,16 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
<BasicModal v-bind="$attrs" @register="registerModal" @ok="handleSubmit">
|
||||||
<BasicForm @register="registerForm" />
|
<BasicForm @register="registerForm" />
|
||||||
|
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="ApiAccessLogModal">
|
<script lang="ts" setup name="ApiAccessLogModal">
|
||||||
|
|
||||||
import { ref, computed, unref } from 'vue'
|
import { ref, computed, unref } from 'vue'
|
||||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||||
import { BasicForm, useForm } from '@/components/Form'
|
import { BasicForm, useForm } from '@/components/Form'
|
||||||
import { formSchema } from './ApiAccessLog.data'
|
import { formSchema } from './ApiAccessLog.data'
|
||||||
import { createApiAccessLogApi, getApiAccessLogApi, updatePostApi } from '@/api/infra/apiAccessLog'
|
import { getApiAccessLogApi } from '@/api/infra/apiAccessLog'
|
||||||
|
|
||||||
const emit = defineEmits(['success', 'register'])
|
const emit = defineEmits(['success', 'register'])
|
||||||
const isUpdate = ref(true)
|
const isUpdate = ref(true)
|
||||||
|
@ -40,17 +38,10 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增API访问日志表' : '编辑API访问日志表'))
|
|
||||||
|
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
try {
|
try {
|
||||||
const values = await validate()
|
const values = await validate()
|
||||||
setModalProps({ confirmLoading: true })
|
setModalProps({ confirmLoading: true })
|
||||||
if (unref(isUpdate)) {
|
|
||||||
await updateApiAccessLogApi(values)
|
|
||||||
} else {
|
|
||||||
await createApiAccessLogApi(values)
|
|
||||||
}
|
|
||||||
closeModal()
|
closeModal()
|
||||||
emit('success')
|
emit('success')
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue