123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <a-card :bordered="false">
- <!-- 查询区域 -->
- <div class="table-page-search-wrapper">
- <a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam">
- <a-row :gutter="24">
- <a-col :xl="6" :lg="7" :md="8" :sm="24">
- <a-form-item name="ip">
- <a-input placeholder="请输入ip" v-model:value="queryParam.ip" allow-clear />
- </a-form-item>
- </a-col>
- <a-col :xl="6" :lg="7" :md="8" :sm="24">
- <a-form-item name="blackOrWhite">
- <a-select allow-clear placeholder="请输入黑白名单" v-model:value="queryParam.blackOrWhite">
- <a-select-option value="0">黑名单</a-select-option>
- <a-select-option value="1">白名单</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :xl="6" :lg="7" :md="8" :sm="24">
- <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
- <a-button type="primary" @click="reload" preIcon="ant-design:search-outlined"> 查询 </a-button>
- <a-button type="primary" @click="searchReset" preIcon="ant-design:reload-outlined" style="margin-left: 8px"> 重置 </a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 查询区域-END -->
- <!-- table区域-begin -->
- <div class="table">
- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
- >项
- <a style="margin-left: 24px" @click="clearSelectedRowKeys">清空</a>
- </div>
- <!--引用表格-->
- <BasicTable @register="registerTable" :rowSelection="rowSelection">
- <!--插槽:table标题-->
- <template #tableTitle>
- <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增 </a-button>
- <a-dropdown v-if="selectedRowKeys.length > 0">
- <template #overlay>
- <a-menu>
- <a-menu-item key="1" @click="batchHandleDelete">
- <Icon icon="ant-design:delete-outlined" />
- 删除
- </a-menu-item>
- </a-menu>
- </template>
- <a-button
- >批量操作
- <Icon icon="mdi:chevron-down" />
- </a-button>
- </a-dropdown>
- </template>
- <!--操作栏-->
- <template #action="{ record }">
- <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
- </template>
- <template #bodyCell="{ column, record, index, text }">
- <template v-if="column.dataIndex === 'blackOrWhite'">
- <span>
- <a-tag v-if="record.blackOrWhite === 0" color="red">黑名单</a-tag>
- <a-tag v-else>白名单</a-tag>
- </span>
- </template>
- <template v-if="column.dataIndex === 'wasteEnquiryNum'">
- <span>
- <span v-if="text === '' || text === null || text === 0">0</span>
- <a v-else @click="wasteNumVisible(record.email)">{{ text }}</a>
- </span>
- </template>
- <template v-if="column.dataIndex === 'action'">
- <span>
- <a @click="handleEdit(record)">编辑</a>
- <a-divider type="vertical" />
- <a-dropdown>
- <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
- <template #overlay>
- <a-menu>
- <a-menu-item>
- <a @click="handleDetail(record)">详情</a>
- </a-menu-item>
- <a-menu-item>
- <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
- <a>删除</a>
- </a-popconfirm>
- </a-menu-item>
- </a-menu>
- </template>
- </a-dropdown>
- </span>
- </template>
- </template>
- </BasicTable>
- </div>
- <adweb-black-ip-modal ref="modalFormRef" @ok="reload" />
- <xp-recycle-bin-modal ref="XpRecycleBinModalRef" @ok="getTableAndNum" />
- </a-card>
- </template>
- <script lang="ts" name="AdwebBlackIpList" setup>
- import '/@/assets/less/common.less';
- import '/@/assets/less/TableExpand.less';
- import AdwebBlackIpModal from './modules/AdwebBlackIpModal.vue';
- import XpRecycleBinModal from './modules/XpRecycleBinModal.vue';
- import { nextTick, onMounted, reactive, ref } from 'vue';
- import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './publicBlackIP.api';
- import { columns } from './publicBlackIP.data';
- import { BasicTable, TableAction } from '@/components/Table';
- import { useListPage } from '@/hooks/system/useListPage';
- import { useCommonList } from '@/hooks/component/JeecgList';
- const description = ref('IP黑名单管理页面');
- const dictOptions = reactive({});
- const formRef = ref();
- let queryParam = reactive<any>({});
- const XpRecycleBinModalRef = ref();
- const modalFormRef = ref();
- let superFieldList = reactive([{ type: '', value: '', text: '', dictCode: '' }]);
- //注册table数据
- const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
- tableProps: {
- title: '公共邮箱黑名单',
- api: list,
- columns: columns,
- canResize: false,
- useSearchForm: false,
- actionColumn: {
- width: 180,
- fixed: 'right',
- },
- striped: true,
- bordered: false,
- beforeFetch: (params) => {
- return Object.assign(params, queryParam);
- },
- },
- exportConfig: {
- name: '询盘列表',
- url: getExportUrl,
- params: queryParam,
- },
- importConfig: {
- url: getImportUrl,
- success: handleSuccess,
- },
- });
- const [
- registerTable,
- { reload, clearSelectedRowKeys, updateTableDataRecord, findTableDataRecord, getDataSource },
- { rowSelection, selectedRowKeys },
- ] = tableContext;
- const { handleEdit, getTableAction, batchHandleDelete, handleDetail, getDropDownAction, handleDelete, handleAdd, searchQuery, searchReset } =
- useCommonList({ tableContext, modalFormRef, formRef, batchDelete, deleteOne });
- onMounted(() => {
- getSuperFieldList();
- });
- function getSuperFieldList() {
- superFieldList.push({ type: 'int', value: 'status', text: '状态', dictCode: '' });
- superFieldList.push({ type: 'string', value: 'ip', text: 'ip', dictCode: '' });
- superFieldList.push({ type: 'int', value: 'blackOrWhite', text: '黑白名单', dictCode: '' });
- }
- async function wasteNumVisible(ip) {
- await nextTick();
- XpRecycleBinModalRef.value.init(ip);
- }
- function getTableAndNum() {
- // 设置默认站点
- let siteId = queryParam.siteId;
- let siteList = siteList;
- for (let site of siteList) {
- if (site.id === siteId) {
- localStorage.setItem('siteCode', site.code);
- }
- }
- reload();
- }
- /**
- * 成功回调
- */
- function handleSuccess() {
- (selectedRowKeys.value = []) && reload();
- }
- </script>
|