index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  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. <!-- <div class="active">
  8. <div class="active_1" v-show="industry && industry.length > 0">
  9. <div class="active_left">行业:</div>
  10. <div class="active_right">
  11. <div class="active_label" v-for="(item, index) in industry" :key="index">
  12. {{ item.title }}<el-icon @click="toDel(item, '1')"><Close /></el-icon>
  13. </div>
  14. </div>
  15. </div>
  16. <div class="active_1" v-show="field && field.length > 0">
  17. <div class="active_left">技术领域:</div>
  18. <div class="active_right">
  19. <div class="active_label" v-for="(item, index) in field" :key="index">
  20. {{ item.label }}<el-icon @click="toDel(item, '2')"><Close /></el-icon>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="active_1" v-show="city && city.length > 0">
  25. <div class="active_left">所在地:</div>
  26. <div class="active_right">
  27. <div class="active_label" v-for="(item, index) in city" :key="index">
  28. {{ item.name }}<el-icon @click="toDel(item, '3')"><Close /></el-icon>
  29. </div>
  30. </div>
  31. </div>
  32. </div> -->
  33. <div class="two">
  34. <div class="twoSeacher">
  35. <div class="twoLeft">
  36. <span>行业</span>
  37. </div>
  38. <div v-if="!oneShow" class="twoRight">
  39. <div class="label" :class="[item.is_active ? 'show' : '']" v-for="(item, index) in plateList.slice(0, 6)" :key="index" @click="toSelect(item, '1')">
  40. {{ item.title }}
  41. </div>
  42. </div>
  43. <div v-else class="twoRight">
  44. <div class="label" :class="[item.is_active ? 'show' : '']" v-for="(item, index) in plateList" :key="index" @click="toSelect(item, '1')">
  45. {{ item.title }}
  46. </div>
  47. </div>
  48. <div class="button">
  49. <span v-if="!oneShow" @click="oneShow = true">
  50. <el-icon><ArrowDown /></el-icon>
  51. </span>
  52. <span v-else @click="oneShow = false">
  53. <el-icon><ArrowUp /></el-icon>
  54. </span>
  55. </div>
  56. </div>
  57. <div class="twoSeacher">
  58. <div class="twoLeft">
  59. <span>技术领域</span>
  60. </div>
  61. <div v-if="!twoShow" class="twoRight">
  62. <div class="label" :class="[item.is_active ? 'show' : '']" v-for="(item, index) in typeList.slice(0, 10)" :key="index" @click="toSelect(item, '2')">
  63. {{ item.label }}
  64. </div>
  65. </div>
  66. <div v-else class="twoRight">
  67. <div class="label" :class="[item.is_active ? 'show' : '']" v-for="(item, index) in typeList" :key="index" @click="toSelect(item, '2')">
  68. {{ item.label }}
  69. </div>
  70. </div>
  71. <div class="button">
  72. <span v-if="!twoShow" @click="twoShow = true">
  73. <el-icon><ArrowDown /></el-icon>
  74. </span>
  75. <span v-else @click="twoShow = false">
  76. <el-icon><ArrowUp /></el-icon>
  77. </span>
  78. </div>
  79. </div>
  80. <div class="twoSeacher">
  81. <div class="twoLeft">
  82. <span>所在地</span>
  83. </div>
  84. <div class="twoRight">
  85. <div class="label" :class="[item.is_active ? 'show' : '']" v-for="(item, index) in cityList" :key="index" @click="toSelect(item, '3')">
  86. {{ item.name }}
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="two_ipunt">
  92. <a-input class="input" size="large" v-model:value="searchForm.name" placeholder="服务名称" />
  93. <a-input class="input" size="large" v-model:value="searchForm.tags" placeholder="标签名称" />
  94. <a-input class="input" size="large" v-model:value="searchForm.industry" placeholder="所属产业" />
  95. <a-button class="button" size="large" type="primary" @click="toSearchInfo">检索</a-button>
  96. </div>
  97. <div class="twoTwo">
  98. <div class="twoTable">
  99. <div class="label" v-for="(item, index) in column" :key="index" :style="item.style">
  100. {{ item.name }}
  101. </div>
  102. </div>
  103. <div class="twoValue">
  104. <div class="value" v-for="(item, index) in list" :key="index">
  105. <div class="table-colunm table-colunm1">{{ item.key || '暂无' }}</div>
  106. <div class="table-colunm table-colunm2">{{ item.name || '暂无' }}</div>
  107. <div class="table-colunm">{{ item.field || '暂无' }}</div>
  108. <div class="table-colunm">{{ item.time || '暂无' }}</div>
  109. <div class="table-colunm button" @click="toView(item)">查看详情</div>
  110. </div>
  111. </div>
  112. <div class="twoTotal">
  113. <el-pagination background layout="prev, pager, next" :total="total" :page-size="limit" v-model:current-page="currentPage" @current-change="changePage" @size-change="sizeChange" />
  114. </div>
  115. </div>
  116. </div>
  117. </custom-layout>
  118. </template>
  119. <script setup>
  120. // 图片引入
  121. import lists from '/images/bg-xqk.jpg'
  122. // 接口
  123. import { SupportStore } from '@/store/api/platform/support'
  124. import { RegionStore } from '@/store/api/system/region'
  125. import { SectorStore } from '@/store/api/platform/sector'
  126. import { DictDataStore } from '@/store/api/system/dictData'
  127. const store = SupportStore()
  128. const regionStore = RegionStore()
  129. const sectorStore = SectorStore()
  130. const dictDataStore = DictDataStore()
  131. import { UserStore } from '@/store/user'
  132. const userStore = UserStore()
  133. const user = computed(() => userStore.user)
  134. // 加载中
  135. const loading = ref(false)
  136. // 路由
  137. const router = useRouter()
  138. // 是否展开
  139. const oneShow = ref(false)
  140. const twoShow = ref(false)
  141. const cityList = ref([])
  142. const typeList = ref([])
  143. const plateList = ref([])
  144. const column = ref([
  145. { name: '序号', style: { width: '240px' }, key: 'key' },
  146. { name: '公司名称', style: { width: '280px' }, key: 'name' },
  147. { name: '服务领域', style: { width: '260px' }, key: 'field' },
  148. { name: '登记时间', style: { width: '260px' }, key: 'time' },
  149. { name: '操作', style: { width: '260px' }, key: 'operation' }
  150. ])
  151. const searchForm = ref({})
  152. const list = ref([])
  153. let skip = 0
  154. let limit = 8
  155. const total = ref(0)
  156. // 查询
  157. const industry = ref([])
  158. const field = ref([])
  159. const city = ref([])
  160. // 请求
  161. onMounted(async () => {
  162. loading.value = true
  163. await searchOther()
  164. await search({ skip, limit })
  165. loading.value = false
  166. })
  167. const searchOther = async () => {
  168. let res
  169. res = await regionStore.list({ level: 'city', parent_code: 22 })
  170. if (res.errcode == '0') cityList.value = res.data
  171. cityList.value.unshift({ id: '-1', code: '-1', name: '不限', is_active: true })
  172. res = await sectorStore.query({ is_use: '0' })
  173. if (res.errcode == '0') plateList.value = res.data
  174. plateList.value.unshift({ id: '-1', title: '不限', is_active: true })
  175. // 技术领域
  176. res = await dictDataStore.query({ code: 'field', is_use: '0' })
  177. if (res.errcode == '0') typeList.value = res.data
  178. typeList.value.unshift({ id: '-1', value: '-1', label: '不限', is_active: true })
  179. }
  180. const search = async (query = { skip, limit }) => {
  181. skip = query.skip
  182. limit = query.limit
  183. const info = { skip: query.skip, limit: query.limit, ...searchForm.value }
  184. const res = await store.query(info)
  185. if (res.errcode == '0') {
  186. list.value = res.data
  187. total.value = res.total
  188. }
  189. }
  190. // 搜索
  191. const toSearchInfo = async () => {
  192. await search({ skip, limit })
  193. }
  194. // 查看详情
  195. const toView = (item) => {
  196. router.push({ path: '/service/detail', query: { id: item.id || item._id } })
  197. }
  198. const currentPage = ref(1)
  199. // 分页
  200. const changePage = (page = currentPage.value) => {
  201. search({ skip: (page - 1) * limit, limit: limit })
  202. }
  203. const sizeChange = (limits) => {
  204. limit = limits
  205. currentPage.value = 1
  206. search({ skip: 0, limit: limit })
  207. }
  208. const toSelect = (data, type) => {
  209. if (data.is_active) {
  210. toDel(data, type)
  211. } else {
  212. if (data.id != '-1') {
  213. if (type == '1') {
  214. for (const val of plateList.value) {
  215. if (data.id == val.id) val.is_active = true
  216. if (val.id == '-1') val.is_active = false
  217. }
  218. const res = industry.value.find((i) => i.id == data.id)
  219. if (!res) industry.value.push(data)
  220. } else if (type == '2') {
  221. for (const val of typeList.value) {
  222. if (data.id == val.id) val.is_active = true
  223. if (val.id == '-1') val.is_active = false
  224. }
  225. const res = field.value.find((i) => i.id == data.id)
  226. if (!res) field.value.push(data)
  227. } else {
  228. for (const val of cityList.value) {
  229. if (data.id == val.id) val.is_active = true
  230. if (val.id == '-1') val.is_active = false
  231. }
  232. const res = city.value.find((i) => i.id == data.id)
  233. if (!res) city.value.push(data)
  234. }
  235. } else {
  236. if (type == '1') {
  237. for (const val of plateList.value) {
  238. if (val.id == '-1') val.is_active = true
  239. else val.is_active = false
  240. }
  241. industry.value = []
  242. } else if (type == '2') {
  243. for (const val of typeList.value) {
  244. if (val.id == '-1') val.is_active = true
  245. else val.is_active = false
  246. }
  247. field.value = []
  248. } else {
  249. for (const val of cityList.value) {
  250. if (val.id == '-1') val.is_active = true
  251. else val.is_active = false
  252. }
  253. city.value = []
  254. }
  255. }
  256. }
  257. }
  258. const toDel = (data, type) => {
  259. if (type == '1') {
  260. for (const val of plateList.value) {
  261. if (data.id == val.id) val.is_active = false
  262. }
  263. industry.value = industry.value.filter((f) => f.id != data.id)
  264. if (industry.value.length == 0) {
  265. for (const val of plateList.value) {
  266. if (val.id == '-1') val.is_active = true
  267. }
  268. }
  269. } else if (type == '2') {
  270. for (const val of typeList.value) {
  271. if (data.id == val.id) val.is_active = false
  272. }
  273. field.value = field.value.filter((f) => f.id != data.id)
  274. if (field.value.length == 0) {
  275. for (const val of typeList.value) {
  276. if (val.id == '-1') val.is_active = true
  277. }
  278. }
  279. } else {
  280. for (const val of cityList.value) {
  281. if (data.id == val.id) val.is_active = false
  282. }
  283. city.value = city.value.filter((f) => f.id != data.id)
  284. if (city.value.length == 0) {
  285. for (const val of cityList.value) {
  286. if (val.id == '-1') val.is_active = true
  287. }
  288. }
  289. }
  290. }
  291. </script>
  292. <style scoped lang="scss">
  293. .main {
  294. background: url(/images/pingtai.jpg) no-repeat top center;
  295. background-size: 100% 100%;
  296. .one {
  297. .image {
  298. width: 100%;
  299. height: 350px;
  300. }
  301. }
  302. .active {
  303. .active_1 {
  304. display: inline-flex;
  305. background: #f5f7f9;
  306. border-radius: 2px;
  307. min-height: 28px;
  308. line-height: 28px;
  309. margin: 10px 10px 0 0;
  310. position: relative;
  311. background-color: #fff;
  312. padding: 10px;
  313. .active_left {
  314. flex: 0 0 auto;
  315. font-family: PingFangSC-Regular;
  316. color: #525a68;
  317. line-height: 36px;
  318. }
  319. .active_right {
  320. font-family: PingFangSC-Regular;
  321. color: rgba(0, 0, 0, 0.85);
  322. line-height: 28px;
  323. padding-right: 4px;
  324. display: flex;
  325. flex-wrap: wrap;
  326. overflow: hidden;
  327. .active_label {
  328. overflow: hidden;
  329. display: inline-block;
  330. margin-right: 10px;
  331. margin-top: 3px;
  332. margin-bottom: 3px;
  333. padding: 10px;
  334. display: flex;
  335. align-items: center;
  336. flex: none;
  337. box-sizing: border-box;
  338. max-width: 100%;
  339. height: 30px;
  340. background: #f5f5f5;
  341. border: 1px solid #f0f0f0;
  342. border-radius: 2px;
  343. cursor: default;
  344. }
  345. }
  346. }
  347. }
  348. .two {
  349. margin: 10px 0;
  350. background-color: $global-color-fff;
  351. .twoSeacher {
  352. display: flex;
  353. justify-content: center;
  354. align-items: stretch;
  355. position: relative;
  356. border: solid 1px #e5e5e5;
  357. border-bottom: 0;
  358. font-size: $global-font-size-18;
  359. color: #666;
  360. min-height: 60px;
  361. overflow: hidden;
  362. .twoLeft {
  363. display: flex;
  364. justify-content: center;
  365. align-items: center;
  366. flex-shrink: 0;
  367. width: 110px;
  368. text-align: center;
  369. color: #000;
  370. font-weight: bold;
  371. background-color: #fafafa;
  372. }
  373. .twoRight {
  374. display: flex;
  375. flex-wrap: wrap;
  376. align-items: center;
  377. padding: 12px;
  378. flex: 1;
  379. border-left: solid 1px #e5e5e5;
  380. background-color: #fff;
  381. .label {
  382. margin-right: 3px;
  383. color: #313131;
  384. margin-bottom: 10px;
  385. padding: 8px 10px;
  386. border-radius: 3px;
  387. background-color: #fff;
  388. border: solid 1px transparent;
  389. cursor: pointer;
  390. }
  391. .show {
  392. color: #0a58c2;
  393. border: solid 1px #006dd2;
  394. }
  395. .label:hover {
  396. color: $global-color-107;
  397. }
  398. }
  399. .button {
  400. display: flex;
  401. align-items: center;
  402. margin: 0 5px 0 0;
  403. }
  404. }
  405. }
  406. .two_ipunt {
  407. display: flex;
  408. align-items: center;
  409. justify-content: space-between;
  410. margin: 10px 0;
  411. .input {
  412. margin: 0 5px 0 0;
  413. }
  414. .button {
  415. margin: 0 0 0 5px;
  416. }
  417. }
  418. .twoTwo {
  419. margin: 10px 0;
  420. .twoTable {
  421. display: flex;
  422. justify-content: space-between;
  423. color: $global-color-fff;
  424. font-size: $global-font-size-20;
  425. background-color: rgba(255, 255, 255, 0.1);
  426. padding: 12px 0;
  427. .label {
  428. text-align: center;
  429. }
  430. }
  431. .twoValue {
  432. color: $global-color-fff;
  433. font-size: $global-font-size-20;
  434. .value {
  435. display: flex;
  436. justify-content: space-between;
  437. padding: 12px 0;
  438. .table-colunm {
  439. width: 260px;
  440. text-align: center;
  441. }
  442. .table-colunm1 {
  443. width: 240px !important;
  444. }
  445. .table-colunm2 {
  446. width: 280px !important;
  447. }
  448. .button {
  449. cursor: pointer; /* 改变鼠标样式为手形 */
  450. }
  451. .button:hover {
  452. color: $global-color-107;
  453. }
  454. }
  455. .value:nth-child(2n) {
  456. background-color: rgba(255, 255, 255, 0.1);
  457. }
  458. }
  459. .twoTotal {
  460. display: flex;
  461. justify-content: center;
  462. margin: 20px 0;
  463. }
  464. }
  465. }
  466. </style>