index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <el-tabs type="card" v-model="activeTab" style="height: 100%">
  3. <el-tab-pane
  4. v-for="tab in tabs"
  5. :key="tab.key"
  6. :label="tab.label"
  7. :name="tab.key"
  8. >
  9. <div class="sensitive-words flex">
  10. <TreeSelect class="mr20"></TreeSelect>
  11. <div class="table-box">
  12. <pageSearch
  13. ref="searchTableRef"
  14. :searchConfig="activeTab === 'industry' ? searchConfig : searchNonIndustryConfig"
  15. />
  16. <pageContent
  17. ref="tableListRef"
  18. :total="total"
  19. :contentConfig="activeTab === 'industry' ? contentConfig : contentNonIndustryConfig" :pageList="tableData"
  20. >
  21. <template #button>
  22. <el-button type="primary" @click="onImport()">导入</el-button>
  23. <el-button type="primary" @click="onImport()">下载模版</el-button>
  24. <el-button type="primary" @click="onAdd()">新增</el-button>
  25. <el-button type="primary" @click="onExport()">导出</el-button>
  26. </template>
  27. <template #operate="scope">
  28. <el-button type="primary" link @click="handleEdit(scope.row.rentalCompanyId)">
  29. 编辑
  30. </el-button>
  31. <el-button type="primary" link @click="handleCheck(scope.row.rentalCompanyId)">
  32. 查看
  33. </el-button>
  34. <el-button type="primary" link @click="onDelete(scope.row.rentalCompanyId)">
  35. 删除
  36. </el-button>
  37. </template>
  38. </pageContent>
  39. </div>
  40. </div>
  41. </el-tab-pane>
  42. </el-tabs>
  43. <pageDetail
  44. :modalConfig="activeTab === 'industry' ? detailConfig : detailNonIndustryConfig"
  45. ref="modalRef">
  46. </pageDetail>
  47. </template>
  48. <script setup lang="ts">
  49. import contentConfig from './config/content.config';
  50. import contentNonIndustryConfig from './config/content.nonIndustry.config';
  51. import pageContent from '@/components/components/pageContent.vue';
  52. import searchConfig from './config/search.config';
  53. import searchNonIndustryConfig from './config/search.nonIndustry.config';
  54. import pageSearch from '@/components/components/pageSearch.vue';
  55. import detailConfig from './config/detail.config';
  56. import detailNonIndustryConfig from './config/detail.nonIndustry.config';
  57. import pageDetail from './components/detail.vue';
  58. import useSystemStore from '@/store/main';
  59. import FileUpload from '@/components/FileUpload/index.vue'
  60. import TreeSelect from './components/treeSelect.vue';
  61. // 使用pinia数据
  62. const systemStore = useSystemStore();
  63. const { pageDetailInfo } = storeToRefs(systemStore);
  64. const total = ref(0);
  65. const pageSize = ref([10, 20, 30]);
  66. const tableData = ref([]);
  67. const tableListRef = ref();
  68. const tabs = reactive([
  69. {
  70. key: 'industry',
  71. label: '行业内联络员',
  72. total: 0,
  73. tableData: [],
  74. loading: false,
  75. showDetail: true
  76. },
  77. {
  78. key: 'nonIndustry',
  79. label: '行业外联络员',
  80. total: 0,
  81. tableData: [],
  82. loading: false,
  83. showDetail: true
  84. }
  85. ]);
  86. const activeTab = ref('industry');
  87. // 操作弹框
  88. import usePageModal from '@/components/components/hooks/usePageDetails';
  89. const { modalRef, handleNewDataClick, handleEditDataClick, handleCheckDataClick, handlePageDetail } =
  90. usePageModal();
  91. const handleEdit = async (id: string) => {
  92. await handlePageDetail(id);
  93. await handleEditDataClick();
  94. };
  95. const handleCheck = async (id: string) => {
  96. await handlePageDetail(id);
  97. await handleCheckDataClick();
  98. }
  99. // 新增按钮
  100. const onAdd = () => {
  101. handleNewDataClick();
  102. };
  103. const onImport = () => {}
  104. const onExport = () => {}
  105. const searchTableRef = ref();
  106. // 删除按钮
  107. function onDelete(value: any) {
  108. ElMessageBox.confirm('确定删除该条违法信息通报通讯录吗?', '删除提示', {
  109. confirmButtonText: '确定',
  110. cancelButtonText: '取消',
  111. type: 'warning',
  112. })
  113. .then(() => {
  114. systemStore.deletePageDataAction(contentConfig.pageName, value);
  115. })
  116. .catch(() => {
  117. ElMessage({
  118. type: 'info',
  119. message: '取消删除',
  120. });
  121. });
  122. }
  123. // 筛选-状态赋值
  124. async function searchItem() {
  125. searchConfig.formItems.forEach(item => {
  126. if (item.prop === 'status') {
  127. // item.options = searchList.value;
  128. }
  129. });
  130. }
  131. searchItem();
  132. </script>
  133. <style scoped lang="scss">
  134. .sensitive-words {
  135. margin: 20px;
  136. height: calc(100vh - 130px);
  137. }
  138. .status {
  139. cursor: pointer;
  140. position: relative;
  141. .status-tip {
  142. position: absolute;
  143. top: 2px;
  144. left: 60px;
  145. }
  146. }
  147. .dialog-tip {
  148. text-align: center;
  149. }
  150. .table-box {
  151. width: 70%;
  152. display: flex;
  153. flex-direction: column;
  154. }
  155. :deep .el-tabs__item.is-active {
  156. color: #fff;
  157. background-color: #409EFF;
  158. }
  159. </style>