提交 2550da90 authored 作者: leon's avatar leon

经销商隐藏新增和批量操作

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