mirror of https://github.com/certd/certd
perf: 证书监控增加批量删除
parent
5ff4e3c4ea
commit
e578c52fdf
|
|
@ -1,5 +1,8 @@
|
||||||
{
|
{
|
||||||
"eslint.debug": false,
|
"eslint.debug": false,
|
||||||
"eslint.format.enable": true,
|
"eslint.format.enable": true,
|
||||||
"typescript.tsc.autoDetect": "watch"
|
"typescript.tsc.autoDetect": "watch",
|
||||||
|
"git.scanRepositories": [
|
||||||
|
"./packages/pro"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -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) {
|
async GetObj(id: number) {
|
||||||
return await request({
|
return await request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { AddReq, ColumnCompositionProps, compute, CreateCrudOptionsProps, Create
|
||||||
import { siteInfoApi } from "./api";
|
import { siteInfoApi } from "./api";
|
||||||
import * as settingApi from "./setting/api";
|
import * as settingApi from "./setting/api";
|
||||||
import dayjs from "dayjs";
|
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 { useSettingStore } from "/@/store/settings";
|
||||||
import { mySuiteApi } from "/@/views/certd/suite/mine/api";
|
import { mySuiteApi } from "/@/views/certd/suite/mine/api";
|
||||||
import { mitter } from "/@/utils/util.mitt";
|
import { mitter } from "/@/utils/util.mitt";
|
||||||
|
|
@ -57,6 +57,27 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
}
|
}
|
||||||
loadSetting();
|
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() {
|
function checkAll() {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: t("certd.monitor.confirmTitle"), // "确认"
|
title: t("certd.monitor.confirmTitle"), // "确认"
|
||||||
|
|
@ -79,6 +100,21 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
editRequest,
|
editRequest,
|
||||||
delRequest,
|
delRequest,
|
||||||
},
|
},
|
||||||
|
settings: {
|
||||||
|
plugins: {
|
||||||
|
//这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
|
||||||
|
rowSelection: {
|
||||||
|
enabled: true,
|
||||||
|
props: {
|
||||||
|
multiple: true,
|
||||||
|
crossPage: false,
|
||||||
|
selectedRowKeys: () => {
|
||||||
|
return selectedRowKeys;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
form: {
|
form: {
|
||||||
labelCol: {
|
labelCol: {
|
||||||
//固定label宽度
|
//固定label宽度
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</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>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -26,12 +32,14 @@ import createCrudOptions from "./crud";
|
||||||
import { siteInfoApi } from "./api";
|
import { siteInfoApi } from "./api";
|
||||||
import { Modal, notification } from "ant-design-vue";
|
import { Modal, notification } from "ant-design-vue";
|
||||||
import { useI18n } from "/src/locales";
|
import { useI18n } from "/src/locales";
|
||||||
|
import * as api from "./api";
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "SiteCertMonitor",
|
name: "SiteCertMonitor",
|
||||||
});
|
});
|
||||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} });
|
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
|
||||||
|
|
||||||
|
const handleBatchDelete = context.handleBatchDelete;
|
||||||
|
|
||||||
// 页面打开后获取列表数据
|
// 页面打开后获取列表数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,14 @@ export class SiteInfoController extends CrudController<SiteInfoService> {
|
||||||
return await super.delete(id);
|
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 })
|
@Post('/check', { summary: Constants.per.authOnly })
|
||||||
async check(@Body('id') id: number) {
|
async check(@Body('id') id: number) {
|
||||||
await this.service.checkUserId(id, this.getUserId());
|
await this.service.checkUserId(id, this.getUserId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue