perf: 支持批量转移流水线到其他项目

This commit is contained in:
xiaojunnuo
2026-03-15 04:17:40 +08:00
parent f642e42eea
commit 8a3841f638
13 changed files with 283 additions and 36 deletions
@@ -784,7 +784,7 @@ onMounted(async () => {
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px 20px;
padding: 20px 10px;
color: #9ca3af;
}
@@ -110,6 +110,14 @@ export async function BatchUpdateNotificaiton(pipelineIds: number[], notificatio
});
}
export async function BatchUpdateProject(pipelineIds: number[], toProjectId: number): Promise<void> {
return await request({
url: apiPrefix + "/batchTransfer",
method: "post",
data: { ids: pipelineIds, toProjectId: toProjectId },
});
}
export async function BatchDelete(pipelineIds: number[]): Promise<void> {
return await request({
url: apiPrefix + "/batchDelete",
@@ -0,0 +1,64 @@
<template>
<fs-button icon="mdi:format-list-group" class="need-plus" type="link" text="转到其他项目" @click="openProjectSelectDialog"></fs-button>
</template>
<script setup lang="ts">
import * as api from "../api";
import { notification } from "ant-design-vue";
import { dict, useFormWrapper } from "@fast-crud/fast-crud";
import { useSettingStore } from "/@/store/settings";
const props = defineProps<{
selectedRowKeys: any[];
}>();
const emit = defineEmits<{
change: any;
}>();
async function batchUpdateProjectRequest(toProjectId: number) {
await api.BatchUpdateProject(props.selectedRowKeys, toProjectId);
emit("change");
}
const pipelineProjectDictRef = dict({
url: "/enterprise/project/all",
value: "id",
label: "name",
});
const { openCrudFormDialog } = useFormWrapper();
const settingStore = useSettingStore();
async function openProjectSelectDialog() {
settingStore.checkPlus();
const crudOptions: any = {
columns: {
toProjectId: {
title: "转到项目",
type: "dict-select",
dict: pipelineProjectDictRef,
form: {
rules: [{ required: true, message: "请选择项目" }],
},
},
},
form: {
mode: "edit",
//@ts-ignore
async doSubmit({ form }) {
await batchUpdateProjectRequest(form.toProjectId);
},
col: {
span: 22,
},
labelCol: {
style: {
width: "100px",
},
},
wrapper: {
title: "批量转到其他项目",
width: 600,
},
},
} as any;
await openCrudFormDialog({ crudOptions });
}
</script>
@@ -42,6 +42,7 @@
<change-group v-if="hasActionPermission('write')" :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-group>
<change-notification v-if="hasActionPermission('write')" :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-notification>
<change-trigger v-if="hasActionPermission('write')" :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-trigger>
<change-project v-if="hasActionPermission('write')" :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-project>
</div>
</div>
<template #form-bottom>
@@ -57,6 +58,8 @@ import { dict, useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
import ChangeGroup from "./components/change-group.vue";
import ChangeTrigger from "./components/change-trigger.vue";
import ChangeProject from "./components/change-project.vue";
import BatchRerun from "./components/batch-rerun.vue";
import { Modal, notification } from "ant-design-vue";
import * as api from "./api";