mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
perf: 获取阿里证书订单id组件增加翻页功能,突破50的上限
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="remote-select">
|
<div class="remote-select">
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<a-select class="remote-select-input" show-search :filter-option="filterOption" :options="optionsRef" :value="value" v-bind="attrs" @click="onClick" @update:value="emit('update:value', $event)">
|
<a-select class="remote-select-input" show-search mode="tags" :filter-option="filterOption" :options="optionsRef" :value="value" v-bind="attrs" @click="onClick" @update:value="updateValue($event)">
|
||||||
<template #dropdownRender="{ menuNode: menu }">
|
<template #dropdownRender="{ menuNode: menu }">
|
||||||
<template v-if="search">
|
<template v-if="search">
|
||||||
<div class="flex w-full" style="padding: 4px 8px">
|
<div class="flex w-full" style="padding: 4px 8px">
|
||||||
@@ -61,6 +61,7 @@ const props = defineProps<
|
|||||||
watches?: string[];
|
watches?: string[];
|
||||||
search?: boolean;
|
search?: boolean;
|
||||||
pager?: boolean;
|
pager?: boolean;
|
||||||
|
multi?: boolean;
|
||||||
} & ComponentPropsType
|
} & ComponentPropsType
|
||||||
>();
|
>();
|
||||||
|
|
||||||
@@ -68,6 +69,15 @@ const emit = defineEmits<{
|
|||||||
"update:value": any;
|
"update:value": any;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
function updateValue(value: any) {
|
||||||
|
if (props.multi) {
|
||||||
|
emit("update:value", value);
|
||||||
|
} else {
|
||||||
|
const last = value?.[value.length - 1];
|
||||||
|
emit("update:value", last);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const attrs = useAttrs();
|
const attrs = useAttrs();
|
||||||
|
|
||||||
const getCurrentPluginDefine: any = inject("getCurrentPluginDefine", () => {
|
const getCurrentPluginDefine: any = inject("getCurrentPluginDefine", () => {
|
||||||
@@ -80,6 +90,7 @@ const getPluginType: any = inject("get:plugin:type", () => {
|
|||||||
return "plugin";
|
return "plugin";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
debugger;
|
||||||
const searchKeyRef = ref("");
|
const searchKeyRef = ref("");
|
||||||
const optionsRef = ref([]);
|
const optionsRef = ref([]);
|
||||||
const message = ref("");
|
const message = ref("");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as _ from "lodash-es";
|
|
||||||
import { asyncCompute, compute } from "@fast-crud/fast-crud";
|
import { asyncCompute, compute } from "@fast-crud/fast-crud";
|
||||||
|
import { merge } from "lodash-es";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
|
||||||
export type MergeScriptContext = {
|
export type MergeScriptContext = {
|
||||||
@@ -18,7 +18,7 @@ export function useReference(formItem: any) {
|
|||||||
const script = formItem.mergeScript;
|
const script = formItem.mergeScript;
|
||||||
const func = new Function("ctx", script);
|
const func = new Function("ctx", script);
|
||||||
const merged = func(ctx);
|
const merged = func(ctx);
|
||||||
_.merge(formItem, merged);
|
merge(formItem, merged);
|
||||||
|
|
||||||
delete formItem.mergeScript;
|
delete formItem.mergeScript;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useRouter } from "vue-router";
|
|||||||
import { compute, CreateCrudOptionsRet, dict, useFormWrapper } from "@fast-crud/fast-crud";
|
import { compute, CreateCrudOptionsRet, dict, useFormWrapper } from "@fast-crud/fast-crud";
|
||||||
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
|
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
|
||||||
import { useReference } from "/@/use/use-refrence";
|
import { useReference } from "/@/use/use-refrence";
|
||||||
import { computed, ref } from "vue";
|
import { computed, provide, Ref, ref } from "vue";
|
||||||
import * as api from "../api";
|
import * as api from "../api";
|
||||||
import { PluginGroup, usePluginStore } from "/@/store/plugin";
|
import { PluginGroup, usePluginStore } from "/@/store/plugin";
|
||||||
import { createNotificationApi } from "/@/views/certd/notification/api";
|
import { createNotificationApi } from "/@/views/certd/notification/api";
|
||||||
@@ -89,9 +89,10 @@ export function useCertPipelineCreator() {
|
|||||||
const inputs: any = {};
|
const inputs: any = {};
|
||||||
const moreParams = [];
|
const moreParams = [];
|
||||||
const doSubmit = req.doSubmit;
|
const doSubmit = req.doSubmit;
|
||||||
for (const inputKey in req.certPlugin.input) {
|
const certPlugin = req.certPlugin;
|
||||||
|
for (const inputKey in certPlugin.input) {
|
||||||
// inputs[inputKey].form.show = true;
|
// inputs[inputKey].form.show = true;
|
||||||
const inputDefine = cloneDeep(req.certPlugin.input[inputKey]);
|
const inputDefine = cloneDeep(certPlugin.input[inputKey]);
|
||||||
if (inputDefine.maybeNeed) {
|
if (inputDefine.maybeNeed) {
|
||||||
moreParams.push(inputKey);
|
moreParams.push(inputKey);
|
||||||
}
|
}
|
||||||
@@ -103,7 +104,6 @@ export function useCertPipelineCreator() {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const pluginStore = usePluginStore();
|
const pluginStore = usePluginStore();
|
||||||
const randomHour = Math.floor(Math.random() * 6);
|
const randomHour = Math.floor(Math.random() * 6);
|
||||||
const randomMin = Math.floor(Math.random() * 60);
|
const randomMin = Math.floor(Math.random() * 60);
|
||||||
@@ -322,7 +322,7 @@ export function useCertPipelineCreator() {
|
|||||||
return certPlugins;
|
return certPlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openAddCertdPipelineDialog(req: { pluginName: string; defaultGroupId?: number; title?: string }) {
|
async function openAddCertdPipelineDialog(req: { pluginName: string; defaultGroupId?: number; title?: string; currentPluginRef: Ref<any> }) {
|
||||||
//检查是否流水线数量超出限制
|
//检查是否流水线数量超出限制
|
||||||
await checkPipelineLimit();
|
await checkPipelineLimit();
|
||||||
|
|
||||||
@@ -393,6 +393,8 @@ export function useCertPipelineCreator() {
|
|||||||
message.error("该证书申请插件不存在");
|
message.error("该证书申请插件不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
req.currentPluginRef.value = certPlugin;
|
||||||
const { crudOptions } = createCrudOptions({
|
const { crudOptions } = createCrudOptions({
|
||||||
certPlugin,
|
certPlugin,
|
||||||
doSubmit,
|
doSubmit,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onActivated, onMounted, ref } from "vue";
|
import { computed, onActivated, onMounted, provide, ref } from "vue";
|
||||||
import { dict, useFs } from "@fast-crud/fast-crud";
|
import { dict, useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud";
|
||||||
import ChangeGroup from "./components/change-group.vue";
|
import ChangeGroup from "./components/change-group.vue";
|
||||||
@@ -69,6 +69,7 @@ import { groupDictRef } from "./group/dicts";
|
|||||||
import { useCertPipelineCreator } from "./certd-form/use";
|
import { useCertPipelineCreator } from "./certd-form/use";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import { useCrudPermission } from "/@/plugin/permission";
|
import { useCrudPermission } from "/@/plugin/permission";
|
||||||
|
import CertdForm from "./certd-form/certd-form.vue";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "PipelineManager",
|
name: "PipelineManager",
|
||||||
@@ -79,11 +80,17 @@ const context: any = {
|
|||||||
selectedRowKeys,
|
selectedRowKeys,
|
||||||
};
|
};
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { openAddCertdPipelineDialog } = useCertPipelineCreator();
|
|
||||||
function onActionbarMoreItemClick(req: { key: string; item: any }) {
|
function onActionbarMoreItemClick(req: { key: string; item: any }) {
|
||||||
openCertApplyDialog({ key: req.key, title: req.item?.title });
|
openCertApplyDialog({ key: req.key, title: req.item?.title });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const certdFormRef = ref<typeof CertdForm>();
|
||||||
|
const currentPluginRef = ref();
|
||||||
|
provide("getCurrentPluginDefine", () => {
|
||||||
|
return currentPluginRef.value;
|
||||||
|
});
|
||||||
|
|
||||||
const addMorePipelineBtns = computed(() => {
|
const addMorePipelineBtns = computed(() => {
|
||||||
return [
|
return [
|
||||||
{ key: "CertApplyGetFormAliyun", title: t("certd.pipelinePage.aliyunSubscriptionPipeline"), icon: "svg:icon-aliyun" },
|
{ key: "CertApplyGetFormAliyun", title: t("certd.pipelinePage.aliyunSubscriptionPipeline"), icon: "svg:icon-aliyun" },
|
||||||
@@ -92,6 +99,7 @@ const addMorePipelineBtns = computed(() => {
|
|||||||
{ key: "BatchAddPipeline", title: t("certd.pipelinePage.batchAddPipeline"), icon: "ion:duplicate" },
|
{ key: "BatchAddPipeline", title: t("certd.pipelinePage.batchAddPipeline"), icon: "ion:duplicate" },
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
const { openAddCertdPipelineDialog } = useCertPipelineCreator();
|
||||||
function openCertApplyDialog(req: { key: string; title: string }) {
|
function openCertApplyDialog(req: { key: string; title: string }) {
|
||||||
if (req.key === "AddPipeline") {
|
if (req.key === "AddPipeline") {
|
||||||
crudExpose.openAdd({});
|
crudExpose.openAdd({});
|
||||||
@@ -104,7 +112,7 @@ function openCertApplyDialog(req: { key: string; title: string }) {
|
|||||||
|
|
||||||
const searchForm = crudExpose.getSearchValidatedFormData();
|
const searchForm = crudExpose.getSearchValidatedFormData();
|
||||||
const defaultGroupId = searchForm.groupId;
|
const defaultGroupId = searchForm.groupId;
|
||||||
openAddCertdPipelineDialog({ pluginName: req.key, defaultGroupId, title: req.title });
|
openAddCertdPipelineDialog({ pluginName: req.key, defaultGroupId, title: req.title, currentPluginRef });
|
||||||
}
|
}
|
||||||
context.openCertApplyDialog = openCertApplyDialog;
|
context.openCertApplyDialog = openCertApplyDialog;
|
||||||
context.permission = { isProjectPermission: true };
|
context.permission = { isProjectPermission: true };
|
||||||
|
|||||||
-4
@@ -294,13 +294,9 @@ function useStepForm() {
|
|||||||
currentStep.value.input[key] = pluginSysConfig.sysSetting?.input[key];
|
currentStep.value.input[key] = pluginSysConfig.sysSetting?.input[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("currentStepTypeChanged:", currentStep.value);
|
|
||||||
console.log("currentStepPlugin:", currentPlugin.value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const stepSave = async (e: any) => {
|
const stepSave = async (e: any) => {
|
||||||
console.log("currentStepSave", currentStep.value);
|
|
||||||
try {
|
try {
|
||||||
await stepFormRef.value.validate();
|
await stepFormRef.value.validate();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
+7
-3
@@ -1,4 +1,4 @@
|
|||||||
import { IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
import { IsTaskPlugin, Pager, PageSearch, pluginGroups, RunStrategy, TaskInput } from "@certd/pipeline";
|
||||||
import { AliyunAccess } from "../../../../plugin-lib/aliyun/access/index.js";
|
import { AliyunAccess } from "../../../../plugin-lib/aliyun/access/index.js";
|
||||||
import { CertApplyBasePlugin } from "../base.js";
|
import { CertApplyBasePlugin } from "../base.js";
|
||||||
import { CertReader, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
import { CertReader, createRemoteSelectInputDefine } from "@certd/plugin-lib";
|
||||||
@@ -34,8 +34,9 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
|||||||
helper: "订阅模式的证书订单Id",
|
helper: "订阅模式的证书订单Id",
|
||||||
typeName: "CertApplyGetFormAliyun",
|
typeName: "CertApplyGetFormAliyun",
|
||||||
component: {
|
component: {
|
||||||
name: "RemoteAutoComplete",
|
name: "RemoteSelect",
|
||||||
vModel: "value",
|
vModel: "value",
|
||||||
|
pager: true,
|
||||||
},
|
},
|
||||||
action: CertApplyGetFormAliyunPlugin.prototype.onGetOrderList.name,
|
action: CertApplyGetFormAliyunPlugin.prototype.onGetOrderList.name,
|
||||||
})
|
})
|
||||||
@@ -126,6 +127,7 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
|||||||
|
|
||||||
const client = await access.getClient("cas.aliyuncs.com");
|
const client = await access.getClient("cas.aliyuncs.com");
|
||||||
|
|
||||||
|
const pager = new Pager(req)
|
||||||
const res = await client.doRequest({
|
const res = await client.doRequest({
|
||||||
// 接口名称
|
// 接口名称
|
||||||
action: "ListUserCertificateOrder",
|
action: "ListUserCertificateOrder",
|
||||||
@@ -139,12 +141,14 @@ export class CertApplyGetFormAliyunPlugin extends CertApplyBasePlugin {
|
|||||||
data: {
|
data: {
|
||||||
query: {
|
query: {
|
||||||
Status: "ISSUED",
|
Status: "ISSUED",
|
||||||
|
CurrentPage: pager.pageNo,
|
||||||
|
ShowSize : pager.pageSize,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const list = res?.CertificateOrderList || [];
|
const list = res?.CertificateOrderList || [];
|
||||||
if (!list || list.length === 0) {
|
if (!list || list.length === 0) {
|
||||||
throw new Error("没有找到已签发的证书订单");
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.map((item: any) => {
|
return list.map((item: any) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user