Commit 46b742d3 authored by baiyinhao's avatar baiyinhao

审计日志 假数据删除和批量删除功能

parent 8d477263
...@@ -17,6 +17,16 @@ ...@@ -17,6 +17,16 @@
// label: '编22222222222辑', // label: '编22222222222辑',
onClick: handleEdit.bind(null, record), onClick: handleEdit.bind(null, record),
}, },
{
icon: 'ant-design:delete-outlined',
// label: '删2222222222222222除',
color: 'error',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleDelete.bind(null, record),
},
},
]" ]"
/> />
</template> </template>
...@@ -91,10 +101,12 @@ ...@@ -91,10 +101,12 @@
const filterStore = useFilterStore(); const filterStore = useFilterStore();
const route = useRoute(); const route = useRoute();
const { createMessage } = useMessage(); const { createMessage } = useMessage();
const tableData = ref([]);
const tableDatatab2 = ref([]);
const [registerDrawer, { openDrawer }] = useDrawer(); const [registerDrawer, { openDrawer }] = useDrawer();
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const [registerModalEmail, { openModal: openModalEmail }] = useModal(); const [registerModalEmail, { openModal: openModalEmail }] = useModal();
const [registerTable, { reload, getForm }] = useTable({ const [registerTable, { reload, getForm, getRowSelection }] = useTable({
title: '审计日志', title: '审计日志',
api: async (params) => { api: async (params) => {
console.log('params', params); console.log('params', params);
...@@ -129,7 +141,10 @@ ...@@ -129,7 +141,10 @@
fixed: undefined, fixed: undefined,
}, },
}); });
const [registerTable2, { reload: reload2, getForm: getForm2 }] = useTable({ const [
registerTable2,
{ reload: reload2, getForm: getForm2, getRowSelection: getRowSelection2 },
] = useTable({
title: '通知规则名称', title: '通知规则名称',
api: async (params) => { api: async (params) => {
console.log('params', params); console.log('params', params);
...@@ -208,18 +223,50 @@ ...@@ -208,18 +223,50 @@
}); });
} }
/**删除按钮*/ /** 删除按钮*/
async function handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
await deleteById(record.businessId); tableData.value.splice(
tableData.value.findIndex((item) => item.businessId === record.businessId),
1,
);
createMessage.success('删除成功!'); createMessage.success('删除成功!');
await reload(); reload();
} }
/**tab2删除按钮*/ /**tab2删除按钮*/
async function handleDeletetab2(record: Recordable) {
await deleteById(record.businessId); function handleDeletetab2(record: Recordable) {
tableDatatab2.value.splice(
tableDatatab2.value.findIndex((item) => item.businessId === record.businessId),
1,
);
createMessage.success('删除成功!'); createMessage.success('删除成功!');
await reload2(); reload2();
}
/**批量删除*/
function handleDeleteBatch() {
const rowSelection = getRowSelection().selectedRowKeys;
for (let i = 0; i < rowSelection.length; i++) {
tableData.value.splice(
tableData.value.findIndex((item) => item.businessId === rowSelection[i]),
1,
);
}
createMessage.success('删除成功!');
reload();
}
/**批量删除tab2*/
function handleDeleteBatch2() {
const rowSelection = getRowSelection2().selectedRowKeys;
for (let i = 0; i < rowSelection.length; i++) {
tableDatatab2.value.splice(
tableDatatab2.value.findIndex((item) => item.businessId === rowSelection[i]),
1,
);
}
createMessage.success('删除成功!');
reload2();
} }
function handleSuccess() { function handleSuccess() {
...@@ -231,6 +278,7 @@ ...@@ -231,6 +278,7 @@
/**进入页面的初始化方法 getForm2是给tab2用的*/ /**进入页面的初始化方法 getForm2是给tab2用的*/
onMounted(() => { onMounted(() => {
tableData.value = tableListtab1;
const path = route.path; const path = route.path;
if (filterStore.getSearchParams[path]) { if (filterStore.getSearchParams[path]) {
if (JSON.parse(filterStore.getSearchParams[path] !== {})) { if (JSON.parse(filterStore.getSearchParams[path] !== {})) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment