提交 1f1cb249 authored 作者: 袁伟伟's avatar 袁伟伟
<template>
<div>
<BasicTable @register="registerTable">
<template #headerTop>
<a-alert type="info" show-icon>
<template #message>
<template v-if="checkedKeys.length > 0">
<span>已选中{{ checkedKeys.length }}条记录</span>
<a-button type="link" @click="checkedKeys = []" size="small">清空</a-button>
<a-popconfirm
v-auth="'AUTH_SYSTEM_DISTRIBUTOR'"
class="ml-4"
title="确定要全部删除吗?"
ok-text="是"
cancel-text="否"
@confirm="handleBatchDelete"
>
<a href="#" class="text-red-500">删除</a>
</a-popconfirm>
</template>
<template v-else>
<span>未选中任何项目</span>
</template>
</template>
</a-alert>
</template>
<template #toolbar>
<a-button v-auth="'AUTH_SYSTEM_DISTRIBUTOR:ADD'" type="primary" @click="handleCreate"> 新增</a-button>
</template>
<!-- <template #headerTop>-->
<!-- <a-alert type="info" show-icon>-->
<!-- <template #message>-->
<!-- <template v-if="checkedKeys.length > 0">-->
<!-- <span>已选中{{ checkedKeys.length }}条记录</span>-->
<!-- <a-button type="link" @click="checkedKeys = []" size="small">清空</a-button>-->
<!-- <a-popconfirm-->
<!-- v-auth="'AUTH_SYSTEM_DISTRIBUTOR'"-->
<!-- class="ml-4"-->
<!-- title="确定要全部删除吗?"-->
<!-- ok-text="是"-->
<!-- cancel-text="否"-->
<!-- @confirm="handleBatchDelete"-->
<!-- >-->
<!-- <a href="#" class="text-red-500">删除</a>-->
<!-- </a-popconfirm>-->
<!-- </template>-->
<!-- <template v-else>-->
<!-- <span>未选中任何项目</span>-->
<!-- </template>-->
<!-- </template>-->
<!-- </a-alert>-->
<!-- </template>-->
<!-- <template #toolbar>-->
<!-- <a-button v-auth="'AUTH_SYSTEM_DISTRIBUTOR:ADD'" type="primary" @click="handleCreate"> 新增</a-button>-->
<!-- </template>-->
<template #bodyCell="{ column, record, text }">
<template v-if="[&#39;licensePic&#39;].includes(column.dataIndex)">
<img :src="text" class="photo" alt="图片" v-if="!!text" />
......@@ -79,20 +79,15 @@
const { hasPermission } = usePermission();
const go = useGo();
const {
formConfig,
showTableSetting,
bordered,
showIndexColumn,
} = componentSetting.table;
const { formConfig, showTableSetting, bordered, showIndexColumn } = componentSetting.table;
const checkedKeys = ref<Array<string | number>>([]);
const onSelectChange = (selectedRowKeys: (string | number)[]) => {
checkedKeys.value = selectedRowKeys;
}
};
const [registerDrawer, { openDrawer }] = useDrawer();
const [registerTable, { reload ,setLoading}] = useTable({
const [registerTable, { reload, setLoading }] = useTable({
title: '经销商表',
api: (params) => DistributorApi.search(handleParams(params)),
columns,
......@@ -160,18 +155,22 @@
const handleDelete = (record: Recordable) => {
setLoading(true);
DistributorApi.remove(record.id).then((_) => {
DistributorApi.remove(record.id)
.then((_) => {
reload();
}).catch(() => {
})
.catch(() => {
setLoading(false);
});
};
const handleBatchDelete = () => {
setLoading(true);
DistributorApi.batchRemove(checkedKeys.value).then((_) => {
DistributorApi.batchRemove(checkedKeys.value)
.then((_) => {
reload();
}).catch(() => {
})
.catch(() => {
setLoading(false);
});
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论