index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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, is_use: '0', status: '1', ...searchForm.value }
  184. const res = await store.list(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. // 筛选条件
  209. const toSearchFind = async () => {
  210. if (industry.value && industry.value.length > 0) {
  211. searchForm.value.industry = industry.value.map((i) => {
  212. return i.title
  213. })
  214. } else delete searchForm.value.industry
  215. if (field.value && field.value.length > 0) {
  216. searchForm.value.field = field.value.map((i) => {
  217. return i.label
  218. })
  219. } else delete searchForm.value.field
  220. if (city.value && city.value.length > 0) {
  221. searchForm.value.area = city.value.map((i) => {
  222. return i.name
  223. })
  224. } else delete searchForm.value.area
  225. await search({ skip, limit })
  226. }
  227. const toSelect = async (data, type) => {
  228. if (data.is_active) {
  229. toDel(data, type)
  230. } else {
  231. if (data.id != '-1') {
  232. if (type == '1') {
  233. for (const val of plateList.value) {
  234. if (data.id == val.id) val.is_active = true
  235. if (val.id == '-1') val.is_active = false
  236. }
  237. const res = industry.value.find((i) => i.id == data.id)
  238. if (!res) industry.value.push(data)
  239. } else if (type == '2') {
  240. for (const val of typeList.value) {
  241. if (data.id == val.id) val.is_active = true
  242. if (val.id == '-1') val.is_active = false
  243. }
  244. const res = field.value.find((i) => i.id == data.id)
  245. if (!res) field.value.push(data)
  246. } else {
  247. for (const val of cityList.value) {
  248. if (data.id == val.id) val.is_active = true
  249. if (val.id == '-1') val.is_active = false
  250. }
  251. const res = city.value.find((i) => i.id == data.id)
  252. if (!res) city.value.push(data)
  253. }
  254. } else {
  255. if (type == '1') {
  256. for (const val of plateList.value) {
  257. if (val.id == '-1') val.is_active = true
  258. else val.is_active = false
  259. }
  260. industry.value = []
  261. } else if (type == '2') {
  262. for (const val of typeList.value) {
  263. if (val.id == '-1') val.is_active = true
  264. else val.is_active = false
  265. }
  266. field.value = []
  267. } else {
  268. for (const val of cityList.value) {
  269. if (val.id == '-1') val.is_active = true
  270. else val.is_active = false
  271. }
  272. city.value = []
  273. }
  274. }
  275. }
  276. await toSearchFind()
  277. }
  278. const toDel = async (data, type) => {
  279. if (type == '1') {
  280. for (const val of plateList.value) {
  281. if (data.id == val.id) val.is_active = false
  282. }
  283. industry.value = industry.value.filter((f) => f.id != data.id)
  284. if (industry.value.length == 0) {
  285. for (const val of plateList.value) {
  286. if (val.id == '-1') val.is_active = true
  287. }
  288. }
  289. } else if (type == '2') {
  290. for (const val of typeList.value) {
  291. if (data.id == val.id) val.is_active = false
  292. }
  293. field.value = field.value.filter((f) => f.id != data.id)
  294. if (field.value.length == 0) {
  295. for (const val of typeList.value) {
  296. if (val.id == '-1') val.is_active = true
  297. }
  298. }
  299. } else {
  300. for (const val of cityList.value) {
  301. if (data.id == val.id) val.is_active = false
  302. }
  303. city.value = city.value.filter((f) => f.id != data.id)
  304. if (city.value.length == 0) {
  305. for (const val of cityList.value) {
  306. if (val.id == '-1') val.is_active = true
  307. }
  308. }
  309. }
  310. await toSearchFind()
  311. }
  312. </script>
  313. <style scoped lang="scss">
  314. .main {
  315. background: url(/images/pingtai.jpg) no-repeat top center;
  316. background-size: 100% 100%;
  317. .one {
  318. .image {
  319. width: 100%;
  320. height: 350px;
  321. }
  322. }
  323. .active {
  324. .active_1 {
  325. display: inline-flex;
  326. background: #f5f7f9;
  327. border-radius: 2px;
  328. min-height: 28px;
  329. line-height: 28px;
  330. margin: 10px 10px 0 0;
  331. position: relative;
  332. background-color: #fff;
  333. padding: 10px;
  334. .active_left {
  335. flex: 0 0 auto;
  336. font-family: PingFangSC-Regular;
  337. color: #525a68;
  338. line-height: 36px;
  339. }
  340. .active_right {
  341. font-family: PingFangSC-Regular;
  342. color: rgba(0, 0, 0, 0.85);
  343. line-height: 28px;
  344. padding-right: 4px;
  345. display: flex;
  346. flex-wrap: wrap;
  347. overflow: hidden;
  348. .active_label {
  349. overflow: hidden;
  350. display: inline-block;
  351. margin-right: 10px;
  352. margin-top: 3px;
  353. margin-bottom: 3px;
  354. padding: 10px;
  355. display: flex;
  356. align-items: center;
  357. flex: none;
  358. box-sizing: border-box;
  359. max-width: 100%;
  360. height: 30px;
  361. background: #f5f5f5;
  362. border: 1px solid #f0f0f0;
  363. border-radius: 2px;
  364. cursor: default;
  365. }
  366. }
  367. }
  368. }
  369. .two {
  370. margin: 10px 0;
  371. background-color: $global-color-fff;
  372. .twoSeacher {
  373. display: flex;
  374. justify-content: center;
  375. align-items: stretch;
  376. position: relative;
  377. border: solid 1px #e5e5e5;
  378. border-bottom: 0;
  379. font-size: $global-font-size-18;
  380. color: #666;
  381. min-height: 60px;
  382. overflow: hidden;
  383. .twoLeft {
  384. display: flex;
  385. justify-content: center;
  386. align-items: center;
  387. flex-shrink: 0;
  388. width: 110px;
  389. text-align: center;
  390. color: #000;
  391. font-weight: bold;
  392. background-color: #fafafa;
  393. }
  394. .twoRight {
  395. display: flex;
  396. flex-wrap: wrap;
  397. align-items: center;
  398. padding: 12px;
  399. flex: 1;
  400. border-left: solid 1px #e5e5e5;
  401. background-color: #fff;
  402. .label {
  403. margin-right: 3px;
  404. color: #313131;
  405. margin-bottom: 10px;
  406. padding: 8px 10px;
  407. border-radius: 3px;
  408. background-color: #fff;
  409. border: solid 1px transparent;
  410. cursor: pointer;
  411. }
  412. .show {
  413. color: #0a58c2;
  414. border: solid 1px #006dd2;
  415. }
  416. .label:hover {
  417. color: $global-color-107;
  418. }
  419. }
  420. .button {
  421. display: flex;
  422. align-items: center;
  423. margin: 0 5px 0 0;
  424. }
  425. }
  426. }
  427. .two_ipunt {
  428. display: flex;
  429. align-items: center;
  430. justify-content: space-between;
  431. margin: 10px 0;
  432. .input {
  433. margin: 0 5px 0 0;
  434. }
  435. .button {
  436. margin: 0 0 0 5px;
  437. }
  438. }
  439. .twoTwo {
  440. margin: 10px 0;
  441. .twoTable {
  442. display: flex;
  443. justify-content: space-between;
  444. color: $global-color-fff;
  445. font-size: $global-font-size-20;
  446. background-color: rgba(255, 255, 255, 0.1);
  447. padding: 12px 0;
  448. .label {
  449. text-align: center;
  450. }
  451. }
  452. .twoValue {
  453. color: $global-color-fff;
  454. font-size: $global-font-size-20;
  455. .value {
  456. display: flex;
  457. justify-content: space-between;
  458. padding: 12px 0;
  459. .table-colunm {
  460. width: 260px;
  461. text-align: center;
  462. }
  463. .table-colunm1 {
  464. width: 240px !important;
  465. }
  466. .table-colunm2 {
  467. width: 280px !important;
  468. }
  469. .button {
  470. cursor: pointer; /* 改变鼠标样式为手形 */
  471. }
  472. .button:hover {
  473. color: $global-color-107;
  474. }
  475. }
  476. .value:nth-child(2n) {
  477. background-color: rgba(255, 255, 255, 0.1);
  478. }
  479. }
  480. .twoTotal {
  481. display: flex;
  482. justify-content: center;
  483. margin: 20px 0;
  484. }
  485. }
  486. }
  487. </style>