index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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. </el-col>
  8. <div class="w_1200">
  9. <el-col :span="24" class="one">
  10. <el-row class="one_1" v-for="(val, indexs) in searchList" :key="indexs">
  11. <el-col :span="3" class="left">{{ val.title }}</el-col>
  12. <el-col :span="21" class="right">
  13. <a-button
  14. class="title"
  15. v-for="(item, index) in val.list"
  16. :key="index"
  17. type="link"
  18. size="samll"
  19. >
  20. {{ item.label }}
  21. </a-button>
  22. </el-col>
  23. </el-row>
  24. </el-col>
  25. <el-col :span="24" class="two">
  26. <a-list :loading="loading" :grid="{ gutter: 14, column: 4 }" :data-source="list">
  27. <template #renderItem="{ item }">
  28. <el-col :span="24" class="list">
  29. <el-col :span="24" class="name textOver">
  30. <el-tooltip effect="dark" :content="item.name" placement="top">
  31. {{ item.name || '暂无名称' }}
  32. </el-tooltip>
  33. </el-col>
  34. <el-col :span="24" class="two_1">
  35. <span>服务机构: </span>{{ item.unit || '暂无服务机构' }}
  36. </el-col>
  37. <el-col :span="24" class="two_1">
  38. <span>项目编号: </span>{{ item.no || '暂无项目编号' }}
  39. </el-col>
  40. <el-col :span="24" class="two_1">
  41. <span>发布日期: </span>{{ item.notice_time || '暂无发布日期' }}
  42. </el-col>
  43. <el-col :span="24" class="bottom">
  44. <div class="status">挂牌公告</div>
  45. <div class="button" @click="toView">查看详情</div>
  46. </el-col>
  47. </el-col>
  48. </template>
  49. </a-list>
  50. </el-col>
  51. <el-col :span="24" class="thr">
  52. <el-pagination
  53. background
  54. layout="total, prev, pager, next"
  55. :page-sizes="[10, 20, 50, 100, 200]"
  56. :total="total"
  57. :page-size="limit"
  58. v-model:current-page="currentPage"
  59. @current-change="changePage"
  60. @size-change="sizeChange"
  61. >
  62. </el-pagination>
  63. </el-col>
  64. </div>
  65. </el-col>
  66. </el-row>
  67. </div>
  68. </template>
  69. <script setup>
  70. const $checkRes = inject('$checkRes')
  71. import { get } from 'lodash-es'
  72. // 接口
  73. import { ProjectStore } from '@/store/api/platform/project'
  74. import { DictDataStore } from '@/store/api/system/dictData'
  75. const store = ProjectStore()
  76. const dictDataStore = DictDataStore()
  77. // 图片引入
  78. import demand from '@/assets/innovation.png'
  79. // 路由
  80. const router = useRouter()
  81. // 加载中
  82. const loading = ref(false)
  83. const searchForm = ref({})
  84. // 列表
  85. const list = ref([])
  86. let skip = 0
  87. let limit = inject('limit')
  88. const total = ref(20)
  89. // 字典表
  90. const fieldList = ref([])
  91. const searchList = ref([
  92. {
  93. title: '技术领域',
  94. list: [
  95. { value: '0', label: '全部' },
  96. { value: '1', label: '先进制造' },
  97. { value: '2', label: '地球、空间与海洋' },
  98. { value: '3', label: '新材料' },
  99. { value: '4', label: '新能源与节能' },
  100. { value: '5', label: '核应用技术' },
  101. { value: '6', label: '环境保护' },
  102. { value: '7', label: '现代交通' },
  103. { value: '8', label: '现代农业' },
  104. { value: '9', label: '生物医药与医疗器械' },
  105. { value: '10', label: '电子信息' },
  106. { value: '11', label: '航空航天' }
  107. ]
  108. },
  109. {
  110. title: '合作方式',
  111. list: [
  112. { value: '0', label: '全部' },
  113. { value: '1', label: '技术开发' },
  114. { value: '2', label: '技术咨询' },
  115. { value: '3', label: '技术服务' },
  116. { value: '4', label: '许可转让' },
  117. { value: '4', label: '完全转让' },
  118. { value: '4', label: '技术入股' },
  119. { value: '4', label: '合作开发' },
  120. { value: '4', label: '其他' }
  121. ]
  122. },
  123. {
  124. title: '需求地区',
  125. list: [
  126. { value: '0', label: '北京市' },
  127. { value: '1', label: '天津市' },
  128. { value: '2', label: '河北省' },
  129. { value: '3', label: '山西省' },
  130. { value: '4', label: '内蒙古自治区' },
  131. { value: '5', label: '辽宁省' },
  132. { value: '6', label: '吉林省' },
  133. { value: '7', label: '上海市' },
  134. { value: '8', label: '江苏省' },
  135. { value: '9', label: '浙江省' },
  136. { value: '10', label: '安徽省' },
  137. { value: '11', label: '福建省' },
  138. { value: '0', label: '江西省' },
  139. { value: '1', label: '山东省' },
  140. { value: '2', label: '河南省' },
  141. { value: '3', label: '湖北省' },
  142. { value: '4', label: '湖南省' },
  143. { value: '5', label: '广东省' },
  144. { value: '6', label: '广西壮族自治区' },
  145. { value: '7', label: '海南省' },
  146. { value: '8', label: '重庆市' },
  147. { value: '9', label: '四川省' },
  148. { value: '10', label: '贵州省' },
  149. { value: '11', label: '云南省' }
  150. ]
  151. },
  152. {
  153. title: '需求状态',
  154. list: [
  155. { value: '0', label: '全部' },
  156. { value: '1', label: '洽谈中' },
  157. { value: '2', label: '已结束' }
  158. ]
  159. }
  160. ])
  161. // 查看
  162. const toView = (item) => {
  163. router.push({ path: '/demand/detail', query: { id: item.id || item._id } })
  164. }
  165. // 请求
  166. onMounted(async () => {
  167. loading.value = true
  168. await searchOther()
  169. await search({ skip, limit })
  170. loading.value = false
  171. })
  172. const searchOther = async () => {
  173. let result
  174. // 技术领域
  175. result = await dictDataStore.query({ code: 'field', is_use: '0' })
  176. if ($checkRes(result)) fieldList.value = result.data
  177. }
  178. const search = async (query = { skip: 0, limit }) => {
  179. const info = {
  180. skip: query.skip,
  181. limit: query.limit,
  182. ...searchForm.value,
  183. is_use: '0',
  184. status: '1'
  185. }
  186. const res = await store.query(info)
  187. if (res.errcode == '0') {
  188. list.value = res.data
  189. total.value = res.total
  190. }
  191. }
  192. // 字典数据转换
  193. const getDict = (data, model) => {
  194. let res
  195. if (model == 'field') res = fieldList.value.find((f) => f.value == data)
  196. return get(res, 'label')
  197. }
  198. // 地区显示
  199. const getArea = (data) => {
  200. if (data) return data.join(',')
  201. }
  202. const currentPage = ref(1)
  203. // 分页
  204. const changePage = (page = currentPage.value) => {
  205. search({ skip: (page - 1) * limit, limit: limit })
  206. }
  207. const sizeChange = (limits) => {
  208. limit = limits
  209. currentPage.value = 1
  210. search({ skip: 0, limit: limit })
  211. }
  212. </script>
  213. <style lang="scss" scoped>
  214. .main {
  215. background: rgb(248, 248, 248);
  216. .idemand {
  217. .image {
  218. width: 100%;
  219. height: 200px;
  220. }
  221. }
  222. .one {
  223. background: #ffffff;
  224. border-radius: 10px;
  225. padding: 15px;
  226. margin: 10px 0 0 0;
  227. .one_1 {
  228. display: flex;
  229. align-items: center;
  230. padding: 10px 0;
  231. border-bottom: #9d9898 1px dashed;
  232. .left {
  233. background: #778cb3;
  234. border-radius: 15px;
  235. line-height: 26px;
  236. color: #fff;
  237. text-align: center;
  238. overflow: hidden;
  239. white-space: nowrap;
  240. text-overflow: ellipsis;
  241. font-family: PingFangSC-Medium;
  242. }
  243. .right {
  244. .title {
  245. color: #666;
  246. font-size: 14px;
  247. line-height: 15px;
  248. margin: 0 10px;
  249. display: inline-block;
  250. overflow: hidden;
  251. text-decoration: none;
  252. }
  253. .title:hover {
  254. color: #2374ff;
  255. }
  256. }
  257. }
  258. }
  259. .two {
  260. margin: 15px;
  261. .list {
  262. background: #fff;
  263. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.03);
  264. border-radius: 2px;
  265. width: 285px;
  266. height: 195px;
  267. margin-bottom: 15px;
  268. cursor: pointer;
  269. transition: all 0.3s;
  270. padding: 20px;
  271. .name {
  272. font-size: 16px;
  273. color: #121834;
  274. height: 16px;
  275. line-height: 13px;
  276. font-weight: 500;
  277. margin: 10px 0;
  278. }
  279. .name:hover {
  280. color: #2374ff;
  281. }
  282. .two_1 {
  283. font-size: 12px;
  284. text-align: justify;
  285. line-height: 12px;
  286. font-weight: 400;
  287. letter-spacing: 0;
  288. color: #8f97a3;
  289. margin-top: 15px;
  290. span:last-child {
  291. color: #525a68;
  292. }
  293. }
  294. .bottom {
  295. display: flex;
  296. align-items: center;
  297. justify-content: space-between;
  298. margin-top: 20px;
  299. .status {
  300. padding: 5px 12px;
  301. font-size: 12px;
  302. color: #2374ff;
  303. line-height: 12px;
  304. font-weight: 400;
  305. background: rgba(35, 116, 255, 0.05);
  306. border-radius: 16px;
  307. }
  308. .button {
  309. font-size: 12px;
  310. color: #fff;
  311. text-align: center;
  312. line-height: 12px;
  313. font-weight: 500;
  314. padding: 5px 12px;
  315. background: #2374ff;
  316. box-shadow: 0 3px 6px 0 rgba(35, 116, 255, 0.1);
  317. border-radius: 2px;
  318. }
  319. }
  320. }
  321. .list:hover {
  322. background: #f0f7ff;
  323. box-shadow: 0 0 16px rgba(205, 205, 205, 0.6);
  324. }
  325. }
  326. .thr {
  327. display: flex;
  328. flex-direction: row-reverse;
  329. padding: 20px;
  330. }
  331. }
  332. </style>