resource.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <div id="resource">
  3. <el-row>
  4. <el-col :span="24">
  5. <div id="container">
  6. <!-- 自定义列表 -->
  7. <div style="width:220px" class="menus">
  8. <el-menu @select="typeSelect" background-color="#409eff" text-color="#fff" active-text-color="#fff">
  9. <el-submenu index="1">
  10. <template #title>
  11. <span>科技部门</span>
  12. </template>
  13. <el-menu-item index="1-1">科技部门</el-menu-item>
  14. </el-submenu>
  15. <el-submenu index="2">
  16. <template #title>
  17. <span>科研院所</span>
  18. </template>
  19. <el-menu-item index="2-1">科研院所</el-menu-item>
  20. </el-submenu>
  21. <el-submenu index="3">
  22. <template #title>
  23. <span>大专院校</span>
  24. </template>
  25. <el-menu-item index="3-1">大专院校</el-menu-item>
  26. </el-submenu>
  27. <el-submenu index="4">
  28. <template #title>
  29. <span>科技企业</span>
  30. </template>
  31. <el-menu-item index="4-1">高新技术企业</el-menu-item>
  32. <el-menu-item index="4-2">创新型企业</el-menu-item>
  33. </el-submenu>
  34. <el-submenu index="5">
  35. <template #title>
  36. <span>条件平台</span>
  37. </template>
  38. <el-menu-item index="5-1">重点实验室</el-menu-item>
  39. <el-menu-item index="5-2">工程技术研究中心</el-menu-item>
  40. <el-menu-item index="5-3">大学科技园</el-menu-item>
  41. <el-menu-item index="5-4">科技企业孵化器</el-menu-item>
  42. <el-menu-item index="5-5">产业化基地</el-menu-item>
  43. <el-menu-item index="5-6">技术转移示范机构</el-menu-item>
  44. <el-menu-item index="5-7">科技合作基地</el-menu-item>
  45. <el-menu-item index="5-8">院士工作站</el-menu-item>
  46. <el-menu-item index="5-9">技术创新联盟</el-menu-item>
  47. <el-menu-item index="5-10">科技创新中心</el-menu-item>
  48. <el-menu-item index="5-11">科技成果转化中试中心</el-menu-item>
  49. </el-submenu>
  50. <el-submenu index="6">
  51. <template #title>
  52. <span>服务机构(科技)</span>
  53. </template>
  54. <el-menu-item index="6-1">生产力促进中心</el-menu-item>
  55. <el-menu-item index="6-2">技术合同登记点</el-menu-item>
  56. <el-menu-item index="6-3">技术大市场</el-menu-item>
  57. <el-menu-item index="6-4">科技成功评价试点</el-menu-item>
  58. </el-submenu>
  59. <el-submenu index="7">
  60. <template #title>
  61. <span>重大项目</span>
  62. </template>
  63. <el-menu-item index="7-1">重大项目</el-menu-item>
  64. </el-submenu>
  65. <el-submenu index="8">
  66. <template #title>
  67. <span>科技奖励</span>
  68. </template>
  69. <el-menu-item index="8-1">科技奖励</el-menu-item>
  70. </el-submenu>
  71. </el-menu>
  72. </div>
  73. <!-- 搜索框 -->
  74. <el-amap-search-box class="search-box" :search-option="searchOption" :on-search-result="onSearchResult"></el-amap-search-box>
  75. <el-col :span="4" class="dataList">
  76. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  77. <el-tab-pane label="数据列表" name="first">
  78. <first :firstList="firstList" :total="firstTotal" @tabBtn="tabBtn"></first>
  79. </el-tab-pane>
  80. <el-tab-pane label="国家级" name="second">
  81. <first :firstList="secondList" :total="secondTotal" @tabBtn="tabBtn"></first>
  82. </el-tab-pane>
  83. <el-tab-pane label="省级" name="third">
  84. <first :firstList="thirdList" :total="thirdTotal" @tabBtn="tabBtn"></first>
  85. </el-tab-pane>
  86. <el-tab-pane label="科技部 吉林省共建" name="fourth">
  87. <first :firstList="fourthList" :total="fourthTotal" @tabBtn="tabBtn"></first>
  88. </el-tab-pane>
  89. </el-tabs>
  90. </el-col>
  91. <el-amap class="amap-box" :vid="'amap-vue'" :zoom="zoom" :center="center" :plugin="plugin">
  92. <!-- mark上方文字 -->
  93. <el-amap-text v-for="(t, index) in marktext" :key="`text${index}`" :text="t.text" :offset="[0, -50]" :position="t.position"></el-amap-text>
  94. <!-- 标记 -->
  95. <el-amap-marker
  96. v-for="(i, index) in markers"
  97. :key="`mark${index}`"
  98. :position="i.position"
  99. :events="i.events"
  100. :title="i.title"
  101. :address="i.address"
  102. :vid="index"
  103. ></el-amap-marker>
  104. <!-- 信息框体 -->
  105. <el-amap-info-window :position="window.position" :visible="window.visible" :events="window.events" :autoMove="true">
  106. <el-row>
  107. <el-col :span="24">
  108. <el-link type="primary">标题:{{ windowInfo.title }}</el-link>
  109. </el-col>
  110. <el-col :span="24">地址:{{ windowInfo.address || '暂无' }}</el-col>
  111. <el-col :span="24">简介:{{ windowInfo.introduction || '暂无' }}</el-col>
  112. </el-row>
  113. </el-amap-info-window>
  114. </el-amap>
  115. </div>
  116. </el-col>
  117. </el-row>
  118. </div>
  119. </template>
  120. <script>
  121. import first from './parts/first.vue';
  122. import { local } from '@/util/local';
  123. import {
  124. kjbm,
  125. kyys,
  126. dzyx,
  127. gxjsqy,
  128. cxxqy,
  129. zdsys,
  130. gcjsyjzx,
  131. dxkjy,
  132. kjqyfhq,
  133. cyhjd,
  134. jszysfjg,
  135. kjhzjd,
  136. ysgzz,
  137. jscxlm,
  138. kjcxzx,
  139. kjcgzhzszx,
  140. sccjzx,
  141. jshtdjd,
  142. jsdsc,
  143. kjcgpjsd,
  144. zdxm,
  145. kjjl,
  146. } from '@/util/kjbm';
  147. const _ = require('lodash');
  148. import { mapState, createNamespacedHelpers } from 'vuex';
  149. import VueAMap from 'vue-amap';
  150. import Vue from 'vue';
  151. Vue.use(VueAMap);
  152. export default {
  153. metaInfo() {
  154. return { title: this.$route.meta.title };
  155. },
  156. name: 'resource',
  157. props: {},
  158. components: {
  159. first,
  160. },
  161. data: function() {
  162. return {
  163. zoom: '17',
  164. center: [125.291162, 43.838597], //初始定位到中心
  165. // 标记点列表
  166. markers: [],
  167. // 标记点提示
  168. marktext: [],
  169. // 窗体信息
  170. window: {
  171. position: [125.291162, 43.838597],
  172. visible: false,
  173. },
  174. windowInfo: {},
  175. // 搜索框
  176. searchOption: {
  177. city: '长春',
  178. citylimit: true,
  179. },
  180. // 插件
  181. plugin: [
  182. {
  183. pName: 'Scale',
  184. events: {
  185. init(instance) {},
  186. },
  187. },
  188. ],
  189. // 1科技部门-kjbm
  190. kjbm: kjbm,
  191. // 2科研院所-kyys
  192. kyys: kyys,
  193. // 3大专院校-dzyx
  194. dzyx: dzyx,
  195. // 科技企业
  196. // 4高新技术企业-gxjsqy
  197. gxjsqy: gxjsqy,
  198. // 5创新型企业-cxxqy
  199. cxxqy: cxxqy,
  200. // 条件平台
  201. // 7重点实验室-zdsys
  202. zdsys: zdsys,
  203. // 8工程技术研究中心-gcjsyjzx
  204. gcjsyjzx: gcjsyjzx,
  205. // 9大学科技园-dxkjy
  206. dxkjy: dxkjy,
  207. // 10科技企业孵化器-,kjqyfhq
  208. kjqyfhq: kjqyfhq,
  209. // 11产品化基地-,cyhjd
  210. cyhjd: cyhjd,
  211. // 12技术转移示范机构-,jszysfjg
  212. jszysfjg: jszysfjg,
  213. // 13科技合作基地-,kjhzjd
  214. kjhzjd: kjhzjd,
  215. // 14院士工作站-,ysgzz
  216. ysgzz: ysgzz,
  217. // 15技术创新联盟-,jscxlm
  218. jscxlm: jscxlm,
  219. // 16科技创新中心-,kjcxzx
  220. kjcxzx: kjcxzx,
  221. // 17科技成果转化中试中心-,kjcgzhzszx
  222. kjcgzhzszx: kjcgzhzszx,
  223. // 服务机构(科技)
  224. // 18生产促进中心-,sccjzx
  225. sccjzx: sccjzx,
  226. // 19技术合同登记点-,jshtdjd
  227. jshtdjd: jshtdjd,
  228. // 20技术大市场-,jsdsc
  229. jsdsc: jsdsc,
  230. // 21科技成功评价试点-,kjcgpjsd
  231. kjcgpjsd: kjcgpjsd,
  232. // 22重大项目-,zdxm
  233. zdxm: zdxm,
  234. // 23科技奖励-,kjjl
  235. kjjl: kjjl,
  236. activeName: 'first',
  237. // 数据列表
  238. firstList: [],
  239. firstTotal: 0,
  240. // 国家级
  241. secondList: [],
  242. secondTotal: 0,
  243. // 省级
  244. thirdList: [],
  245. thirdTotal: 0,
  246. // 科技部
  247. fourthList: [],
  248. fourthTotal: 0,
  249. };
  250. },
  251. created() {
  252. this.handlemyMapFn();
  253. },
  254. methods: {
  255. // 搜索框回调
  256. onSearchResult(pois) {
  257. let latSum = 0;
  258. let lngSum = 0;
  259. if (pois.length > 0) {
  260. // 只处理第一个结果了
  261. const r = this.setMark(_.head(pois));
  262. const { position } = r;
  263. this.center = position;
  264. }
  265. },
  266. // 添加标记
  267. setMark(place) {
  268. let name = _.get(place, 'name');
  269. let introduction = _.get(place, 'introduction');
  270. let address = _.get(place, 'address');
  271. let lng = _.get(place, 'lng');
  272. let lat = _.get(place, 'lat');
  273. let position = [lng, lat];
  274. let obj = {
  275. position: position,
  276. events: {
  277. click: () => {
  278. this.markClick(position);
  279. },
  280. },
  281. title: `${name}`,
  282. introduction: `${introduction}`,
  283. address: `${address}`,
  284. label: { content: 'lable', offset: [3, 3] },
  285. desc: 'abc',
  286. };
  287. let text = {
  288. position: position,
  289. text: name,
  290. };
  291. let isDiff = this.markers.find(f => _.isEqual(f.position, position));
  292. if (!isDiff) {
  293. this.markers.push(obj);
  294. this.marktext.push(text);
  295. }
  296. return obj;
  297. },
  298. // 初始化地图
  299. handlemyMapFn() {
  300. VueAMap.initAMapApiLoader({
  301. key: '47947a002b2cddf99df02a1a5b1bc198',
  302. plugin: [
  303. 'AMap.PolyEditor', //编辑 折线多,边形
  304. 'AMap.PlaceSearch', // 查询
  305. 'AMap.Autocomplete',
  306. 'AMap.Scale',
  307. 'AMap.OverView',
  308. 'AMap.ToolBar',
  309. 'AMap.MapType',
  310. 'AMap.PolyEditor',
  311. 'AMap.CircleEditor',
  312. ], // 默认高德 sdk 版本为 1.4.4
  313. v: '1.4.4',
  314. });
  315. },
  316. // 标记点击
  317. markClick(posi) {
  318. const r = this.markers.find(f => _.isEqual(f.position, posi));
  319. // 设置窗口信息,自定义.反正在slot里的字段对上
  320. const info = {
  321. title: r.title,
  322. address: r.address,
  323. introduction: r.introduction,
  324. };
  325. this.$set(this, `windowInfo`, info);
  326. // 设置窗口信息
  327. const obj = {
  328. position: r.position,
  329. visible: true,
  330. events: {
  331. close: () => {
  332. // 初始化
  333. this.$set(this, `window`, { position: [125.291162, 43.838597], visible: false });
  334. },
  335. },
  336. };
  337. this.$set(this, `window`, obj);
  338. },
  339. // 点击导航菜单
  340. typeSelect(index) {
  341. this.$set(this, `markers`, []);
  342. this.$set(this, `marktext`, []);
  343. if (index === '1-1') {
  344. for (const i of this.kjbm) {
  345. this.setMark(i);
  346. }
  347. this.$set(this, `firstList`, this.kjbm);
  348. this.$set(this, `firstTotal`, this.kjbm.length);
  349. } else if (index === '2-1') {
  350. for (const i of this.kyys) {
  351. this.setMark(i);
  352. }
  353. this.$set(this, `firstList`, this.kyys);
  354. this.$set(this, `firstTotal`, this.kyys.length);
  355. } else if (index === '3-1') {
  356. for (const i of this.dzyx) {
  357. this.setMark(i);
  358. }
  359. this.$set(this, `firstList`, this.dzyx);
  360. this.$set(this, `firstTotal`, this.dzyx.length);
  361. } else if (index === '4-1') {
  362. let data = this.gxjsqy.filter(i => i.ing != '' && i.lat != '');
  363. for (const i of data) {
  364. this.setMark(i);
  365. }
  366. this.$set(this, `firstList`, this.gxjsqy);
  367. this.$set(this, `firstTotal`, this.gxjsqy.length);
  368. } else if (index === '4-2') {
  369. let data = this.cxxqy.filter(i => i.ing != '' && i.lat != '');
  370. for (const i of data) {
  371. this.setMark(i);
  372. }
  373. this.$set(this, `firstList`, this.cxxqy);
  374. this.$set(this, `firstTotal`, this.cxxqy.length);
  375. } else if (index === '5-1') {
  376. for (const i of this.zdsys) {
  377. this.setMark(i);
  378. }
  379. this.$set(this, `firstList`, this.zdsys);
  380. this.$set(this, `firstTotal`, this.zdsys.length);
  381. } else if (index === '5-2') {
  382. let data = this.gcjsyjzx.filter(i => i.ing != '' && i.lat != '');
  383. for (const i of data) {
  384. this.setMark(i);
  385. }
  386. this.$set(this, `firstList`, this.gcjsyjzx);
  387. this.$set(this, `firstTotal`, this.gcjsyjzx.length);
  388. } else if (index === '5-3') {
  389. for (const i of this.dxkjy) {
  390. this.setMark(i);
  391. }
  392. this.$set(this, `firstList`, this.dxkjy);
  393. this.$set(this, `firstTotal`, this.dxkjy.length);
  394. } else if (index === '5-4') {
  395. let data = this.kjqyfhq.filter(i => i.ing != '' && i.lat != '');
  396. for (const i of data) {
  397. this.setMark(i);
  398. }
  399. this.$set(this, `firstList`, this.kjqyfhq);
  400. this.$set(this, `firstTotal`, this.kjqyfhq.length);
  401. } else if (index === '5-5') {
  402. for (const i of this.cyhjd) {
  403. this.setMark(i);
  404. }
  405. this.$set(this, `firstList`, this.cyhjd);
  406. this.$set(this, `firstTotal`, this.cyhjd.length);
  407. } else if (index === '5-6') {
  408. for (const i of this.jszysfjg) {
  409. this.setMark(i);
  410. }
  411. this.$set(this, `firstList`, this.jszysfjg);
  412. this.$set(this, `firstTotal`, this.jszysfjg.length);
  413. } else if (index === '5-7') {
  414. for (const i of this.kjhzjd) {
  415. this.setMark(i);
  416. }
  417. this.$set(this, `firstList`, this.kjhzjd);
  418. this.$set(this, `firstTotal`, this.kjhzjd.length);
  419. } else if (index === '5-8') {
  420. let data = this.ysgzz.filter(i => i.ing != '' && i.lat != '');
  421. for (const i of data) {
  422. this.setMark(i);
  423. }
  424. this.$set(this, `firstList`, this.ysgzz);
  425. this.$set(this, `firstTotal`, this.ysgzz.length);
  426. } else if (index === '5-9') {
  427. let data = this.jscxlm.filter(i => i.ing != '' && i.lat != '');
  428. for (const i of data) {
  429. this.setMark(i);
  430. }
  431. this.$set(this, `firstList`, this.jscxlm);
  432. this.$set(this, `firstTotal`, this.jscxlm.length);
  433. } else if (index === '5-10') {
  434. for (const i of this.kjcxzx) {
  435. this.setMark(i);
  436. }
  437. this.$set(this, `firstList`, this.kjcxzx);
  438. this.$set(this, `firstTotal`, this.kjcxzx.length);
  439. } else if (index === '5-11') {
  440. let data = this.kjcgzhzszx.filter(i => i.ing != '' && i.lat != '');
  441. for (const i of data) {
  442. this.setMark(i);
  443. }
  444. this.$set(this, `firstList`, this.kjcgzhzszx);
  445. this.$set(this, `firstTotal`, this.kjcgzhzszx.length);
  446. } else if (index === '6-1') {
  447. let data = this.sccjzx.filter(i => i.ing != '' && i.lat != '');
  448. for (const i of data) {
  449. this.setMark(i);
  450. }
  451. this.$set(this, `firstList`, this.sccjzx);
  452. this.$set(this, `firstTotal`, this.sccjzx.length);
  453. } else if (index === '6-2') {
  454. for (const i of this.jshtdjd) {
  455. this.setMark(i);
  456. }
  457. this.$set(this, `firstList`, this.jshtdjd);
  458. this.$set(this, `firstTotal`, this.jshtdjd.length);
  459. } else if (index === '6-3') {
  460. for (const i of this.jsdsc) {
  461. this.setMark(i);
  462. }
  463. this.$set(this, `firstList`, this.jsdsc);
  464. this.$set(this, `firstTotal`, this.jsdsc.length);
  465. } else if (index === '6-4') {
  466. for (const i of this.kjcgpjsd) {
  467. this.setMark(i);
  468. }
  469. this.$set(this, `firstList`, this.kjcgpjsd);
  470. this.$set(this, `firstTotal`, this.kjcgpjsd.length);
  471. } else if (index === '7-1') {
  472. for (const i of this.zdxm) {
  473. this.setMark(i);
  474. }
  475. this.$set(this, `firstList`, this.zdxm);
  476. this.$set(this, `firstTotal`, this.zdxm.length);
  477. } else if (index === '8-1') {
  478. for (const i of this.kjjl) {
  479. this.setMark(i);
  480. }
  481. this.$set(this, `firstList`, this.kjjl);
  482. this.$set(this, `firstTotal`, this.kjjl.length);
  483. }
  484. },
  485. // 点击小分类
  486. handleClick(tab, event) {
  487. if (tab.index == '1') {
  488. let data = local.filter(i => i.xtype == '1');
  489. if (data) this.$set(this, `secondList`, data);
  490. this.$set(this, `secondTotal`, data.length);
  491. } else if (tab.index == '2') {
  492. let data = local.filter(i => i.xtype == '2');
  493. if (data) this.$set(this, `thirdList`, data);
  494. this.$set(this, `thirdTotal`, data.length);
  495. } else if (tab.index == '3') {
  496. let data = local.filter(i => i.xtype == '3');
  497. if (data) this.$set(this, `fourthList`, data);
  498. this.$set(this, `fourthTotal`, data.length);
  499. }
  500. },
  501. tabBtn(data) {
  502. let datas = [data];
  503. this.onSearchResult(datas);
  504. },
  505. },
  506. computed: {
  507. ...mapState(['user']),
  508. },
  509. };
  510. </script>
  511. <style lang="less" scoped>
  512. #container {
  513. width: 100%;
  514. height: 100vh;
  515. }
  516. .search-box {
  517. position: absolute;
  518. top: 25px;
  519. right: 20px;
  520. }
  521. .menus {
  522. position: absolute;
  523. top: 25px;
  524. left: 20px;
  525. z-index: 200;
  526. }
  527. /deep/.el-menu-item.is-active {
  528. background: #377ecc !important;
  529. }
  530. /deep/.el-submenu__title i {
  531. color: #fff;
  532. }
  533. .dataList {
  534. position: absolute;
  535. top: 75px;
  536. right: 20px;
  537. width: 19%;
  538. z-index: 1;
  539. min-height: 870px;
  540. background: #fff;
  541. }
  542. </style>