From 893dcd4f2487891199ed3e5a3d47a79a75efc942 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sat, 19 Apr 2025 17:08:44 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=88=87=E6=8D=A2=E5=88=B0=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E7=9A=84=E5=88=86=E7=BB=84=E5=90=8E=E5=86=8D=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=88=9B=E5=BB=BA=E5=AF=B9=E8=AF=9D=E6=A1=86=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E8=87=AA=E5=8A=A8=E9=80=89=E6=8B=A9=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/certd-client/src/utils/util.cache.ts | 2 +- .../views/certd/pipeline/cert-upload/use.tsx | 5 ++ .../views/certd/pipeline/certd-form/use.tsx | 5 ++ .../src/views/certd/pipeline/crud.tsx | 17 +++++ .../src/views/certd/pipeline/group/crud.tsx | 65 +++++++++---------- .../certd/pipeline/group/group-selector.vue | 60 +++++++++++++++++ 6 files changed, 120 insertions(+), 34 deletions(-) create mode 100644 packages/ui/certd-client/src/views/certd/pipeline/group/group-selector.vue diff --git a/packages/ui/certd-client/src/utils/util.cache.ts b/packages/ui/certd-client/src/utils/util.cache.ts index 2b155404..94a00a30 100644 --- a/packages/ui/certd-client/src/utils/util.cache.ts +++ b/packages/ui/certd-client/src/utils/util.cache.ts @@ -5,7 +5,7 @@ export class Cache { return this.bucket[key]; } - async set(key: string, value: any, ttl: number) { + async set(key: string, value: any, ttl?: number) { this.bucket[key] = value; } diff --git a/packages/ui/certd-client/src/views/certd/pipeline/cert-upload/use.tsx b/packages/ui/certd-client/src/views/certd/pipeline/cert-upload/use.tsx index ed8fa900..6ec4134d 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/cert-upload/use.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/cert-upload/use.tsx @@ -8,6 +8,7 @@ import { checkPipelineLimit, getAllDomainsFromCrt } from "/@/views/certd/pipelin import { useRouter } from "vue-router"; import { nanoid } from "nanoid"; import { usePluginStore } from "/@/store/plugin"; +import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue"; export function useCertUpload() { const { openCrudFormDialog } = useFormWrapper(); @@ -136,6 +137,10 @@ export function useCertUpload() { type: "dict-select", dict: groupDictRef, form: { + component: { + name: GroupSelector, + vModel: "modelValue", + }, value: req.defaultGroupId || undefined, order: 9999, }, diff --git a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx index 297dde54..508175d6 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/use.tsx @@ -10,6 +10,7 @@ import { ref } from "vue"; import * as api from "../api"; import { PluginGroup, usePluginStore } from "/@/store/plugin"; import { createNotificationApi } from "/@/views/certd/notification/api"; +import GroupSelector from "../group/group-selector.vue"; export function setRunnableIds(pipeline: any) { const idMap: any = {}; @@ -203,6 +204,10 @@ export function useCertPipelineCreator() { type: "dict-select", dict: groupDictRef, form: { + component: { + name: GroupSelector, + vModel: "modelValue", + }, order: 9999, }, }, diff --git a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx index 66dd1800..d16b388e 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx @@ -15,6 +15,7 @@ import CertView from "./cert-view.vue"; import { eachStages } from "./utils"; import { setRunnableIds, useCertPipelineCreator } from "/@/views/certd/pipeline/certd-form/use"; import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use"; +import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue"; export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys } }: CreateCrudOptionsProps): CreateCrudOptionsRet { const router = useRouter(); @@ -116,6 +117,13 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys const userStore = useUserStore(); const settingStore = useSettingStore(); + function onDialogOpen(opt: any) { + const searchForm = crudExpose.getSearchValidatedFormData(); + opt.initialForm = { + groupId: searchForm.groupId, + }; + } + return { crudOptions: { request: { @@ -193,6 +201,9 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys router.push({ path: "/certd/pipeline/detail", query: { id: res.id, editMode: "true" } }); } }, + wrapper: { + onOpen: onDialogOpen, + }, }, table: { scroll: { x: 1500 }, @@ -492,6 +503,12 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys show: true, }, dict: groupDictRef, + form: { + component: { + name: GroupSelector, + vModel: "modelValue", + }, + }, column: { width: 130, align: "center", diff --git a/packages/ui/certd-client/src/views/certd/pipeline/group/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/group/crud.tsx index c8f53a6c..225b1b42 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/group/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/group/crud.tsx @@ -5,7 +5,6 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi import { pipelineGroupApi } from "./api"; export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { - const { t } = useI18n(); const api = pipelineGroupApi; const pageRequest = async (query: UserPageQuery): Promise => { return await api.GetList(query); @@ -34,32 +33,32 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat mobile: { props: { rowHandle: { - width: 160 - } - } - } - } + width: 160, + }, + }, + }, + }, }, request: { pageRequest, addRequest, editRequest, - delRequest + delRequest, }, form: { labelCol: { //固定label宽度 span: null, style: { - width: "100px" - } + width: "100px", + }, }, col: { - span: 22 + span: 22, }, wrapper: { - width: 600 - } + width: 600, + }, }, rowHandle: { width: 200, @@ -72,12 +71,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat click({ row, index }) { crudExpose.openEdit({ index, - row + row, }); - } - } - } - } + }, + }, + }, + }, }, table: { editable: { @@ -90,8 +89,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat const { row, key, value } = opts; //如果是添加,需要返回{[rowKey]:xxx},比如:{id:2} return await api.UpdateObj({ id: row.id, [key]: value }); - } - } + }, + }, }, columns: { id: { @@ -99,37 +98,37 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat key: "id", type: "number", search: { - show: true + show: true, }, column: { width: 100, editable: { - disabled: true - } + disabled: true, + }, }, form: { - show: false - } + show: false, + }, }, name: { title: "分组名称", search: { - show: true + show: true, }, type: "text", form: { rules: [ { required: true, - message: "请输入分组名称" - } - ] + message: "请输入分组名称", + }, + ], }, column: { - width: 400 - } - } - } - } + width: 400, + }, + }, + }, + }, }; } diff --git a/packages/ui/certd-client/src/views/certd/pipeline/group/group-selector.vue b/packages/ui/certd-client/src/views/certd/pipeline/group/group-selector.vue new file mode 100644 index 00000000..df1db405 --- /dev/null +++ b/packages/ui/certd-client/src/views/certd/pipeline/group/group-selector.vue @@ -0,0 +1,60 @@ + + +