index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight">
  5. <el-col :span="24" class="idemand">
  6. <el-image class="image" :src="demand" fit="fill" />
  7. <div class="select">
  8. <el-row class="select_1">
  9. <el-col class="over" :span="4" v-if="oneList.length > 0">
  10. <div class="list">
  11. <div class="left">行业规模:</div>
  12. <div class="right">
  13. <div class="label" v-for="(item, index) in oneList" :key="index">
  14. {{ item.label }}<el-icon @click="toDel(item, 'one')"><Close /></el-icon>
  15. </div>
  16. </div>
  17. </div>
  18. </el-col>
  19. <el-col class="over" :span="4" v-if="twoList.length > 0">
  20. <div class="list">
  21. <div class="left">行业类型:</div>
  22. <div class="right">
  23. <div class="label" v-for="(item, index) in twoList" :key="index">
  24. {{ item.label }}<el-icon @click="toDel(item, 'two')"><Close /></el-icon>
  25. </div>
  26. </div>
  27. </div>
  28. </el-col>
  29. <el-col class="over" :span="4" v-if="thrList.length > 0">
  30. <div class="list">
  31. <div class="left">省份地区:</div>
  32. <div class="right">
  33. <div class="label" v-for="(item, index) in thrList" :key="index">
  34. {{ item.label }}<el-icon @click="toDel(item, 'thr')"><Close /></el-icon>
  35. </div>
  36. </div>
  37. </div>
  38. </el-col>
  39. <el-col class="over" :span="4" v-if="fourList.length > 0">
  40. <div class="list">
  41. <div class="left">行业分类:</div>
  42. <div class="right">
  43. <div class="label" v-for="(item, index) in fourList" :key="index">
  44. {{ item.label }}<el-icon @click="toDel(item, 'four')"><Close /></el-icon>
  45. </div>
  46. </div>
  47. </div>
  48. </el-col>
  49. <el-col class="over" :span="4" v-if="fiveList.length > 0">
  50. <div class="list">
  51. <div class="left">企业状态:</div>
  52. <div class="right">
  53. <div class="label" v-for="(item, index) in fiveList" :key="index">
  54. {{ item.label }}<el-icon @click="toDel(item, 'five')"><Close /></el-icon>
  55. </div>
  56. </div>
  57. </div>
  58. </el-col>
  59. </el-row>
  60. </div>
  61. </el-col>
  62. <div class="w_1200">
  63. <el-col :span="24" class="one">
  64. <el-row class="one_1">
  65. <el-col :span="3" class="left">行业规模</el-col>
  66. <el-col :span="21" class="right">
  67. <a-button
  68. class="title"
  69. v-for="(item, index) in scaleList"
  70. :key="index"
  71. type="link"
  72. size="samll"
  73. @click="toSelect(item, 'one')"
  74. :class="[item.is_active ? 'show' : '']"
  75. >
  76. {{ item.label }}
  77. </a-button>
  78. </el-col>
  79. </el-row>
  80. <el-row class="one_1">
  81. <el-col :span="3" class="left">行业类型</el-col>
  82. <el-col :span="21" class="right">
  83. <a-button
  84. class="title"
  85. v-for="(item, index) in patternList"
  86. :key="index"
  87. type="link"
  88. size="samll"
  89. @click="toSelect(item, 'two')"
  90. :class="[item.is_active ? 'show' : '']"
  91. >
  92. {{ item.label }}
  93. </a-button>
  94. </el-col>
  95. </el-row>
  96. <el-row class="one_1">
  97. <el-col :span="3" class="left">省份地区</el-col>
  98. <el-col :span="20" class="right" v-if="oneShow">
  99. <a-button
  100. class="title"
  101. v-for="(item, index) in cityList"
  102. :key="index"
  103. type="link"
  104. size="samll"
  105. @click="toSelect(item, 'thr')"
  106. :class="[item.is_active ? 'show' : '']"
  107. >
  108. {{ item.label }}
  109. </a-button>
  110. </el-col>
  111. <el-col :span="20" class="right" v-else>
  112. <a-button
  113. class="title"
  114. v-for="(item, index) in cityList.slice(0, 9)"
  115. :key="index"
  116. type="link"
  117. size="samll"
  118. @click="toSelect(item, 'thr')"
  119. :class="[item.is_active ? 'show' : '']"
  120. >
  121. {{ item.label }}
  122. </a-button>
  123. </el-col>
  124. <el-col :span="1" class="button">
  125. <span v-if="!oneShow" @click="oneShow = true">
  126. 更多
  127. <el-icon><ArrowDown /></el-icon>
  128. </span>
  129. <span v-else @click="oneShow = false">
  130. 收起
  131. <el-icon><ArrowUp /></el-icon>
  132. </span>
  133. </el-col>
  134. </el-row>
  135. <el-row class="one_1">
  136. <el-col :span="3" class="left">行业分类</el-col>
  137. <el-col :span="20" class="right" v-if="twoShow">
  138. <a-button
  139. class="title"
  140. v-for="(item, index) in IndustryList"
  141. :key="index"
  142. type="link"
  143. size="samll"
  144. @click="toSelect(item, 'four')"
  145. :class="[item.is_active ? 'show' : '']"
  146. >
  147. {{ item.label }}
  148. </a-button>
  149. </el-col>
  150. <el-col :span="20" class="right" v-else>
  151. <a-button
  152. class="title"
  153. v-for="(item, index) in IndustryList.slice(0, 5)"
  154. :key="index"
  155. type="link"
  156. size="samll"
  157. @click="toSelect(item, 'four')"
  158. :class="[item.is_active ? 'show' : '']"
  159. >
  160. {{ item.label }}
  161. </a-button>
  162. </el-col>
  163. <el-col :span="1" class="button">
  164. <span v-if="!twoShow" @click="twoShow = true">
  165. 更多
  166. <el-icon><ArrowDown /></el-icon>
  167. </span>
  168. <span v-else @click="twoShow = false">
  169. 收起
  170. <el-icon><ArrowUp /></el-icon>
  171. </span>
  172. </el-col>
  173. </el-row>
  174. <el-row class="one_1">
  175. <el-col :span="3" class="left">企业状态</el-col>
  176. <el-col :span="21" class="right">
  177. <a-button
  178. class="title"
  179. v-for="(item, index) in statusList"
  180. :key="index"
  181. type="link"
  182. size="samll"
  183. @click="toSelect(item, 'five')"
  184. :class="[item.is_active ? 'show' : '']"
  185. >
  186. {{ item.label }}
  187. </a-button>
  188. </el-col>
  189. </el-row>
  190. </el-col>
  191. <el-col :span="24" class="two">
  192. <el-col
  193. :span="24"
  194. class="list"
  195. v-for="(item, index) in list"
  196. :key="index"
  197. @click="toView(item)"
  198. >
  199. <el-col :span="4" class="left">
  200. <el-image class="image" :src="getUrl(item.logo)" fit="fill" />
  201. </el-col>
  202. <el-col :span="20" class="right">
  203. <el-col :span="24" class="right_1">
  204. <el-tooltip effect="dark" :content="item.name" placement="top">
  205. <span class="name"> {{ item.name || '暂无名称' }}</span>
  206. </el-tooltip>
  207. <el-col :span="2" class="tags">
  208. <el-tag :type="[item.companyStatus == '0' ? 'success' : 'info']">{{
  209. getDict(item.companyStatus, 'status')
  210. }}</el-tag>
  211. </el-col>
  212. </el-col>
  213. <el-col :span="24" class="right_2">
  214. <el-tag type="primary">{{ getDict(item.pattern, 'pattern') }}</el-tag>
  215. <el-tag type="primary">{{ getDict(item.scale, 'scale') }}</el-tag>
  216. </el-col>
  217. <el-col :span="24" class="right_3">
  218. <el-col :span="6" class="info">
  219. 法定代表人:<span>{{ item.representative || '暂无' }}</span>
  220. </el-col>
  221. <el-col :span="6" class="info">
  222. 成立日期:{{ moment(item.create_time).format('YYYY-MM-DD') }}
  223. </el-col>
  224. <el-col :span="8" class="info">
  225. 统一社会信用代码:{{ item.code || '暂无' }}
  226. </el-col>
  227. </el-col>
  228. <el-col :span="24" class="right_3">
  229. <el-col :span="6" class="info">电话:{{ item.phone || '暂无' }}</el-col>
  230. <el-col :span="6" class="info">邮箱:{{ item.email || '暂无' }}</el-col>
  231. </el-col>
  232. <el-col :span="24" class="right_3"> 地址:{{ item.address || '暂无' }} </el-col>
  233. </el-col>
  234. </el-col>
  235. </el-col>
  236. <el-col :span="24" class="thr">
  237. <el-pagination
  238. background
  239. layout="total, prev, pager, next"
  240. :page-sizes="[10, 20, 50, 100, 200]"
  241. :total="total"
  242. :page-size="limit"
  243. v-model:current-page="currentPage"
  244. @current-change="changePage"
  245. @size-change="sizeChange"
  246. >
  247. </el-pagination>
  248. </el-col>
  249. </div>
  250. </el-col>
  251. </el-row>
  252. </div>
  253. </template>
  254. <script setup>
  255. import moment from 'moment'
  256. // API 引用
  257. import { getCity } from '@/utils/city'
  258. const $checkRes = inject('$checkRes')
  259. import { get } from 'lodash-es'
  260. // 接口
  261. import { CompanyStore } from '@/store/api/user/company'
  262. import { DictDataStore } from '@/store/api/system/dictData'
  263. const store = CompanyStore()
  264. const dictDataStore = DictDataStore()
  265. // 图片引入
  266. import demand from '/images/innovation.png'
  267. // 路由
  268. const router = useRouter()
  269. // 加载中
  270. const loading = ref(false)
  271. // 列表
  272. const list = ref([])
  273. let skip = 0
  274. let limit = inject('limit')
  275. const total = ref(0)
  276. // 字典表
  277. const fieldList = ref([])
  278. const statusList = ref([])
  279. const patternList = ref([])
  280. const scaleList = ref([])
  281. // 字典表
  282. const IndustryList = ref([])
  283. const cityList = ref([])
  284. // 查询
  285. const oneList = ref([])
  286. const twoList = ref([])
  287. const thrList = ref([])
  288. const fourList = ref([])
  289. const fiveList = ref([])
  290. // 是否展开
  291. const oneShow = ref(false)
  292. const twoShow = ref(false)
  293. // 查看
  294. const toView = (item) => {
  295. router.push({ path: '/company/detail', query: { id: item.id || item._id } })
  296. }
  297. // 请求
  298. onMounted(async () => {
  299. loading.value = true
  300. await searchOther()
  301. await search({ skip, limit })
  302. loading.value = false
  303. })
  304. const searchOther = async () => {
  305. let result
  306. // 技术领域
  307. result = await dictDataStore.query({ code: 'field', is_use: '0' })
  308. if ($checkRes(result)) fieldList.value = result.data
  309. // 企业状态
  310. result = await dictDataStore.query({ code: 'companyStatus', is_use: '0' })
  311. if ($checkRes(result)) statusList.value = result.data
  312. // 企业类型
  313. result = await dictDataStore.query({ code: 'companyType', is_use: '0' })
  314. if ($checkRes(result)) patternList.value = result.data
  315. // 企业规模
  316. result = await dictDataStore.query({ code: 'companyScale', is_use: '0' })
  317. if ($checkRes(result)) scaleList.value = result.data
  318. // 企业所属行业
  319. result = await dictDataStore.query({ code: 'companyIndustry', is_use: '0' })
  320. if ($checkRes(result)) IndustryList.value = result.data
  321. // 城市
  322. getCity().then((response) => (cityList.value = response.address))
  323. }
  324. const search = async (query = { skip: 0, limit }) => {
  325. const info = {
  326. skip: query.skip,
  327. limit: query.limit,
  328. is_show: '0',
  329. status: '1'
  330. }
  331. if (oneList.value.length > 0) {
  332. const one = oneList.value.map((i) => {
  333. return i.value
  334. })
  335. info.one = one
  336. }
  337. if (twoList.value.length > 0) {
  338. info.two = twoList.value.map((i) => {
  339. return i.value
  340. })
  341. }
  342. if (thrList.value.length > 0) {
  343. info.thr = thrList.value.map((i) => {
  344. return i.label
  345. })
  346. }
  347. if (fourList.value.length > 0) {
  348. info.four = fourList.value.map((i) => {
  349. return i.value
  350. })
  351. }
  352. if (fiveList.value.length > 0) {
  353. info.five = fiveList.value.map((i) => {
  354. return i.value
  355. })
  356. }
  357. const res = await store.list(info)
  358. if (res.errcode == '0') {
  359. list.value = res.data
  360. total.value = res.total
  361. }
  362. }
  363. // 字典数据转换
  364. const getDict = (data, model) => {
  365. let res
  366. if (model == 'field') res = fieldList.value.find((f) => f.value == data)
  367. else if (model == 'status') res = statusList.value.find((f) => f.value == data)
  368. else if (model == 'pattern') res = patternList.value.find((f) => f.value == data)
  369. else if (model == 'scale') res = scaleList.value.find((f) => f.value == data)
  370. return get(res, 'label')
  371. }
  372. // 选择查询
  373. const toSelect = async (item, num) => {
  374. if (item.is_active) return
  375. if (num == 'one') {
  376. for (const val of scaleList.value) {
  377. if (val.value == item.value) val.is_active = true
  378. }
  379. const one = oneList.value.find((f) => f.value == item.value)
  380. if (!one) oneList.value.push(item)
  381. else oneList.value = oneList.value.filter((f) => f.value == item.value)
  382. }
  383. if (num == 'two') {
  384. for (const val of patternList.value) {
  385. if (val.value == item.value) val.is_active = true
  386. }
  387. const two = twoList.value.find((f) => f.value == item.value)
  388. if (!two) twoList.value.push(item)
  389. else twoList.value = twoList.value.filter((f) => f.value == item.value)
  390. }
  391. if (num == 'thr') {
  392. for (const val of cityList.value) {
  393. if (val.value == item.value) val.is_active = true
  394. }
  395. const thr = thrList.value.find((f) => f.value == item.value)
  396. if (!thr) thrList.value.push(item)
  397. else thrList.value = thrList.value.filter((f) => f.value == item.value)
  398. }
  399. if (num == 'four') {
  400. for (const val of IndustryList.value) {
  401. if (val.value == item.value) val.is_active = true
  402. }
  403. const four = fourList.value.find((f) => f.value == item.value)
  404. if (!four) fourList.value.push(item)
  405. else fourList.value = fourList.value.filter((f) => f.value == item.value)
  406. }
  407. if (num == 'five') {
  408. for (const val of statusList.value) {
  409. if (val.value == item.value) val.is_active = true
  410. }
  411. const five = fiveList.value.find((f) => f.value == item.value)
  412. if (!five) fiveList.value.push(item)
  413. else fiveList.value = fiveList.value.filter((f) => f.value == item.value)
  414. }
  415. loading.value = true
  416. await search({ skip, limit })
  417. loading.value = false
  418. }
  419. // 删除标签
  420. const toDel = async (item, type) => {
  421. if (type == 'one') {
  422. const one = oneList.value.filter((f) => f.value != item.value)
  423. oneList.value = one
  424. for (const i of scaleList.value) {
  425. if (i.value == item.value) i.is_active = !i.is_active
  426. }
  427. }
  428. if (type == 'two') {
  429. const two = twoList.value.filter((f) => f.value != item.value)
  430. twoList.value = two
  431. for (const i of patternList.value) {
  432. if (i.value == item.value) i.is_active = !i.is_active
  433. }
  434. }
  435. if (type == 'thr') {
  436. const thr = thrList.value.filter((f) => f.value != item.value)
  437. thrList.value = thr
  438. for (const i of cityList.value) {
  439. if (i.value == item.value) i.is_active = !i.is_active
  440. }
  441. }
  442. if (type == 'four') {
  443. const four = fourList.value.filter((f) => f.value != item.value)
  444. fourList.value = four
  445. for (const i of IndustryList.value) {
  446. if (i.value == item.value) i.is_active = !i.is_active
  447. }
  448. }
  449. if (type == 'five') {
  450. const five = fiveList.value.filter((f) => f.value != item.value)
  451. fiveList.value = five
  452. for (const i of statusList.value) {
  453. if (i.value == item.value) i.is_active = !i.is_active
  454. }
  455. }
  456. loading.value = true
  457. await search({ skip, limit })
  458. loading.value = false
  459. }
  460. const getUrl = (item) => {
  461. if (item) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
  462. }
  463. const currentPage = ref(1)
  464. // 分页
  465. const changePage = (page = currentPage.value) => {
  466. search({ skip: (page - 1) * limit, limit: limit })
  467. }
  468. const sizeChange = (limits) => {
  469. limit = limits
  470. currentPage.value = 1
  471. search({ skip: 0, limit: limit })
  472. }
  473. </script>
  474. <style lang="scss" scoped>
  475. .main {
  476. background: rgb(248, 248, 248);
  477. .idemand {
  478. position: relative;
  479. .image {
  480. width: 100%;
  481. height: 200px;
  482. }
  483. .select {
  484. width: 1200px;
  485. position: absolute;
  486. left: 18.5%;
  487. bottom: 10%;
  488. .select_1 {
  489. display: flex;
  490. align-items: flex-end;
  491. .over {
  492. max-height: 106px;
  493. overflow-y: auto;
  494. .list {
  495. border-radius: 5px;
  496. margin-right: 10px;
  497. background-color: #fff;
  498. padding: 5px;
  499. font-size: $global-font-size-18;
  500. .left {
  501. padding: 10px;
  502. }
  503. .right {
  504. .show {
  505. color: #2374ff !important;
  506. }
  507. display: flex;
  508. flex-wrap: wrap;
  509. .label {
  510. display: flex;
  511. align-items: center;
  512. margin: 3px;
  513. padding: 5px;
  514. background: #f5f5f5;
  515. border: 1px solid #f0f0f0;
  516. border-radius: 2px;
  517. }
  518. }
  519. }
  520. }
  521. .over::-webkit-scrollbar {
  522. display: none;
  523. }
  524. }
  525. }
  526. }
  527. .one {
  528. background: #ffffff;
  529. border-radius: 10px;
  530. padding: 15px;
  531. margin: 10px 0 0 0;
  532. .one_1 {
  533. display: flex;
  534. align-items: center;
  535. padding: 10px 0;
  536. border-bottom: #9d9898 1px dashed;
  537. .left {
  538. background: #2280ff;
  539. border-radius: 15px;
  540. line-height: 26px;
  541. color: #fff;
  542. text-align: center;
  543. overflow: hidden;
  544. white-space: nowrap;
  545. text-overflow: ellipsis;
  546. font-family: PingFangSC-Medium;
  547. }
  548. .right {
  549. .show {
  550. color: #2374ff !important;
  551. }
  552. .title {
  553. color: #666;
  554. font-size: $global-font-size-18;
  555. line-height: 15px;
  556. margin: 0 10px;
  557. display: inline-block;
  558. overflow: hidden;
  559. text-decoration: none;
  560. }
  561. .title:hover {
  562. color: #2374ff;
  563. }
  564. }
  565. .button {
  566. color: #2374ff;
  567. font-size: $global-font-size-14;
  568. cursor: pointer;
  569. }
  570. }
  571. }
  572. .two {
  573. margin-top: 20px;
  574. background: #ffffff;
  575. border-radius: 10px;
  576. padding: 15px;
  577. .list {
  578. display: flex;
  579. margin: 5px 0 0 0;
  580. padding: 5px;
  581. border-radius: 8px;
  582. border: 1px solid #f4f4f4;
  583. .left {
  584. text-align: center;
  585. .image {
  586. width: 150px;
  587. height: 150px;
  588. border-radius: 10px;
  589. }
  590. }
  591. .right {
  592. padding: 5px;
  593. .right_1 {
  594. display: flex;
  595. align-items: center;
  596. .name {
  597. margin: 0 10px 0 0;
  598. word-break: break-all;
  599. font-size: $global-font-size-20;
  600. font-family:
  601. PingFangSC-Regular,
  602. PingFang SC;
  603. font-weight: 500;
  604. line-height: 24px;
  605. overflow: hidden;
  606. text-overflow: ellipsis;
  607. display: -webkit-box;
  608. -webkit-line-clamp: 2;
  609. -webkit-box-orient: vertical;
  610. }
  611. .tags {
  612. grid-gap: 0.5rem;
  613. gap: 0.5rem;
  614. display: flex;
  615. }
  616. }
  617. .right_2 {
  618. grid-gap: 0.5rem;
  619. gap: 0.5rem;
  620. display: flex;
  621. margin: 10px 0;
  622. }
  623. .right_3 {
  624. display: flex;
  625. margin: 10px 0;
  626. font-size: $global-font-size-18;
  627. font-family:
  628. PingFangSC-Regular,
  629. PingFang SC;
  630. color: #666;
  631. .info {
  632. span {
  633. color: #2171f6;
  634. }
  635. }
  636. }
  637. }
  638. }
  639. .list:hover {
  640. box-shadow:
  641. 0 4px 5px -3px rgba(0, 0, 0, 0.06),
  642. 0 4px 12px 4px rgba(0, 0, 0, 0.06);
  643. }
  644. }
  645. .thr {
  646. display: flex;
  647. flex-direction: row-reverse;
  648. padding: 20px;
  649. }
  650. }
  651. </style>