AdwebBlackIpList.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item name="ip">
  9. <a-input placeholder="请输入ip" v-model:value="queryParam.ip" allow-clear />
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <a-form-item name="blackOrWhite">
  14. <a-select allow-clear placeholder="请输入黑白名单" v-model:value="queryParam.blackOrWhite">
  15. <a-select-option value="0">黑名单</a-select-option>
  16. <a-select-option value="1">白名单</a-select-option>
  17. </a-select>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  21. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  22. <a-button type="primary" @click="reload" preIcon="ant-design:search-outlined"> 查询 </a-button>
  23. <a-button type="primary" @click="searchReset" preIcon="ant-design:reload-outlined" style="margin-left: 8px"> 重置 </a-button>
  24. </span>
  25. </a-col>
  26. </a-row>
  27. </a-form>
  28. </div>
  29. <!-- 查询区域-END -->
  30. <!-- table区域-begin -->
  31. <div class="table">
  32. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
  33. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
  34. >项
  35. <a style="margin-left: 24px" @click="clearSelectedRowKeys">清空</a>
  36. </div>
  37. <!--引用表格-->
  38. <BasicTable @register="registerTable" :rowSelection="rowSelection">
  39. <!--插槽:table标题-->
  40. <template #tableTitle>
  41. <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增 </a-button>
  42. <a-dropdown v-if="selectedRowKeys.length > 0">
  43. <template #overlay>
  44. <a-menu>
  45. <a-menu-item key="1" @click="batchHandleDelete">
  46. <Icon icon="ant-design:delete-outlined" />
  47. 删除
  48. </a-menu-item>
  49. </a-menu>
  50. </template>
  51. <a-button
  52. >批量操作
  53. <Icon icon="mdi:chevron-down" />
  54. </a-button>
  55. </a-dropdown>
  56. </template>
  57. <!--操作栏-->
  58. <template #action="{ record }">
  59. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  60. </template>
  61. <template #bodyCell="{ column, record, index, text }">
  62. <template v-if="column.dataIndex === 'blackOrWhite'">
  63. <span>
  64. <a-tag v-if="record.blackOrWhite === 0" color="red">黑名单</a-tag>
  65. <a-tag v-else>白名单</a-tag>
  66. </span>
  67. </template>
  68. <template v-if="column.dataIndex === 'wasteEnquiryNum'">
  69. <span>
  70. <span v-if="text === '' || text === null || text === 0">0</span>
  71. <a v-else @click="wasteNumVisible(record.email)">{{ text }}</a>
  72. </span>
  73. </template>
  74. <template v-if="column.dataIndex === 'action'">
  75. <span>
  76. <a @click="handleEdit(record)">编辑</a>
  77. <a-divider type="vertical" />
  78. <a-dropdown>
  79. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  80. <template #overlay>
  81. <a-menu>
  82. <a-menu-item>
  83. <a @click="handleDetail(record)">详情</a>
  84. </a-menu-item>
  85. <a-menu-item>
  86. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  87. <a>删除</a>
  88. </a-popconfirm>
  89. </a-menu-item>
  90. </a-menu>
  91. </template>
  92. </a-dropdown>
  93. </span>
  94. </template>
  95. </template>
  96. </BasicTable>
  97. </div>
  98. <adweb-black-ip-modal ref="modalFormRef" @ok="reload" />
  99. <xp-recycle-bin-modal ref="XpRecycleBinModalRef" @ok="getTableAndNum" />
  100. </a-card>
  101. </template>
  102. <script lang="ts" name="AdwebBlackIpList" setup>
  103. import '/@/assets/less/common.less';
  104. import '/@/assets/less/TableExpand.less';
  105. import AdwebBlackIpModal from './modules/AdwebBlackIpModal.vue';
  106. import XpRecycleBinModal from './modules/XpRecycleBinModal.vue';
  107. import { nextTick, onMounted, reactive, ref } from 'vue';
  108. import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './publicBlackIP.api';
  109. import { columns } from './publicBlackIP.data';
  110. import { BasicTable, TableAction } from '@/components/Table';
  111. import { useListPage } from '@/hooks/system/useListPage';
  112. import { useCommonList } from '@/hooks/component/JeecgList';
  113. const description = ref('IP黑名单管理页面');
  114. const dictOptions = reactive({});
  115. const formRef = ref();
  116. let queryParam = reactive<any>({});
  117. const XpRecycleBinModalRef = ref();
  118. const modalFormRef = ref();
  119. let superFieldList = reactive([{ type: '', value: '', text: '', dictCode: '' }]);
  120. //注册table数据
  121. const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
  122. tableProps: {
  123. title: '公共邮箱黑名单',
  124. api: list,
  125. columns: columns,
  126. canResize: false,
  127. useSearchForm: false,
  128. actionColumn: {
  129. width: 180,
  130. fixed: 'right',
  131. },
  132. striped: true,
  133. bordered: false,
  134. beforeFetch: (params) => {
  135. return Object.assign(params, queryParam);
  136. },
  137. },
  138. exportConfig: {
  139. name: '询盘列表',
  140. url: getExportUrl,
  141. params: queryParam,
  142. },
  143. importConfig: {
  144. url: getImportUrl,
  145. success: handleSuccess,
  146. },
  147. });
  148. const [
  149. registerTable,
  150. { reload, clearSelectedRowKeys, updateTableDataRecord, findTableDataRecord, getDataSource },
  151. { rowSelection, selectedRowKeys },
  152. ] = tableContext;
  153. const { handleEdit, getTableAction, batchHandleDelete, handleDetail, getDropDownAction, handleDelete, handleAdd, searchQuery, searchReset } =
  154. useCommonList({ tableContext, modalFormRef, formRef, batchDelete, deleteOne });
  155. onMounted(() => {
  156. getSuperFieldList();
  157. });
  158. function getSuperFieldList() {
  159. superFieldList.push({ type: 'int', value: 'status', text: '状态', dictCode: '' });
  160. superFieldList.push({ type: 'string', value: 'ip', text: 'ip', dictCode: '' });
  161. superFieldList.push({ type: 'int', value: 'blackOrWhite', text: '黑白名单', dictCode: '' });
  162. }
  163. async function wasteNumVisible(ip) {
  164. await nextTick();
  165. XpRecycleBinModalRef.value.init(ip);
  166. }
  167. function getTableAndNum() {
  168. // 设置默认站点
  169. let siteId = queryParam.siteId;
  170. let siteList = siteList;
  171. for (let site of siteList) {
  172. if (site.id === siteId) {
  173. localStorage.setItem('siteCode', site.code);
  174. }
  175. }
  176. reload();
  177. }
  178. /**
  179. * 成功回调
  180. */
  181. function handleSuccess() {
  182. (selectedRowKeys.value = []) && reload();
  183. }
  184. </script>