HomeView.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <div id="LayoutContent">
  3. <MapHolder></MapHolder>
  4. <Header @navSelect="navSelect"></Header>
  5. <!-- 左侧菜单列 -->
  6. <div id="leftMenus">
  7. <MenuCard :type="menus.left[0].type" :title="menus.left[0].title" :boxHeight="menus.left[0].height">
  8. <template slot="top">
  9. <TagCard :data="tagCardData2"></TagCard>
  10. <TagCard :data="tagCardData2"></TagCard>
  11. </template>
  12. <template slot="bottom">主题下部插槽</template>
  13. </MenuCard>
  14. <MenuCard :type="menus.left[1].type" :title="menus.left[1].title" :boxHeight="menus.left[1].height">
  15. <template slot="top">
  16. <div class="displayFlex">
  17. <TagCard :data="tagCardData"></TagCard>
  18. <TagCard :data="tagCardData"></TagCard>
  19. <TagCard :data="tagCardData"></TagCard>
  20. </div>
  21. </template>
  22. </MenuCard>
  23. <MenuCard :type="menus.left[2].type" :title="menus.left[2].title" :boxHeight="menus.left[2].height"></MenuCard>
  24. </div>
  25. <!-- 中部菜单列 -->
  26. <div id="mainMenus">
  27. <div id="mainMenus_topLeft">所属街道</div>
  28. <NewSelect
  29. id="mainMenus_topSelect"
  30. v-model="streetSelectVal"
  31. :options="streetOptions"
  32. :value="streetSelectVal"
  33. />
  34. <div id="mainMenus_topRight">
  35. <MenuCard
  36. :type="menus.main[0].type"
  37. :title="menus.main[0].title"
  38. :boxWidth="menus.main[0].width"
  39. :boxHeight="menus.main[0].height"
  40. :boxBackground="menus.main[0].background"
  41. >
  42. <div class="bar-btn">
  43. <div
  44. class="btn-style"
  45. v-for="item in buttonData"
  46. :key="item"
  47. @click="clickEvent(item)"
  48. :class="{ 'button-selected': item === btnChecked }"
  49. >
  50. {{ item }}
  51. </div>
  52. </div>
  53. <div class="bar-content">
  54. <BarChart
  55. class="bar"
  56. :categoryData="categoryData"
  57. :soilValueData="soil"
  58. :waterValueData="water"
  59. :forestryValueData="forestry"
  60. :sourceType="btnChecked"
  61. />
  62. </div>
  63. </MenuCard>
  64. </div>
  65. </div>
  66. <!-- 右侧菜单列 -->
  67. <div id="rightMenus">
  68. <MenuCard
  69. :type="menus.right[0].type"
  70. :titleWidth="menus.right[0].titleWidth"
  71. :title="menus.right[0].title"
  72. :boxHeight="menus.right[0].height"
  73. ></MenuCard>
  74. <MenuCard
  75. :type="menus.right[1].type"
  76. :titleWidth="menus.right[1].titleWidth"
  77. :title="menus.right[1].title"
  78. :boxHeight="menus.right[1].height"
  79. ></MenuCard>
  80. <MenuCard
  81. :type="menus.right[2].type"
  82. :titleWidth="menus.right[2].titleWidth"
  83. :title="menus.right[2].title"
  84. :boxHeight="menus.right[2].height"
  85. ></MenuCard>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import MapHolder from "@/components/map/MapHolder.vue";
  91. import Header from "@/components/layout/Header.vue";
  92. import MenuCard from "@/components/layout/MenuCard";
  93. import NewSelect from "@/components/common/NewSelect.vue";
  94. import BarChart from "@/components/chart/BarChart.vue";
  95. import { street, soilData, waterData, forestryData } from "@/config/common";
  96. import TagCard from "@/components/common/TagCard";
  97. export default {
  98. name: "HomeView",
  99. components: {
  100. MapHolder,
  101. Header,
  102. MenuCard,
  103. NewSelect,
  104. BarChart,
  105. TagCard
  106. },
  107. data() {
  108. return {
  109. tagCardData: {
  110. type:"tb",
  111. title: "土地资源",
  112. value: 100,
  113. unit: "公顷"
  114. },
  115. tagCardData2: {
  116. type:"lr",
  117. title: "土地资源",
  118. value: 100,
  119. unit: "公顷"
  120. },
  121. testTitle: "土地资源",
  122. activeIndex: 1,
  123. menus: {
  124. left: [
  125. { type: "menu", title: "土地资源" },
  126. { type: "menu", title: "水资源" },
  127. { type: "menu", title: "林地资源" },
  128. ],
  129. main: [
  130. {
  131. type: "chart",
  132. title: "浦东新区自然资源分布TOP10",
  133. width: "360",
  134. height: "370",
  135. background: "rgba(0,39,77,0.6)",
  136. },
  137. ],
  138. right: [
  139. { type: "menu", title: "资金投入情况", titleWidth: 62 },
  140. { type: "menu", title: "资源环境项目", titleWidth: 62 },
  141. { type: "menu", title: "历年频发问题TOP5", titleWidth: 82 },
  142. ],
  143. },
  144. buttonData: ["A", "B", "C"],
  145. btnChecked: "A",
  146. AData: {
  147. soil: [],
  148. water: [],
  149. forestry: [],
  150. },
  151. BData: {
  152. soil: [],
  153. water: [],
  154. forestry: [],
  155. },
  156. CData: {
  157. soil: [],
  158. water: [],
  159. forestry: [],
  160. },
  161. streetSelectVal: "全部街道",
  162. streetOptions: [],
  163. };
  164. },
  165. methods: {
  166. navSelect: function (data) {
  167. console.log(data);
  168. },
  169. clickEvent(type) {
  170. this.btnChecked = type;
  171. switch (type) {
  172. case "A":
  173. this.soil = this.AData.soil;
  174. this.water = this.AData.water;
  175. this.forestry = this.AData.forestry;
  176. break;
  177. case "B":
  178. this.soil = this.BData.soil;
  179. this.water = this.BData.water;
  180. this.forestry = this.BData.forestry;
  181. break;
  182. case "C":
  183. this.soil = this.CData.soil;
  184. this.water = this.CData.water;
  185. this.forestry = this.CData.forestry;
  186. break;
  187. }
  188. },
  189. },
  190. created() {
  191. // 目录
  192. this.categoryData = Object.keys(street);
  193. // 默认A类
  194. this.soil = [];
  195. this.water = [];
  196. this.forestry = [];
  197. for (let i in soilData) {
  198. this.AData.soil.push(soilData[i].A);
  199. this.BData.soil.push(soilData[i].B);
  200. this.CData.soil.push(soilData[i].C);
  201. }
  202. for (let i in waterData) {
  203. this.AData.water.push(waterData[i].A);
  204. this.BData.water.push(waterData[i].B);
  205. this.CData.water.push(waterData[i].C);
  206. }
  207. for (let i in forestryData) {
  208. this.AData.forestry.push(forestryData[i].A);
  209. this.BData.forestry.push(forestryData[i].B);
  210. this.CData.forestry.push(forestryData[i].C);
  211. }
  212. this.soil = this.AData.soil;
  213. this.water = this.AData.water;
  214. this.forestry = this.AData.forestry;
  215. // 街道下拉框
  216. for (let key in street) {
  217. this.streetOptions.push({
  218. value: street[key],
  219. label: street[key],
  220. });
  221. }
  222. },
  223. };
  224. </script>
  225. <style lang="less" scoped>
  226. #LayoutContent {
  227. position: relative;
  228. width: 100%;
  229. height: 100%;
  230. box-sizing: border-box;
  231. }
  232. /* 左侧菜单列 */
  233. #leftMenus {
  234. position: absolute;
  235. left: 10px;
  236. top: 60px;
  237. width: 410px;
  238. height: calc(100% - 60px);
  239. z-index: 999999;
  240. box-sizing: border-box;
  241. }
  242. #mainMenus {
  243. position: absolute;
  244. left: 430px;
  245. top: 60px;
  246. width: calc(100% - 850px);
  247. height: calc(100% - 60px);
  248. box-sizing: border-box;
  249. &_topLeft {
  250. position: absolute;
  251. left: 20px;
  252. top: 30px;
  253. font-size: 18px;
  254. z-index: 99999;
  255. color: #fff;
  256. }
  257. &_topSelect {
  258. position: absolute;
  259. left: 100px;
  260. top: 30px;
  261. z-index: 99999;
  262. }
  263. &_topRight {
  264. position: absolute;
  265. right: 10px;
  266. top: 30px;
  267. z-index: 999999;
  268. .bar-btn {
  269. width: 100%;
  270. height: 10%;
  271. display: flex;
  272. align-items: center;
  273. justify-content: center;
  274. .btn-style {
  275. width: 65px;
  276. height: 35px;
  277. background: url("../assets/home/btn_unselected.png") no-repeat center;
  278. margin-bottom: 2px;
  279. cursor: pointer;
  280. border-radius: 3px;
  281. display: flex;
  282. align-items: center;
  283. justify-content: center;
  284. color: #fff;
  285. }
  286. .button-selected {
  287. background: url("../assets/home/btn_selected.png") no-repeat center;
  288. }
  289. }
  290. .bar-content {
  291. width: 100%;
  292. height: 90%;
  293. background: rgba(100,100,100,0.3);
  294. .bar {
  295. width: 95%;
  296. height: 98%;
  297. }
  298. }
  299. }
  300. }
  301. #rightMenus {
  302. position: absolute;
  303. right: 10px;
  304. top: 60px;
  305. width: 410px;
  306. height: calc(100% - 60px);
  307. z-index: 999999;
  308. box-sizing: border-box;
  309. }
  310. .displayFlex {
  311. display: flex;
  312. align-content: center;
  313. align-items: center;
  314. justify-content: space-around;
  315. flex-wrap: nowrap;
  316. }
  317. </style>