HomeView.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <div id="LayoutContent">
  3. <MapHolder ref="mapLoaderRef"></MapHolder>
  4. <Header @navSelect="navSelect"></Header>
  5. <!-- 左侧菜单列 1 -- 首页 -->
  6. <div id="leftMenus" v-if="$ifMenu('1', '')">
  7. <MenuCard :menuData="menus.left[0]">
  8. <template slot="top">
  9. <TagTableCard :data="tagCardData2" />
  10. </template>
  11. <template slot="bottom">
  12. <ChartCard :title="'近三年农田面积变化'" />
  13. </template>
  14. </MenuCard>
  15. <MenuCard :menuData="menus.left[1]">
  16. <template slot="top">
  17. <div class="menuCardFlex">
  18. <TagCard :data="tagCardData"></TagCard>
  19. <TagCard :data="tagCardData"></TagCard>
  20. <TagCard :data="tagCardData"></TagCard>
  21. </div>
  22. </template>
  23. <template slot="bottom">
  24. <ChartCard :title="'近三年水域面积变化'" />
  25. </template>
  26. </MenuCard>
  27. <MenuCard :menuData="menus.left[2]">
  28. <template slot="top">
  29. <div class="menuCardFlex">
  30. <TagCard :data="tagCardData3"></TagCard>
  31. <TagCard :data="tagCardData3"></TagCard>
  32. </div>
  33. </template>
  34. <template slot="bottom">
  35. <ChartCard :title="'近三年林地面积变化'" />
  36. </template>
  37. </MenuCard>
  38. </div>
  39. <!-- 左侧菜单列 2 -- 疑点筛查 -->
  40. <div id="leftMenus" v-if="$ifMenu('2', '1')">
  41. <MenuCard :menuData="menus.left[3]"> </MenuCard>
  42. <MenuCard :menuData="menus.left[4]"> </MenuCard>
  43. <MenuCard :menuData="menus.left[5]"> </MenuCard>
  44. </div>
  45. <!-- 中部菜单列 -->
  46. <div id="mainMenus" v-if="$ifMenu('1', '')">
  47. <div id="mainMenus_topLeft">所属街道</div>
  48. <NewSelect
  49. id="mainMenus_topSelect"
  50. v-model="streetSelectVal"
  51. :options="streetOptions"
  52. :value="streetSelectVal"
  53. @selectEvent="selectEvent"
  54. />
  55. <div id="mainMenus_topRight">
  56. <MenuCard :menuData="menus.main[0]">
  57. <div class="bar-btn">
  58. <div
  59. class="btn-style"
  60. v-for="item in buttonData"
  61. :key="item"
  62. @click="clickEvent(item)"
  63. :class="{ 'button-selected': item === btnChecked }"
  64. >
  65. {{ item }}
  66. </div>
  67. </div>
  68. <div class="bar-content">
  69. <BarChart
  70. class="bar"
  71. :categoryData="categoryData"
  72. :soilValueData="soil"
  73. :waterValueData="water"
  74. :forestryValueData="forestry"
  75. :sourceType="btnChecked"
  76. />
  77. </div>
  78. </MenuCard>
  79. </div>
  80. <div class="legend-line"></div>
  81. <MenuCard id="mainMenus_bottomLegend" :menuData="{ type: 'chart', title: '图例', boxWidth: '150', boxHeight: '180' }"
  82. ><div class="legend-container">
  83. <div class="left-container">
  84. <div class="legend-icon" v-for="(item, index) in legendData" :key="index" :style="{ background: item }"></div>
  85. </div>
  86. <div class="right-container">
  87. <div class="lengend-title" v-for="item in buttonData" :key="item">{{ item }} 类</div>
  88. </div>
  89. </div>
  90. </MenuCard>
  91. </div>
  92. <!-- 右侧菜单列 -->
  93. <div id="rightMenus">
  94. <MenuCard :menuData="menus.right[0]" v-if="$ifMenu('1', '')">
  95. <template slot="top">
  96. <div class="menuCardFlex" style="justify-content: center">
  97. <TagCard :data="tagCardData3"></TagCard>
  98. </div>
  99. </template>
  100. <template slot="bottom"> <ChartCard :title="'近三年林地面积变化'" /> </template
  101. ></MenuCard>
  102. <MenuCard :menuData="menus.right[1]" v-if="$ifMenu('1', '')">
  103. <template slot="top">
  104. <div class="menuCardFlex">
  105. <TagCard :data="tagCardData"></TagCard>
  106. <TagCard :data="tagCardData"></TagCard>
  107. <TagCard :data="tagCardData"></TagCard>
  108. </div>
  109. </template>
  110. <template slot="bottom"> <ChartCard :title="'近三年审计项目变化'" /> </template
  111. ></MenuCard>
  112. <MenuCard :menuData="menus.right[2]" v-if="$ifMenu('1', '')">
  113. <template slot="top">
  114. <TopCard />
  115. </template>
  116. </MenuCard>
  117. <MenuCard :menuData="menus.right[3]" v-if="$ifMenu('2', '')">
  118. <template slot="top">
  119. <div class="menuCardFlex" style="justify-content: center">
  120. <TagCard :data="tagCardData3"></TagCard>
  121. </div>
  122. </template>
  123. <template slot="bottom"> <ChartCard :title="'近三年土地类问题变化'" /> </template
  124. ></MenuCard>
  125. <MenuCard :menuData="menus.right[4]" v-if="$ifMenu('2', '')">
  126. <template slot="top">
  127. <TopCard />
  128. </template>
  129. </MenuCard>
  130. </div>
  131. </div>
  132. </template>
  133. <script>
  134. import MapHolder from "@/components/map/MapHolder.vue";
  135. import Header from "@/components/layout/Header.vue";
  136. import MenuCard from "@/components/layout/MenuCard";
  137. import NewSelect from "@/components/common/NewSelect.vue";
  138. import BarChart from "@/components/chart/BarChart.vue";
  139. import {
  140. street,
  141. streetLocation,
  142. soilData,
  143. waterData,
  144. forestryData,
  145. } from "@/config/common";
  146. import TagCard from "@/components/common/TagCard";
  147. import ChartCard from "@/components/common/ChartCard.vue";
  148. import TagTableCard from "@/components/common/TagTableCard";
  149. import TopCard from "@/components/common/TopCard";
  150. export default {
  151. name: "HomeView",
  152. components: {
  153. MapHolder,
  154. Header,
  155. MenuCard,
  156. NewSelect,
  157. BarChart,
  158. TagCard,
  159. ChartCard,
  160. TagTableCard,
  161. TopCard,
  162. },
  163. data() {
  164. return {
  165. tagCardData: {
  166. type: "tb",
  167. title: "土地资源",
  168. value: 100,
  169. unit: "公顷"
  170. },
  171. tagCardData2: {
  172. type: "tb",
  173. title: "土地资源面积",
  174. value: 172,
  175. unit: "公顷"
  176. },
  177. tagCardData3: {
  178. type: "lr",
  179. title: "林地面积",
  180. value: 654,
  181. unit: "公顷"
  182. },
  183. testTitle: "土地资源",
  184. activeIndex: 1,
  185. menus: {
  186. left: [
  187. { type: "menu", title: "土地资源" },
  188. { type: "menu", title: "水资源" },
  189. { type: "menu", title: "林地资源" },
  190. { type: "imageMenu", title: "基本农田被违规占用", titleWidth: 81 },
  191. { type: "imageMenu", title: "基本农田种林", titleWidth: 81 },
  192. { type: "imageMenu", title: "基本农田抛荒", titleWidth: 81 },
  193. { type: "imageMenu", title: "一般耕地被违规占用", titleWidth: 81 }
  194. ],
  195. main: [
  196. {
  197. type: "chart",
  198. title: "浦东新区自然资源分布TOP10",
  199. boxWidth: "360",
  200. boxHeight: "370",
  201. boxBackground: "rgba(0,39,77,0.6)"
  202. }
  203. ],
  204. right: [
  205. { type: "menu", title: "资金投入情况", titleWidth: 64 },
  206. { type: "menu", title: "资源环境项目", titleWidth: 64 },
  207. { type: "menu", title: "历年频发问题TOP5", titleWidth: 81 },
  208. { type: "menu", title: "土地类问题", titleWidth: 60 },
  209. { type: "menu", title: "土地类问题TOP5", titleWidth: 81 }
  210. ]
  211. },
  212. buttonData: ["A", "B", "C"],
  213. legendData: ["#E565FF", "#0055FF", "#00FFD5"],
  214. btnChecked: "A",
  215. AData: {
  216. soil: [],
  217. water: [],
  218. forestry: []
  219. },
  220. BData: {
  221. soil: [],
  222. water: [],
  223. forestry: []
  224. },
  225. CData: {
  226. soil: [],
  227. water: [],
  228. forestry: []
  229. },
  230. streetSelectVal: "全部街道",
  231. streetOptions: []
  232. };
  233. },
  234. methods: {
  235. navSelect: function (data) {
  236. console.log(data);
  237. this.$store.commit("changeNavSelect", data);
  238. },
  239. clickEvent(type) {
  240. this.btnChecked = type;
  241. switch (type) {
  242. case "A":
  243. this.soil = this.AData.soil;
  244. this.water = this.AData.water;
  245. this.forestry = this.AData.forestry;
  246. break;
  247. case "B":
  248. this.soil = this.BData.soil;
  249. this.water = this.BData.water;
  250. this.forestry = this.BData.forestry;
  251. break;
  252. case "C":
  253. this.soil = this.CData.soil;
  254. this.water = this.CData.water;
  255. this.forestry = this.CData.forestry;
  256. break;
  257. }
  258. },
  259. selectEvent(val) {
  260. console.log(val, "current street");
  261. this.$refs.mapLoaderRef.setView(streetLocation[val],11);
  262. },
  263. },
  264. created() {
  265. // 目录
  266. this.categoryData = Object.keys(street);
  267. // 默认A类
  268. this.soil = [];
  269. this.water = [];
  270. this.forestry = [];
  271. for (let i in soilData) {
  272. this.AData.soil.push(soilData[i].A);
  273. this.BData.soil.push(soilData[i].B);
  274. this.CData.soil.push(soilData[i].C);
  275. }
  276. for (let i in waterData) {
  277. this.AData.water.push(waterData[i].A);
  278. this.BData.water.push(waterData[i].B);
  279. this.CData.water.push(waterData[i].C);
  280. }
  281. for (let i in forestryData) {
  282. this.AData.forestry.push(forestryData[i].A);
  283. this.BData.forestry.push(forestryData[i].B);
  284. this.CData.forestry.push(forestryData[i].C);
  285. }
  286. this.soil = this.AData.soil;
  287. this.water = this.AData.water;
  288. this.forestry = this.AData.forestry;
  289. // 街道下拉框
  290. for (let key in street) {
  291. this.streetOptions.push({
  292. value: street[key],
  293. label: street[key]
  294. });
  295. }
  296. }
  297. };
  298. </script>
  299. <style lang="less" scoped>
  300. #LayoutContent {
  301. position: relative;
  302. width: 100%;
  303. height: 100%;
  304. box-sizing: border-box;
  305. }
  306. /* 左侧菜单列 */
  307. #leftMenus {
  308. position: absolute;
  309. left: 10px;
  310. top: 60px;
  311. width: 414px;
  312. padding-right: 10px;
  313. margin-right: 10px;
  314. height: calc(100% - 60px);
  315. z-index: 999;
  316. box-sizing: border-box;
  317. overflow-x: hidden;
  318. overflow-y: auto;
  319. scrollbar-width: none; /* Firefox */
  320. -ms-overflow-style: none; /* IE 10+ */
  321. &::-webkit-scrollbar {
  322. display: none; /* Chrome Safari */
  323. }
  324. }
  325. #mainMenus {
  326. position: absolute;
  327. left: 430px;
  328. top: 60px;
  329. width: calc(100% - 850px);
  330. height: calc(100% - 60px);
  331. box-sizing: border-box;
  332. &_topLeft {
  333. position: absolute;
  334. left: 20px;
  335. top: 30px;
  336. font-size: 18px;
  337. z-index: 99999;
  338. color: #fff;
  339. }
  340. .legend-line {
  341. position: absolute;
  342. left: 20px;
  343. bottom: 211px;
  344. width: 104px;
  345. height: 20px;
  346. background: url("../assets/home/legend_line.png") no-repeat center;
  347. z-index: 99999;
  348. }
  349. &_bottomLegend {
  350. position: absolute;
  351. left: 20px;
  352. bottom: 30px;
  353. color: #fff;
  354. z-index: 99999;
  355. .legend-container {
  356. margin: 0 auto;
  357. width: 70%;
  358. height: 100%;
  359. position: relative;
  360. .left-container {
  361. width: 50%;
  362. height: 100%;
  363. position: absolute;
  364. left: 0;
  365. display: flex;
  366. flex-direction: column;
  367. justify-content: space-around;
  368. .legend-icon {
  369. width: 25px;
  370. height: 15px;
  371. background: #00aaff;
  372. border-radius: 2px;
  373. }
  374. }
  375. .right-container {
  376. width: 50%;
  377. height: 100%;
  378. position: absolute;
  379. right: 0;
  380. display: flex;
  381. flex-direction: column;
  382. align-items: center;
  383. justify-content: space-around;
  384. .legend-title {
  385. width: 30px;
  386. height: 20px;
  387. display: flex;
  388. align-items: center;
  389. justify-content: center;
  390. color: white;
  391. }
  392. }
  393. }
  394. }
  395. &_topSelect {
  396. position: absolute;
  397. left: 100px;
  398. top: 30px;
  399. z-index: 3;
  400. }
  401. &_topRight {
  402. position: absolute;
  403. right: 10px;
  404. top: 30px;
  405. z-index: 3;
  406. overflow: hidden;
  407. .bar-btn {
  408. width: 100%;
  409. height: 10%;
  410. display: flex;
  411. align-items: center;
  412. justify-content: center;
  413. .btn-style {
  414. width: 65px;
  415. height: 35px;
  416. background: url("../assets/home/btn_unselected.png") no-repeat center;
  417. margin-bottom: 2px;
  418. cursor: pointer;
  419. border-radius: 3px;
  420. display: flex;
  421. align-items: center;
  422. justify-content: center;
  423. color: #fff;
  424. }
  425. .button-selected {
  426. background: url("../assets/home/btn_selected.png") no-repeat center;
  427. }
  428. }
  429. .bar-content {
  430. width: 100%;
  431. height: 90%;
  432. background: rgba(100, 100, 100, 0);
  433. .bar {
  434. width: 100%;
  435. height: 98%;
  436. }
  437. }
  438. }
  439. }
  440. #rightMenus {
  441. position: absolute;
  442. right: 10px;
  443. top: 60px;
  444. width: 414px;
  445. height: calc(100% - 60px);
  446. z-index: 999999;
  447. box-sizing: border-box;
  448. overflow-x: hidden;
  449. overflow-y: auto;
  450. scrollbar-width: none; /* Firefox */
  451. -ms-overflow-style: none; /* IE 10+ */
  452. &::-webkit-scrollbar {
  453. display: none; /* Chrome Safari */
  454. }
  455. }
  456. .menuCardFlex {
  457. display: flex;
  458. align-content: center;
  459. align-items: center;
  460. justify-content: space-between;
  461. flex-wrap: nowrap;
  462. position: relative;
  463. .borders {
  464. position: absolute;
  465. left: 50%;
  466. top: 50%;
  467. transform: translate(-50%, -50%) rotate(45deg);
  468. width: 110px;
  469. height: 100px;
  470. background: linear-gradient(to left, #00aaff, #00aaff) left top no-repeat,
  471. linear-gradient(to bottom, #00aaff, #00aaff) left top no-repeat,
  472. linear-gradient(to left, #00aaff, #00aaff) right top no-repeat,
  473. linear-gradient(to bottom, #00aaff, #00aaff) right top no-repeat,
  474. linear-gradient(to left, #00aaff, #00aaff) left bottom no-repeat,
  475. linear-gradient(to bottom, #00aaff, #00aaff) left bottom no-repeat,
  476. linear-gradient(to left, #00aaff, #00aaff) right bottom no-repeat,
  477. linear-gradient(to left, #00aaff, #00aaff) right bottom no-repeat;
  478. background-size: 6px 6px, 6px 6px, 6px 6px, 6px 6px;
  479. }
  480. }
  481. </style>