perf: 证书监控增加批量删除

v2-dev
xiaojunnuo 2025-10-21 00:01:28 +08:00
parent 5ff4e3c4ea
commit e578c52fdf
5 changed files with 68 additions and 5 deletions

View File

@ -1,5 +1,8 @@
{
"eslint.debug": false,
"eslint.format.enable": true,
"typescript.tsc.autoDetect": "watch"
"typescript.tsc.autoDetect": "watch",
"git.scanRepositories": [
"./packages/pro"
]
}

View File

@ -35,6 +35,14 @@ export const siteInfoApi = {
});
},
async BatchDelObj(ids: number[]) {
return await request({
url: apiPrefix + "/batchDelete",
method: "post",
data: { ids },
});
},
async GetObj(id: number) {
return await request({
url: apiPrefix + "/info",

View File

@ -4,7 +4,7 @@ import { AddReq, ColumnCompositionProps, compute, CreateCrudOptionsProps, Create
import { siteInfoApi } from "./api";
import * as settingApi from "./setting/api";
import dayjs from "dayjs";
import { Modal, notification } from "ant-design-vue";
import { message, Modal, notification } from "ant-design-vue";
import { useSettingStore } from "/@/store/settings";
import { mySuiteApi } from "/@/views/certd/suite/mine/api";
import { mitter } from "/@/utils/util.mitt";
@ -57,6 +57,27 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}
loadSetting();
const selectedRowKeys = ref([]);
const handleBatchDelete = () => {
if (selectedRowKeys.value?.length > 0) {
Modal.confirm({
title: "确认",
content: `确定要批量删除这${selectedRowKeys.value.length}条记录吗`,
async onOk() {
await api.BatchDelObj(selectedRowKeys.value);
message.info("删除成功");
crudExpose.doRefresh();
selectedRowKeys.value = [];
},
});
} else {
message.error("请先勾选记录");
}
};
context.handleBatchDelete = handleBatchDelete;
function checkAll() {
Modal.confirm({
title: t("certd.monitor.confirmTitle"), // "确认"
@ -79,6 +100,21 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
editRequest,
delRequest,
},
settings: {
plugins: {
//这里使用行选择插件生成行选择crudOptions配置最终会与crudOptions合并
rowSelection: {
enabled: true,
props: {
multiple: true,
crossPage: false,
selectedRowKeys: () => {
return selectedRowKeys;
},
},
},
},
},
form: {
labelCol: {
//固定label宽度

View File

@ -15,7 +15,13 @@
</div>
</div>
</template>
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
<fs-crud ref="crudRef" v-bind="crudBinding">
<template #pagination-left>
<a-tooltip title="批量删除">
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
</a-tooltip>
</template>
</fs-crud>
</fs-page>
</template>
@ -26,12 +32,14 @@ import createCrudOptions from "./crud";
import { siteInfoApi } from "./api";
import { Modal, notification } from "ant-design-vue";
import { useI18n } from "/src/locales";
import * as api from "./api";
const { t } = useI18n();
defineOptions({
name: "SiteCertMonitor",
});
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
const handleBatchDelete = context.handleBatchDelete;
//
onMounted(() => {

View File

@ -92,6 +92,14 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
return await super.delete(id);
}
@Post('/batchDelete', { summary: Constants.per.authOnly })
async batchDelete(@Body(ALL) body: any) {
const userId = this.getUserId();
await this.service.batchDelete(body.ids,userId);
return this.ok();
}
@Post('/check', { summary: Constants.per.authOnly })
async check(@Body('id') id: number) {
await this.service.checkUserId(id, this.getUserId());