You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
|
|
|
<template>
|
|
|
|
<BasicModal v-bind="$attrs" @register="registerModal" title="IP 查询" @ok="handleSubmit">
|
|
|
|
<BasicForm @register="registerForm" />
|
|
|
|
</BasicModal>
|
|
|
|
</template>
|
|
|
|
<script lang="ts" setup name="AreaModal">
|
|
|
|
import { BasicModal, useModalInner } from '@/components/Modal'
|
|
|
|
import { BasicForm, useForm } from '@/components/Form'
|
|
|
|
import { formSchema } from './area.data'
|
|
|
|
import { getAreaByIp } from '@/api/system/area'
|
|
|
|
|
|
|
|
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
|
|
|
labelWidth: 100,
|
|
|
|
baseColProps: { span: 24 },
|
|
|
|
schemas: formSchema,
|
|
|
|
showActionButtonGroup: false,
|
|
|
|
actionColOptions: { span: 23 }
|
|
|
|
})
|
|
|
|
|
|
|
|
const [registerModal, { setModalProps }] = useModalInner(async () => {
|
|
|
|
resetFields()
|
|
|
|
setModalProps({ confirmLoading: false })
|
|
|
|
})
|
|
|
|
|
|
|
|
async function handleSubmit() {
|
|
|
|
try {
|
|
|
|
const values = await validate()
|
|
|
|
setModalProps({ confirmLoading: true })
|
|
|
|
const res = getAreaByIp(values.ip)
|
|
|
|
if (res) {
|
|
|
|
values.result = res
|
|
|
|
setFieldsValue({ ...values })
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
setModalProps({ confirmLoading: false })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|