perf: 支持从提供商导入域名列表

This commit is contained in:
xiaojunnuo
2026-01-20 00:13:05 +08:00
parent 5ec9916817
commit f4423638a2
12 changed files with 138 additions and 23 deletions
@@ -1,5 +1,5 @@
<template>
<a-select>
<a-select :value="value" @update:value="onChange">
<a-select-option v-for="item of options" :key="item.value" :value="item.value" :label="item.label">
<span class="flex-o">
<fs-icon :icon="item.icon" class="fs-16 color-blue mr-5" />
@@ -12,5 +12,11 @@
<script lang="ts" setup>
const props = defineProps<{
options: { value: any; label: string; icon: string }[];
value: any;
}>();
const emit = defineEmits(["update:value"]);
function onChange(value: any) {
emit("update:value", value);
}
</script>
@@ -1,5 +1,5 @@
<template>
<icon-select class="dns-provider-selector" :value="modelValue" :options="options" @update:value="onChanged"> </icon-select>
<icon-select class="dns-provider-selector" :value="modelValue" :options="options" @update:value="atChange"> </icon-select>
</template>
<script lang="ts">
@@ -37,7 +37,7 @@ export default {
}
onCreate();
function onChanged(value: any) {
function atChange(value: any) {
ctx.emit("update:modelValue", value);
onSelectedChange(value);
}
@@ -52,7 +52,7 @@ export default {
}
return {
options,
onChanged,
atChange,
};
},
};
@@ -72,7 +72,7 @@ export default defineComponent({
}
async function emitValue(value) {
if (pipeline?.value && target?.value && pipeline.value.userId !== target.value.userId) {
if (pipeline && pipeline?.value && target?.value && pipeline.value.userId !== target.value.userId) {
message.error("对不起,您不能修改他人流水线的授权");
return;
}
@@ -57,3 +57,11 @@ export async function DeleteBatch(ids: any[]) {
data: { ids },
});
}
export async function SyncSubmit(body: any) {
return await request({
url: apiPrefix + "/sync/submit",
method: "post",
data: body,
});
}
@@ -8,6 +8,7 @@ import { useSettingStore } from "/@/store/settings";
import { Dicts } from "/@/components/plugins/lib/dicts";
import { createAccessApi } from "/@/views/certd/access/api";
import { Modal } from "ant-design-vue";
import { useDomainImport } from "./use";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter();
@@ -49,6 +50,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const dnsProviderTypeDict = dict({
url: "pi/dnsProvider/dnsProviderTypeDict",
});
const openDomainImportDialog = useDomainImport();
return {
crudOptions: {
settings: {
@@ -88,6 +91,18 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}
},
},
actionbar: {
buttons: {
import: {
title: "从域名提供商导入域名",
type: "primary",
text: "从域名提供商导入",
click: () => {
openDomainImportDialog();
},
},
},
},
columns: {
id: {
title: "ID",
@@ -1,5 +1,7 @@
import { message } from "ant-design-vue";
import * as api from "./api";
import { useFormDialog } from "/@/use/use-dialog";
import { compute } from "@fast-crud/fast-crud";
export function useDomainImport() {
const { openFormDialog } = useFormDialog();
@@ -7,11 +9,42 @@ export function useDomainImport() {
const columns = {
dnsProviderType: {
title: "域名提供商",
type: "select",
type: "text",
form: {
component: {
name: "dns-provider-selector",
},
on: {
//@ts-ignore
onSelectedChange: ({ form, $event }) => {
form.dnsProviderAccessType = $event.accessType;
},
},
//@ts-ignore
valueChange({ form }) {
form.dnsProviderAccessId = null;
},
},
},
dnsProviderAccessType: {
title: "域名提供商访问类型",
type: "text",
form: {
show: false,
},
},
dnsProviderAccessId: {
title: "域名提供商访问ID",
type: "input",
title: "域名提供商授权",
type: "text",
form: {
component: {
name: "access-selector",
vModel: "modelValue",
type: compute(({ form }) => {
return form.dnsProviderAccessType || form.dnsProviderType;
}),
},
},
},
};
@@ -20,9 +53,11 @@ export function useDomainImport() {
title: "从域名提供商导入域名",
columns: columns,
onSubmit: async (form: any) => {
await api.Save({
title: form.title,
await api.SyncSubmit({
dnsProviderType: form.dnsProviderType,
dnsProviderAccessId: form.dnsProviderAccessId,
});
message.success("导入任务已提交");
},
});
};