index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <el-tabs type="card" v-model="activeTab" style="height: 100%" @tab-click="handleClick">
  3. <el-tab-pane v-for="tab in tabs" :key="tab.key" :label="tab.label" :name="tab.key">
  4. <div class="sensitive-words flex">
  5. <TreeSelect class="mr20" ref="treeSelectdRef" @treeCheck="getTreeCheck"></TreeSelect>
  6. <div class="table-box">
  7. <pageSearch
  8. ref="searchTableRef"
  9. :searchConfig="activeTab === '1' ? searchConfig : searchNonIndustryConfig"
  10. />
  11. <pageContent
  12. ref="tableListRef"
  13. :total="total"
  14. :contentConfig="activeTab === '1' ? contentConfig : contentNonIndustryConfig"
  15. :pageList="tableData"
  16. >
  17. <!-- 短信接收人 -->
  18. <template #msgRecipient="scope">
  19. <template :index="index" v-for="(item, index) in bj_msg_recipient">
  20. <el-tag
  21. :index="index"
  22. v-if="item.value == scope.row.msgRecipient"
  23. :type="scope.row.msgRecipient == '1' ? 'success' : 'danger'"
  24. >{{ item.label }}</el-tag
  25. >
  26. </template>
  27. </template>
  28. <!-- 通讯录状态 -->
  29. <template #abStatus="scope">
  30. <template :index="index" v-for="(item, index) in bj_ab_status">
  31. <el-tag
  32. :index="index"
  33. v-if="item.value == scope.row.abStatus"
  34. :type="scope.row.abStatus == '1' ? 'success' : 'danger'"
  35. >{{ item.label }}</el-tag
  36. >
  37. </template>
  38. </template>
  39. <template #button>
  40. <el-button type="primary" @click="onImport()">导入</el-button>
  41. <el-button type="primary" @click="onImport()">下载模版</el-button>
  42. <el-button type="primary" @click="onAdd()">新增</el-button>
  43. <el-button type="primary" @click="onExport()">导出</el-button>
  44. </template>
  45. <template #operate="scope">
  46. <el-button type="primary" link @click="handleEdit(scope.row.liaisonId)"> 编辑 </el-button>
  47. <el-button type="primary" link @click="handleCheck(scope.row.liaisonId)"> 查看 </el-button>
  48. <el-button type="primary" link @click="onDelete(scope.row.liaisonId)"> 删除 </el-button>
  49. </template>
  50. </pageContent>
  51. </div>
  52. </div>
  53. </el-tab-pane>
  54. </el-tabs>
  55. <pageDetail :modalConfig="activeTab === '1' ? detailConfig : detailNonIndustryConfig" ref="modalRef">
  56. </pageDetail>
  57. </template>
  58. <script setup lang="ts">
  59. import contentConfig from './config/content.config';
  60. import contentNonIndustryConfig from './config/content.nonIndustry.config';
  61. import pageContent from '@/components/components/pageContent.vue';
  62. import searchConfig from './config/search.config';
  63. import searchNonIndustryConfig from './config/search.nonIndustry.config';
  64. import pageSearch from '@/components/components/pageSearch.vue';
  65. import detailConfig from './config/detail.config';
  66. import detailNonIndustryConfig from './config/detail.nonIndustry.config';
  67. import pageDetail from './components/detail.vue';
  68. import useSystemStore from '@/store/main';
  69. import TreeSelect from './components/treeSelect.vue';
  70. import { type TabsPaneContext } from 'element-plus';
  71. import { outTypeList } from '@/libs/commonMeth';
  72. const bj_msg_recipient = outTypeList('bj_msg_recipient'); //短信接收人
  73. const bj_ab_status: any = outTypeList('bj_ab_status'); //通讯录状态
  74. // 使用pinia数据
  75. const systemStore = useSystemStore();
  76. const { pageDetailInfo, searchObj } = storeToRefs(systemStore);
  77. const total = ref(0);
  78. const pageSize = ref([10, 20, 30]);
  79. const tableData = ref([]);
  80. const tableListRef = ref<InstanceType<typeof pageContent>>();
  81. const tabs = reactive([
  82. {
  83. key: '1',
  84. label: '行业内联络员',
  85. total: 0,
  86. tableData: [],
  87. loading: false,
  88. showDetail: true,
  89. },
  90. {
  91. key: '2',
  92. label: '行业外联络员',
  93. total: 0,
  94. tableData: [],
  95. loading: false,
  96. showDetail: true,
  97. },
  98. ]);
  99. const activeTab = ref('1');
  100. // 操作弹框
  101. import usePageModal from '@/components/components/hooks/usePageDetails';
  102. const { modalRef, handleNewDataClick, handleEditDataClick, handleCheckDataClick, handlePageDetail } =
  103. usePageModal();
  104. const getTreeCheck = async data => {
  105. console.log(data);
  106. // console.log(searchObj);
  107. if (tableListRef.value) {
  108. if (activeTab.value == '1') {
  109. console.log(data.join());
  110. searchConfig.pageListParams.belongsDept = data.join();
  111. console.log(searchConfig);
  112. } else {
  113. searchNonIndustryConfig.pageListParams.belongsDept = data.join();
  114. }
  115. await tableListRef.value[0].fetchPageListData({ belongsDept: data.join() });
  116. }
  117. };
  118. const treeSelectdRef = ref<InstanceType<typeof TreeSelect>>();
  119. const searchTableRef = ref<InstanceType<typeof pageSearch>>();
  120. const handleClick = async (tab: TabsPaneContext) => {
  121. setTimeout(() => {
  122. if (treeSelectdRef.value) {
  123. treeSelectdRef.value[0].handleReset(false);
  124. }
  125. if (searchTableRef.value) {
  126. searchTableRef.value[0].handleResetClick();
  127. }
  128. }, 500);
  129. };
  130. const handleEdit = async (id: string) => {
  131. await handlePageDetail(id);
  132. await handleEditDataClick();
  133. };
  134. const handleCheck = async (id: string) => {
  135. await handlePageDetail(id);
  136. await handleCheckDataClick();
  137. };
  138. // 新增按钮
  139. const onAdd = () => {
  140. handleNewDataClick();
  141. };
  142. const onImport = () => {
  143. const link = document.createElement('a');
  144. link.href = `/assets/address-book.xlsx`;
  145. link.download = '违法信息通报通讯录人员导入模板.xlsx'; // 指定下载后的文件名
  146. link.style.display = 'none';
  147. document.body.appendChild(link);
  148. link.click();
  149. document.body.removeChild(link);
  150. };
  151. const onExport = () => {};
  152. // 删除按钮
  153. function onDelete(value: any) {
  154. ElMessageBox.confirm('确定删除该条违法信息通报通讯录吗?', '删除提示', {
  155. confirmButtonText: '确定',
  156. cancelButtonText: '取消',
  157. type: 'warning',
  158. })
  159. .then(() => {
  160. systemStore.deletePageDataAction(contentConfig.pageName, value);
  161. })
  162. .catch(() => {
  163. ElMessage({
  164. type: 'info',
  165. message: '取消删除',
  166. });
  167. });
  168. }
  169. // 筛选-状态赋值 bj_notification_status
  170. async function searchItem() {
  171. searchConfig.formItems.forEach(item => {
  172. if (item.prop === 'msgRecipient') {
  173. item.options = bj_msg_recipient;
  174. }
  175. if (item.prop === 'abStatus') {
  176. item.options = bj_ab_status;
  177. }
  178. });
  179. searchNonIndustryConfig.formItems.forEach(item => {
  180. if (item.prop === 'abStatus') {
  181. item.options = bj_ab_status;
  182. }
  183. });
  184. }
  185. searchItem();
  186. </script>
  187. <style scoped lang="scss">
  188. .sensitive-words {
  189. margin: 20px;
  190. height: calc(100vh - 20vh);
  191. }
  192. .status {
  193. cursor: pointer;
  194. position: relative;
  195. .status-tip {
  196. position: absolute;
  197. top: 2px;
  198. left: 60px;
  199. }
  200. }
  201. .dialog-tip {
  202. text-align: center;
  203. }
  204. .table-box {
  205. width: 75%;
  206. display: flex;
  207. flex-direction: column;
  208. }
  209. :deep .el-tabs__item.is-active {
  210. color: #fff;
  211. background-color: #409eff;
  212. }
  213. </style>