feat: 网元软件包勾选删除记录

This commit is contained in:
TsMask
2024-04-25 14:17:59 +08:00
parent b3cb40fd8c
commit 5965737384

View File

@@ -63,6 +63,8 @@ type TabeStateType = {
seached: boolean;
/**记录数据 */
data: object[];
/**勾选记录 */
selectedRowKeys: (string | number)[];
};
/**表格状态 */
@@ -71,6 +73,7 @@ let tableState: TabeStateType = reactive({
size: 'middle',
seached: false,
data: [],
selectedRowKeys: [],
});
/**表格字段列 */
@@ -162,6 +165,11 @@ function fnTableSize({ key }: MenuInfo) {
tableState.size = key as SizeType;
}
/**表格多选 */
function fnTableSelectedRowKeys(keys: (string | number)[]) {
tableState.selectedRowKeys = keys;
}
/**查询列表, pageNum初始页数 */
function fnGetList(pageNum?: number) {
if (tableState.loading) return;
@@ -242,9 +250,16 @@ function fnModalEditCancel() {
/**删除软件包 */
function fnRecordDelete(id: string) {
if (!id || modalState.confirmLoading) return;
let msg = 'Removing software packages?';
if (id === '0') {
msg = `${msg} select ${tableState.selectedRowKeys.length}`;
id = tableState.selectedRowKeys.join(',');
}
Modal.confirm({
title: t('common.tipTitle'),
content: 'Removing software packages?',
content: msg,
onOk() {
if (modalState.confirmLoading) return;
modalState.confirmLoading = true;
@@ -408,6 +423,16 @@ onMounted(() => {
<template #icon><PlusOutlined /></template>
More File Upload
</a-button>
<a-button
type="default"
danger
:disabled="tableState.selectedRowKeys.length <= 0"
:loading="modalState.confirmLoading"
@click.prevent="fnRecordDelete('0')"
>
<template #icon><DeleteOutlined /></template>
{{ t('common.deleteText') }}
</a-button>
</a-space>
</template>
@@ -467,6 +492,12 @@ onMounted(() => {
:pagination="tablePagination"
:scroll="{ x: tableColumns.length * 150 }"
@resizeColumn="(w:number, col:any) => (col.width = w)"
:row-selection="{
type: 'checkbox',
columnWidth: '48px',
selectedRowKeys: tableState.selectedRowKeys,
onChange: fnTableSelectedRowKeys,
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'description'">