index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div class="layout-padding">
  3. <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="handleClick">
  4. <el-tab-pane :label="t('marketingConfig.ipList')" name="first" class="layout-padding-auto layout-padding-view">
  5. <Title :title="t('marketingConfig.ipList')" />
  6. <div class="p-4 rounded">
  7. <el-button type="primary" @click="onAddClick">{{ t('marketingConfig.addIpList') }}</el-button>
  8. <JCollapse
  9. @update="(item) => console.log(item)"
  10. @delete="(item) => console.log(item)"
  11. :data="data"
  12. :deleteText="t('marketingConfig.deleteListText')"
  13. :updateText="t('marketingConfig.updateText')"
  14. />
  15. </div>
  16. </el-tab-pane>
  17. <el-tab-pane :label="t('marketingConfig.domainList')" name="second" class="layout-padding-auto layout-padding-view">
  18. <Title class="" :title="t('marketingConfig.domainList')" />
  19. <div class="p-4 rounded">
  20. <el-button type="primary" @click="onAddClick">{{ t('marketingConfig.addDomainList') }}</el-button>
  21. <JCollapse
  22. @update="(item) => console.log(item)"
  23. :data="data"
  24. @delete="(item) => console.log(item)"
  25. :deleteText="t('marketingConfig.deleteListText')"
  26. :updateText="t('marketingConfig.updateText')"
  27. />
  28. </div>
  29. </el-tab-pane>
  30. <el-tab-pane :label="t('marketingConfig.disposition')" name="third" class="layout-padding-auto layout-padding-view">
  31. <Title class="" :title="t('marketingConfig.disposition')" />
  32. <div class="p-4 rounded">
  33. <JCollapse
  34. :data="[{title: 'IP集合',id: '1',}]"
  35. @update="(item) => console.log(item)"
  36. @delete="(item) => closeIpTags = !closeIpTags"
  37. :deleteText="t('marketingConfig.deleteText')"
  38. :updateText="t('marketingConfig.updateText')"
  39. >
  40. <template #default>
  41. <div class="border-b p-2 items-center flex flex-wrap">
  42. <span class="mr-2">白名单</span>
  43. <el-popover v-for="item in data" :key="item.id" width="200" trigger="hover" placement="top">
  44. <div class="flex flex-wrap">
  45. <span v-for="ip in item.ips" :key="ip" class="ml-2">
  46. {{ ip }}
  47. </span>
  48. </div>
  49. <template #reference>
  50. <el-tag effect="light" color="#f4f4f4" :closable="closeIpTags" round class="ml-1 cursor-pointer">
  51. {{ item.title }}
  52. </el-tag>
  53. </template>
  54. </el-popover>
  55. </div>
  56. <div class="p-2 items-center flex flex-wrap">
  57. <span class="mr-2">黑名单</span>
  58. <el-popover v-for="item in data" :key="item.id" width="200" trigger="hover" placement="top">
  59. <div class="flex flex-wrap">
  60. <span v-for="ip in item.ips" :key="ip" class="ml-2">
  61. {{ ip }}
  62. </span>
  63. </div>
  64. <template #reference>
  65. <el-tag effect="light" color="#f4f4f4" :closable="closeIpTags" round class="ml-1 cursor-pointer">
  66. {{ item.title }}
  67. </el-tag>
  68. </template>
  69. </el-popover>
  70. </div>
  71. </template>
  72. </JCollapse>
  73. <JCollapse
  74. class="mt-4"
  75. :data="[
  76. {
  77. title: '域名集合',
  78. id: '1',
  79. },
  80. ]"
  81. @update="(item) => domainEditOpen = true"
  82. @delete="(item) => closeDomainTags = !closeDomainTags"
  83. :deleteText="closeTags ? t('marketingConfig.cancel') : t('marketingConfig.deleteDomain')"
  84. :updateText="t('marketingConfig.addDomain')"
  85. >
  86. <template #default>
  87. <div class="border-b p-2 items-center flex flex-wrap">
  88. <el-tag v-for="item in whiteList" :key="item" effect="light" :closable="closeDomainTags" color="#f4f4f4" round class="ml-1 cursor-pointer">
  89. {{ item.label }}
  90. </el-tag>
  91. </div>
  92. </template>
  93. </JCollapse>
  94. </div>
  95. </el-tab-pane>
  96. </el-tabs>
  97. <DomainEdit v-model:open="domainEditOpen" />
  98. </div>
  99. </template>
  100. <script lang="ts" name="marketingConfig" setup>
  101. import { delObj, pageList, update } from '/@/api/marketing/config';
  102. import { BasicTableProps, useTable } from '/@/hooks/table';
  103. import { useI18n } from 'vue-i18n';
  104. // 引入组件
  105. const JCollapse = defineAsyncComponent(() => import('/@/components/JCollapse/index.vue'));
  106. const Title = defineAsyncComponent(() => import('/@/components/Title/index.vue'));
  107. const DomainEdit = defineAsyncComponent(() => import('./components/domainEdit.vue'));
  108. const { t } = useI18n();
  109. // 定义变量内容
  110. const activeName = ref('first');
  111. const closeDomainTags = ref(false);
  112. const closeIpTags = ref(false);
  113. const domainEditOpen = ref(false);
  114. const data = ref([
  115. {
  116. title: '分组1',
  117. id: '1',
  118. ips: ['192.168.1.1', '192.168.1.2', '192.168.1.3', '192.168.1.4'],
  119. },
  120. {
  121. title: '分组2',
  122. id: '2',
  123. ips: ['192.168.1.1', '192.168.1.2', '192.168.1.3', '192.168.1.4'],
  124. },
  125. {
  126. title: '分组3',
  127. id: '3',
  128. ips: ['192.168.1.1', '192.168.1.2', '192.168.1.3', '192.168.1.4'],
  129. },
  130. ]);
  131. const whiteList = ref([{ label: '站大' }, { label: '站而' }, { label: '站撒' }, { label: '站爱' }]);
  132. const menuDialogRef = ref();
  133. const state: BasicTableProps = reactive<BasicTableProps>({
  134. pageList: pageList, // H
  135. queryForm: {
  136. domain: '',
  137. },
  138. });
  139. const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state);
  140. // 打开编辑菜单弹窗
  141. const onOpenEditMenu = (type: string, row: any) => {
  142. menuDialogRef.value.openDialog(type, row);
  143. };
  144. // 删除操作
  145. const handleDelete = async (ids: string[]) => {};
  146. </script>
  147. <style lang="scss">
  148. .is-top {
  149. margin-bottom: 0 !important;
  150. }
  151. .el-collapse-item__content {
  152. padding-bottom: 0 !important;
  153. }
  154. </style>