mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-02-04 09:35:20 +08:00
3.7.1版本发布
This commit is contained in:
@ -1,6 +1,27 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" title="字典回收站" :showOkBtn="false" width="1000px" destroyOnClose>
|
||||
<BasicTable @register="registerTable">
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-dropdown v-if="checkedKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||
批量删除
|
||||
</a-menu-item>
|
||||
<a-menu-item key="2" @click="batchHandleRevert">
|
||||
<Icon icon="ant-design:redo-outlined"></Icon>
|
||||
批量取回
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button
|
||||
>批量操作
|
||||
<Icon icon="ant-design:down-outlined"></Icon>
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
@ -13,13 +34,16 @@
|
||||
import { BasicModal, useModalInner } from '/src/components/Modal';
|
||||
import { BasicTable, useTable, TableAction } from '/src/components/Table';
|
||||
import { recycleBincolumns } from '../dict.data';
|
||||
import { getRecycleBinList, putRecycleBin, deleteRecycleBin } from '../dict.api';
|
||||
import { getRecycleBinList, putRecycleBin, deleteRecycleBin, batchPutRecycleBin, batchDeleteRecycleBin } from '../dict.api';
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
const checkedKeys = ref<Array<string | number>>([]);
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner();
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
checkedKeys.value = [];
|
||||
});
|
||||
//注册table数据
|
||||
const [registerTable, { reload }] = useTable({
|
||||
rowKey: 'id',
|
||||
api: getRecycleBinList,
|
||||
columns: recycleBincolumns,
|
||||
striped: true,
|
||||
@ -39,7 +63,23 @@
|
||||
fixed: undefined,
|
||||
},
|
||||
});
|
||||
|
||||
// update-begin--author:liaozhiyang---date:20240709---for:【TV360X-1663】数据字典回收增加批量功能
|
||||
/**
|
||||
* 选择列配置
|
||||
*/
|
||||
const rowSelection = {
|
||||
type: 'checkbox',
|
||||
columnWidth: 50,
|
||||
selectedRowKeys: checkedKeys,
|
||||
onChange: onSelectChange,
|
||||
};
|
||||
/**
|
||||
* 选择事件
|
||||
*/
|
||||
function onSelectChange(selectedRowKeys: (string | number)[]) {
|
||||
checkedKeys.value = selectedRowKeys;
|
||||
}
|
||||
// update-end--author:liaozhiyang---date:20240709---for:【TV360X-1663】数据字典回收增加批量功能
|
||||
/**
|
||||
* 还原事件
|
||||
*/
|
||||
@ -57,13 +97,24 @@
|
||||
* 批量还原事件
|
||||
*/
|
||||
function batchHandleRevert() {
|
||||
handleRevert({ id: toRaw(checkedKeys.value).join(',') });
|
||||
batchPutRecycleBin({ ids: toRaw(checkedKeys.value).join(',') }, () => {
|
||||
// update-begin--author:liaozhiyang---date:20240709---for:【TV360X-1663】数据字典回收增加批量功能
|
||||
reload();
|
||||
checkedKeys.value = [];
|
||||
emit('success');
|
||||
// update-end--author:liaozhiyang---date:20240709---for:【TV360X-1663】数据字典回收增加批量功能
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 批量删除事件
|
||||
*/
|
||||
function batchHandleDelete() {
|
||||
handleDelete({ id: toRaw(checkedKeys.value).join(',') });
|
||||
batchDeleteRecycleBin({ ids: toRaw(checkedKeys.value).join(',') }, () => {
|
||||
// update-begin--author:liaozhiyang---date:20240709---for:【TV360X-1663】数据字典回收增加批量功能
|
||||
checkedKeys.value = [];
|
||||
reload();
|
||||
// update-end--author:liaozhiyang---date:20240709---for:【TV360X-1663】数据字典回收增加批量功能
|
||||
});
|
||||
}
|
||||
//获取操作栏事件
|
||||
function getTableAction(record) {
|
||||
|
||||
@ -11,6 +11,8 @@ enum Api {
|
||||
exportXls = '/sys/dict/exportXls',
|
||||
recycleBinList = '/sys/dict/deleteList',
|
||||
putRecycleBin = '/sys/dict/back',
|
||||
batchPutRecycleBin = '/sys/dict/putRecycleBin',
|
||||
batchDeleteRecycleBin = '/sys/dict/deleteRecycleBin',
|
||||
deleteRecycleBin = '/sys/dict/deletePhysic',
|
||||
itemList = '/sys/dictItem/list',
|
||||
deleteItem = '/sys/dictItem/delete',
|
||||
@ -78,6 +80,16 @@ export const duplicateCheck = (params) => defHttp.get({ url: Api.duplicateCheck,
|
||||
* @param params
|
||||
*/
|
||||
export const getRecycleBinList = (params) => defHttp.get({ url: Api.recycleBinList, params });
|
||||
|
||||
/**
|
||||
* 回收站批量还原
|
||||
* @param params
|
||||
*/
|
||||
export const batchPutRecycleBin = (params, handleSuccess) => {
|
||||
return defHttp.put({ url: Api.batchPutRecycleBin, params}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 回收站还原
|
||||
* @param params
|
||||
@ -87,6 +99,15 @@ export const putRecycleBin = (id, handleSuccess) => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 回收站批量删除
|
||||
* @param params
|
||||
*/
|
||||
export const batchDeleteRecycleBin = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: `${Api.batchDeleteRecycleBin}?ids=${params.ids}`}).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 回收站删除
|
||||
* @param params
|
||||
|
||||
@ -44,13 +44,13 @@ export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '字典名称',
|
||||
field: 'dictName',
|
||||
component: 'Input',
|
||||
component: 'JInput',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '字典编码',
|
||||
field: 'dictCode',
|
||||
component: 'Input',
|
||||
component: 'JInput',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
});
|
||||
|
||||
//注册table数据
|
||||
const [registerTable, { reload, updateTableDataRecord }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, updateTableDataRecord }, { rowSelection, selectedRowKeys, selectedRows }] = tableContext;
|
||||
|
||||
/**
|
||||
* 新增事件
|
||||
@ -127,7 +127,13 @@
|
||||
* 批量删除事件
|
||||
*/
|
||||
async function batchHandleDelete() {
|
||||
await batchDeleteDict({ ids: selectedRowKeys.value }, reload);
|
||||
await batchDeleteDict({ ids: selectedRowKeys.value }, () => {
|
||||
// update-begin--author:liaozhiyang---date:20240701---for:【TV360X-1665】数据字典批量删除后选中也清空
|
||||
reload();
|
||||
selectedRowKeys.value = [];
|
||||
selectedRows.value = [];
|
||||
// update-end--author:liaozhiyang---date:20240701---for:【TV360X-1665】数据字典批量删除后选中也清空
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 成功回调
|
||||
|
||||
Reference in New Issue
Block a user