This commit is contained in:
xiaojunnuo
2024-10-10 02:15:05 +08:00
parent b5d8935159
commit f0b2a61246
26 changed files with 262 additions and 120 deletions
@@ -26,9 +26,9 @@ import * as api from "./api.js";
const statusDict = dict({
data: [
{ label: "待设置CNAME", value: "cname", color: "warning" },
{ label: "验证中", value: "validating", color: "primary" },
{ label: "验证成功", value: "valid", color: "success" },
{ label: "验证失败", value: "failed", color: "error" }
{ label: "验证中", value: "validating", color: "blue" },
{ label: "验证成功", value: "valid", color: "green" },
{ label: "验证失败", value: "failed", color: "red" }
]
});
@@ -57,3 +57,13 @@ export async function DeleteBatch(ids: any[]) {
data: { ids }
});
}
export async function DoVerify(id: number) {
return await request({
url: apiPrefix + "/verify",
method: "post",
data: {
id
}
});
}
@@ -1,10 +1,12 @@
import * as api from "./api";
import { useI18n } from "vue-i18n";
import { computed, Ref, ref } from "vue";
import { Ref, ref } from "vue";
import { useRouter } from "vue-router";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, utils } from "@fast-crud/fast-crud";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { useUserStore } from "/@/store/modules/user";
import { useSettingStore } from "/@/store/modules/settings";
import { message } from "ant-design-vue";
import { DoVerify } from "./api";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter();
@@ -58,6 +60,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
editRequest,
delRequest
},
tabs: {
name: "status",
show: true
},
rowHandle: {
minWidth: 200,
fixed: "right"
@@ -139,9 +145,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
dict: dict({
data: [
{ label: "待设置CNAME", value: "cname", color: "warning" },
{ label: "验证中", value: "validating", color: "primary" },
{ label: "验证成功", value: "valid", color: "success" },
{ label: "验证失败", value: "failed", color: "error" }
{ label: "验证中", value: "validating", color: "blue" },
{ label: "验证成功", value: "valid", color: "green" },
{ label: "验证失败", value: "failed", color: "red" }
]
}),
addForm: {
@@ -160,14 +166,29 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
},
column: {
conditionalRenderDisabled: true,
width: 100,
width: 130,
align: "center",
cellRender({ row, value }) {
if (row.status === "valid") {
return "-";
}
async function doVerify() {
row._validating_ = true;
try {
const res = await api.DoVerify(row.id);
if (res === true) {
message.success("验证成功");
row.status = "valid";
}
} catch (e) {
console.error(e);
message.error(e.message);
} finally {
row._validating_ = false;
}
}
return (
<a-button size={"small"} type={"primary"}>
<a-button onClick={doVerify} loading={row._validating_} size={"small"} type={"primary"}>
</a-button>
);
@@ -18,7 +18,7 @@ import { onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "/@/views/certd/history/api";
import { DeleteBatch } from "./api";
defineOptions({
name: "CnameRecord"
@@ -18,7 +18,7 @@ import { onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "/@/views/certd/history/api";
import { DeleteBatch } from "./api";
defineOptions({
name: "PipelineHistory"