index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <custom-layout class="main">
  3. <el-col :span="24" class="one">
  4. <el-image class="image" :src="lists" fit="fill" />
  5. </el-col>
  6. <div class="w_1300">
  7. <custom-search :cityList="cityList" :typeList="typeList" :plateList="plateList" :fields="fields" :searchFields="searchFields" @toSearchInfo="toSearchInfo"></custom-search>
  8. <div class="twoTwo">
  9. <div class="twoTable">
  10. <div class="label" v-for="(item, index) in column" :key="index" :style="item.style">
  11. {{ item.name }}
  12. </div>
  13. </div>
  14. <div class="twoValue">
  15. <div class="value" v-for="(item, index) in list" :key="index">
  16. <div class="table-colunm table-colunm1">{{ index + 1 || '暂无' }}</div>
  17. <div class="table-colunm table-colunm2">{{ item.name || '暂无' }}</div>
  18. <div class="table-colunm">{{ item.field || '暂无' }}</div>
  19. <div class="table-colunm">{{ item.time || '暂无' }}</div>
  20. <div class="table-colunm button" @click="toView(item)">查看详情</div>
  21. </div>
  22. </div>
  23. <div class="twoTotal">
  24. <el-pagination background layout="prev, pager, next" :total="total" :page-size="limit" v-model:current-page="currentPage" @current-change="changePage" @size-change="sizeChange" />
  25. </div>
  26. </div>
  27. </div>
  28. </custom-layout>
  29. </template>
  30. <script setup>
  31. // 图片引入
  32. import lists from '/images/bg-xqk.jpg'
  33. // 接口
  34. import { SupportStore } from '@/store/api/platform/support'
  35. import { RegionStore } from '@/store/api/system/region'
  36. import { SectorStore } from '@/store/api/platform/sector'
  37. import { DictDataStore } from '@/store/api/system/dictData'
  38. const store = SupportStore()
  39. const regionStore = RegionStore()
  40. const sectorStore = SectorStore()
  41. const dictDataStore = DictDataStore()
  42. // 加载中
  43. const loading = ref(false)
  44. // 路由
  45. const router = useRouter()
  46. const cityList = ref([])
  47. const typeList = ref([])
  48. const plateList = ref([])
  49. const column = ref([
  50. { name: '序号', style: { width: '240px' }, key: 'key' },
  51. { name: '公司名称', style: { width: '280px' }, key: 'name' },
  52. { name: '服务领域', style: { width: '260px' }, key: 'field' },
  53. { name: '登记时间', style: { width: '260px' }, key: 'time' },
  54. { name: '操作', style: { width: '260px' }, key: 'operation' }
  55. ])
  56. const searchForm = ref({})
  57. const list = ref([])
  58. let skip = 0
  59. let limit = 8
  60. const total = ref(0)
  61. const fields = ref([
  62. { model: 'name', label: '公司名称' },
  63. { model: 'tags', label: '标签名称' },
  64. { model: 'time', label: '登记时间' }
  65. ])
  66. const searchFields = ref([
  67. { title: '行业', type: '1', list: plateList },
  68. { title: '技术领域', type: '2', list: typeList },
  69. { title: '所在地', type: '3', list: cityList }
  70. ])
  71. // 请求
  72. onMounted(async () => {
  73. loading.value = true
  74. await searchOther()
  75. await search({ skip, limit })
  76. loading.value = false
  77. })
  78. const searchOther = async () => {
  79. let res
  80. res = await regionStore.list({ level: 'city', parent_code: 22 })
  81. if (res.errcode == '0') cityList.value = res.data
  82. cityList.value.unshift({ id: '-1', code: '-1', name: '不限', is_active: true })
  83. res = await sectorStore.query({ is_use: '0' })
  84. if (res.errcode == '0') plateList.value = res.data
  85. plateList.value.unshift({ id: '-1', title: '不限', is_active: true })
  86. // 技术领域
  87. res = await dictDataStore.query({ code: 'field', is_use: '0' })
  88. if (res.errcode == '0') typeList.value = res.data
  89. typeList.value.unshift({ id: '-1', value: '-1', label: '不限', is_active: true })
  90. }
  91. const search = async (query = { skip, limit }) => {
  92. skip = query.skip
  93. limit = query.limit
  94. const info = { skip: query.skip, limit: query.limit, is_use: '0', status: '1', ...searchForm.value }
  95. const res = await store.list(info)
  96. if (res.errcode == '0') {
  97. list.value = res.data
  98. total.value = res.total
  99. }
  100. }
  101. // 搜索
  102. const toSearchInfo = async (data) => {
  103. searchForm.value = data
  104. await search({ skip, limit })
  105. }
  106. // 查看详情
  107. const toView = (item) => {
  108. router.push({ path: '/service/detail', query: { id: item.id || item._id } })
  109. }
  110. const currentPage = ref(1)
  111. // 分页
  112. const changePage = (page = currentPage.value) => {
  113. search({ skip: (page - 1) * limit, limit: limit })
  114. }
  115. const sizeChange = (limits) => {
  116. limit = limits
  117. currentPage.value = 1
  118. search({ skip: 0, limit: limit })
  119. }
  120. </script>
  121. <style scoped lang="scss">
  122. .main {
  123. background: url(/images/pingtai.jpg) no-repeat top center;
  124. background-size: 100% 100%;
  125. .one {
  126. .image {
  127. width: 100%;
  128. height: 350px;
  129. }
  130. }
  131. .two {
  132. margin: 10px 0;
  133. background-color: $global-color-fff;
  134. }
  135. .twoTwo {
  136. margin: 10px 0;
  137. .twoTable {
  138. display: flex;
  139. justify-content: space-between;
  140. color: $global-color-fff;
  141. font-size: $global-font-size-20;
  142. background-color: rgba(255, 255, 255, 0.1);
  143. padding: 12px 0;
  144. .label {
  145. text-align: center;
  146. }
  147. }
  148. .twoValue {
  149. color: $global-color-fff;
  150. font-size: $global-font-size-20;
  151. .value {
  152. display: flex;
  153. justify-content: space-between;
  154. padding: 12px 0;
  155. .table-colunm {
  156. width: 260px;
  157. text-align: center;
  158. }
  159. .table-colunm1 {
  160. width: 240px !important;
  161. }
  162. .table-colunm2 {
  163. width: 280px !important;
  164. }
  165. .button {
  166. cursor: pointer; /* 改变鼠标样式为手形 */
  167. }
  168. .button:hover {
  169. color: $global-color-107;
  170. }
  171. }
  172. .value:nth-child(2n) {
  173. background-color: rgba(255, 255, 255, 0.1);
  174. }
  175. }
  176. .twoTotal {
  177. display: flex;
  178. justify-content: center;
  179. margin: 20px 0;
  180. }
  181. }
  182. }
  183. </style>