index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <img class="home-bg" src="/homeBg.png" />
  3. <div class="home-container">
  4. <el-form @submit.prevent @keyup.enter="name && toDomain({ name })">
  5. <el-form-item>
  6. <el-input v-model="name" size="large" clearable placeholder="搜索">
  7. <template #suffix>
  8. <el-button link icon="search" @click="name && toDomain({ name })"></el-button>
  9. </template>
  10. </el-input>
  11. </el-form-item>
  12. <!-- <el-form-item label="热搜词:">
  13. <el-tag type="warning">政策</el-tag>
  14. </el-form-item> -->
  15. </el-form>
  16. <el-card class="home-container__tabs-card">
  17. <el-tabs class="left-tabs" v-model="params.zcLevel" tab-position="left" @tab-change="reloadTable">
  18. <el-tab-pane v-for="item in levelDic" :key="item" :label="item.slice(0, -1)" :name="item"></el-tab-pane>
  19. </el-tabs>
  20. <el-card shadow="never">
  21. <template #header>
  22. <el-tabs v-model="params.inWhType" @tab-change="reloadTable">
  23. <el-tab-pane v-for="item in storageTypeDic" :key="item.value" :label="item.label" :name="item.value"></el-tab-pane>
  24. </el-tabs>
  25. </template>
  26. <el-table v-loading="loading" row-key="id" header-cell-class-name="tjm_card_table_header" height="300px" :data="tableData" border @row-click="table_detail">
  27. <template v-for="(item, index) in columns" :key="index">
  28. <el-table-column :label="item.label" :prop="item.props" min-width="100" show-overflow-tooltip>
  29. <template #default="scope">{{ columnFormat(scope.row, item.props) }}</template>
  30. </el-table-column>
  31. </template>
  32. </el-table>
  33. </el-card>
  34. </el-card>
  35. <el-card class="home-container__domain">
  36. <template #header>{{ domainTitle }}</template>
  37. <el-row>
  38. <el-col v-for="zcType in typeDic" :key="zcType" :span="8">
  39. <el-button @click="toDomain({ zcType, inWhType: params.inWhType })">{{ zcType }}</el-button>
  40. </el-col>
  41. </el-row>
  42. </el-card>
  43. </div>
  44. </template>
  45. <script>
  46. import Share from "@/api/policy/share";
  47. import { levelDic, typeDic } from "@/views/policyShare/main";
  48. import { columns, storageTypeDic } from "./main";
  49. export default {
  50. data() {
  51. return {
  52. columns, levelDic, typeDic, storageTypeDic,
  53. name: "", // 筛选字段 -- 名称
  54. loading: false,
  55. params: {
  56. page: 1,
  57. size: 10,
  58. status: "done",
  59. zcLevel: levelDic[0],
  60. inWhType: storageTypeDic[0].value
  61. },
  62. tableData: []
  63. }
  64. },
  65. computed: {
  66. domainTitle() {
  67. return storageTypeDic.find(s => s.value == this.params.inWhType).title
  68. }
  69. },
  70. mounted() {
  71. this.reloadTable();
  72. },
  73. methods: {
  74. columnFormat(row, props) {
  75. if (props == "createTime") return row[props].split(" ")[0];
  76. if (props == "status") return statusDic[row[props]] || "";
  77. if (props == "isInWh") return whetherDic[row[props]] || "";
  78. return row[props];
  79. },
  80. reloadTable() {
  81. this.loading = true;
  82. Share.get(this.params).then(res => {
  83. this.loading = false;
  84. if (res.code === 200) this.tableData = res.data.records;
  85. else ElMessage.error(res.msg);
  86. }).catch(() => this.loading = false);
  87. },
  88. toDomain(query) {
  89. this.$router.push({ path: "/publicDomain", query })
  90. },
  91. table_detail({ id }) {
  92. this.$router.push({ path: "/policyDetail", query: { id } });
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .home-bg {
  99. position: fixed;
  100. top: 0;
  101. left: 0;
  102. right: 0;
  103. bottom: 0;
  104. }
  105. .home-container {
  106. position: relative;
  107. z-index: 100;
  108. padding: 15px 20px;
  109. .el-tabs :deep {
  110. .el-tabs__active-bar {
  111. display: none;
  112. }
  113. .el-tabs__item.is-active {
  114. background: var(--el-color-primary);
  115. color: #fff;
  116. }
  117. .el-tabs__content {
  118. display: none;
  119. }
  120. }
  121. .home-container__tabs-card > :deep(.el-card__body) {
  122. display: flex;
  123. background: #fff;
  124. .el-tabs.el-tabs--left {
  125. margin-top: 40px;
  126. .el-tabs__header {
  127. justify-content: flex-start;
  128. margin-right: 1px;
  129. .el-tabs__nav-wrap::after {
  130. width: 1px;
  131. }
  132. }
  133. }
  134. > .el-card {
  135. flex-basis: 100%;
  136. border: none;
  137. border-radius: 0;
  138. .el-card__header {
  139. padding: 0;
  140. border: none;
  141. .el-tabs.el-tabs--top .el-tabs__header {
  142. margin-bottom: 1px;
  143. .el-tabs__nav-wrap::after {
  144. height: 1px;
  145. }
  146. .el-tabs__item {
  147. padding: 0 20px;
  148. }
  149. }
  150. }
  151. .el-card__body {
  152. padding-right: 0;
  153. padding-bottom: 0;
  154. .el-table .el-table__header tr th {
  155. background: #f4f4f4;
  156. color: #333333;
  157. }
  158. }
  159. }
  160. }
  161. .home-container__domain {
  162. margin-top: 18px;
  163. :deep(.el-card__header) {
  164. position: relative;
  165. border-bottom: none;
  166. text-align: center;
  167. &::after {
  168. content: '';
  169. position: absolute;
  170. bottom: 0;
  171. left: 20px;
  172. width: calc(100% - 40px);
  173. height: 1px;
  174. background: var(--el-card-border-color);
  175. }
  176. }
  177. :deep(.el-card__body) {
  178. text-align: center;
  179. padding-top: calc(var(--el-card-padding) + 10px);
  180. padding-bottom: calc(var(--el-card-padding) - 10px);
  181. .el-col {
  182. margin-bottom: calc(var(--el-card-padding) + 10px);
  183. .el-button {
  184. --el-button-border-color: var(--el-text-color-primary);
  185. --el-button-text-color: var(--el-text-color-primary);
  186. padding: 30px 40px;
  187. }
  188. }
  189. }
  190. }
  191. }
  192. </style>