diff --git a/packages/ui/certd-client/src/style/certd.less b/packages/ui/certd-client/src/style/certd.less index cf151331..35299775 100644 --- a/packages/ui/certd-client/src/style/certd.less +++ b/packages/ui/certd-client/src/style/certd.less @@ -9,6 +9,10 @@ display: inline-flex; justify-content: center; align-items: center; + .fs-iconify{ + font-size:18px; + margin-right: 5px; + } } .cd-icon-button { diff --git a/packages/ui/certd-client/src/views/certd/open/openkey/api.ts b/packages/ui/certd-client/src/views/certd/open/openkey/api.ts index 6dac377f..86771e45 100644 --- a/packages/ui/certd-client/src/views/certd/open/openkey/api.ts +++ b/packages/ui/certd-client/src/views/certd/open/openkey/api.ts @@ -1,55 +1,53 @@ import { request } from "/src/api/service"; -export function createApi() { - const apiPrefix = "/open/key"; - return { - async GetList(query: any) { - return await request({ - url: apiPrefix + "/page", - method: "post", - data: query - }); - }, +export const OPEN_API_DOC = "https://apifox.com/apidoc/shared-2e76f8c4-7c58-413b-a32d-a1316529af44/254949529e0"; - async AddObj(obj: any) { - return await request({ - url: apiPrefix + "/add", - method: "post", - data: obj - }); - }, +const apiPrefix = "/open/key"; +export const openkeyApi = { + async GetList(query: any) { + return await request({ + url: apiPrefix + "/page", + method: "post", + data: query + }); + }, - async UpdateObj(obj: any) { - return await request({ - url: apiPrefix + "/update", - method: "post", - data: obj - }); - }, + async AddObj(obj: any) { + return await request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); + }, - async DelObj(id: number) { - return await request({ - url: apiPrefix + "/delete", - method: "post", - params: { id } - }); - }, + async UpdateObj(obj: any) { + return await request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); + }, - async GetObj(id: number) { - return await request({ - url: apiPrefix + "/info", - method: "post", - params: { id } - }); - }, - async GetApiToken(id: number) { - return await request({ - url: apiPrefix + "/getApiToken", - method: "post", - data: { id } - }); - } - }; -} + async DelObj(id: number) { + return await request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); + }, -export const pipelineGroupApi = createApi(); + async GetObj(id: number) { + return await request({ + url: apiPrefix + "/info", + method: "post", + params: { id } + }); + }, + async GetApiToken(id: number) { + return await request({ + url: apiPrefix + "/getApiToken", + method: "post", + data: { id } + }); + } +}; diff --git a/packages/ui/certd-client/src/views/certd/open/openkey/crud.tsx b/packages/ui/certd-client/src/views/certd/open/openkey/crud.tsx index e18ed809..f5bc9be3 100644 --- a/packages/ui/certd-client/src/views/certd/open/openkey/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/open/openkey/crud.tsx @@ -1,15 +1,12 @@ // @ts-ignore import { useI18n } from "vue-i18n"; -import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; -import { pipelineGroupApi } from "./api"; -import dayjs from "dayjs"; -import { Modal } from "ant-design-vue"; -import CertView from "/@/views/certd/pipeline/cert-view.vue"; +import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; +import { OPEN_API_DOC, openkeyApi } from "./api"; import { useModal } from "/@/use/use-modal"; export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { const { t } = useI18n(); - const api = pipelineGroupApi; + const api = openkeyApi; const pageRequest = async (query: UserPageQuery): Promise => { return await api.GetList(query); }; @@ -59,17 +56,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat actionbar: { buttons: { add: { - text: "生成新的Key", - click() { - Modal.confirm({ - title: "确认", - content: "确定要生成新的Key?", - async onOk() { - await api.AddObj({}); - await crudExpose.doRefresh(); - } - }); - } + text: "生成新的Key" } } }, @@ -82,7 +69,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat edit: { show: false }, remove: { show: true }, gen: { - text: "测试ApiToken", + text: " 接口测试", + size: "mini", + icon: "devicon-plain:vitest", + type: "primary", async click({ row }) { const apiToken = await api.GetApiToken(row.id); @@ -94,7 +84,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat content: () => { return (
-
测试ApiKey如下,您可以在3分钟内使用它进行开放接口请求测试
+
+ 测试ApiKey如下,您可以在3分钟内使用它进行 + + 开放接口 + + 请求测试 +
@@ -126,26 +122,50 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat }, keyId: { title: "KeyId", + type: ["text", "copyable"], search: { show: false }, form: { show: false }, - type: "text", column: { - width: 200, + width: 250, sorter: true } }, keySecret: { title: "KeySecret", - type: "text", + type: ["text", "copyable"], form: { show: false }, column: { - width: 550, + width: 580, + sorter: true + } + }, + scope: { + title: "权限范围", + type: "dict-radio", + dict: dict({ + data: [ + { label: "仅开放接口", value: "open", color: "blue" }, + { label: "账户所有权限", value: "user", color: "red" } + ] + }), + form: { + value: "open", + show: true, + rules: [{ required: true, message: "此项必填" }], + helper: "仅开放接口只可以访问开放接口,账户所有权限可以访问所有接口", + component: { + vModel: "value" + } + }, + column: { + width: 120, + align: "center", sorter: true } }, diff --git a/packages/ui/certd-client/src/views/certd/open/openkey/index.vue b/packages/ui/certd-client/src/views/certd/open/openkey/index.vue index 2f5097ac..0fa53b7c 100644 --- a/packages/ui/certd-client/src/views/certd/open/openkey/index.vue +++ b/packages/ui/certd-client/src/views/certd/open/openkey/index.vue @@ -2,16 +2,20 @@