123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- <template>
- <div id="LayoutContent">
- <MapHolder></MapHolder>
- <Header @navSelect="navSelect"></Header>
- <!-- 左侧菜单列 -->
- <div id="leftMenus">
- <MenuCard :type="menus.left[0].type" :title="menus.left[0].title" :boxHeight="menus.left[0].height">
- <template slot="top">
- <TagCard :data="tagCardData2"></TagCard>
- <TagCard :data="tagCardData2"></TagCard>
- </template>
- <template slot="bottom">主题下部插槽</template>
- </MenuCard>
- <MenuCard :type="menus.left[1].type" :title="menus.left[1].title" :boxHeight="menus.left[1].height">
- <template slot="top">
- <div class="displayFlex">
- <TagCard :data="tagCardData"></TagCard>
- <TagCard :data="tagCardData"></TagCard>
- <TagCard :data="tagCardData"></TagCard>
- </div>
- </template>
- </MenuCard>
- <MenuCard :type="menus.left[2].type" :title="menus.left[2].title" :boxHeight="menus.left[2].height"></MenuCard>
- </div>
- <!-- 中部菜单列 -->
- <div id="mainMenus">
- <div id="mainMenus_topLeft">所属街道</div>
- <NewSelect
- id="mainMenus_topSelect"
- v-model="streetSelectVal"
- :options="streetOptions"
- :value="streetSelectVal"
- />
- <div id="mainMenus_topRight">
- <MenuCard
- :type="menus.main[0].type"
- :title="menus.main[0].title"
- :boxWidth="menus.main[0].width"
- :boxHeight="menus.main[0].height"
- :boxBackground="menus.main[0].background"
- >
- <div class="bar-btn">
- <div
- class="btn-style"
- v-for="item in buttonData"
- :key="item"
- @click="clickEvent(item)"
- :class="{ 'button-selected': item === btnChecked }"
- >
- {{ item }}
- </div>
- </div>
- <div class="bar-content">
- <BarChart
- class="bar"
- :categoryData="categoryData"
- :soilValueData="soil"
- :waterValueData="water"
- :forestryValueData="forestry"
- :sourceType="btnChecked"
- />
- </div>
- </MenuCard>
- </div>
- </div>
- <!-- 右侧菜单列 -->
- <div id="rightMenus">
- <MenuCard
- :type="menus.right[0].type"
- :titleWidth="menus.right[0].titleWidth"
- :title="menus.right[0].title"
- :boxHeight="menus.right[0].height"
- ></MenuCard>
- <MenuCard
- :type="menus.right[1].type"
- :titleWidth="menus.right[1].titleWidth"
- :title="menus.right[1].title"
- :boxHeight="menus.right[1].height"
- ></MenuCard>
- <MenuCard
- :type="menus.right[2].type"
- :titleWidth="menus.right[2].titleWidth"
- :title="menus.right[2].title"
- :boxHeight="menus.right[2].height"
- ></MenuCard>
- </div>
- </div>
- </template>
- <script>
- import MapHolder from "@/components/map/MapHolder.vue";
- import Header from "@/components/layout/Header.vue";
- import MenuCard from "@/components/layout/MenuCard";
- import NewSelect from "@/components/common/NewSelect.vue";
- import BarChart from "@/components/chart/BarChart.vue";
- import { street, soilData, waterData, forestryData } from "@/config/common";
- import TagCard from "@/components/common/TagCard";
- export default {
- name: "HomeView",
- components: {
- MapHolder,
- Header,
- MenuCard,
- NewSelect,
- BarChart,
- TagCard
- },
- data() {
- return {
- tagCardData: {
- type:"tb",
- title: "土地资源",
- value: 100,
- unit: "公顷"
- },
- tagCardData2: {
- type:"lr",
- title: "土地资源",
- value: 100,
- unit: "公顷"
- },
- testTitle: "土地资源",
- activeIndex: 1,
- menus: {
- left: [
- { type: "menu", title: "土地资源" },
- { type: "menu", title: "水资源" },
- { type: "menu", title: "林地资源" },
- ],
- main: [
- {
- type: "chart",
- title: "浦东新区自然资源分布TOP10",
- width: "360",
- height: "370",
- background: "rgba(0,39,77,0.6)",
- },
- ],
- right: [
- { type: "menu", title: "资金投入情况", titleWidth: 62 },
- { type: "menu", title: "资源环境项目", titleWidth: 62 },
- { type: "menu", title: "历年频发问题TOP5", titleWidth: 82 },
- ],
- },
- buttonData: ["A", "B", "C"],
- btnChecked: "A",
- AData: {
- soil: [],
- water: [],
- forestry: [],
- },
- BData: {
- soil: [],
- water: [],
- forestry: [],
- },
- CData: {
- soil: [],
- water: [],
- forestry: [],
- },
- streetSelectVal: "全部街道",
- streetOptions: [],
- };
- },
- methods: {
- navSelect: function (data) {
- console.log(data);
- },
- clickEvent(type) {
- this.btnChecked = type;
- switch (type) {
- case "A":
- this.soil = this.AData.soil;
- this.water = this.AData.water;
- this.forestry = this.AData.forestry;
- break;
- case "B":
- this.soil = this.BData.soil;
- this.water = this.BData.water;
- this.forestry = this.BData.forestry;
- break;
- case "C":
- this.soil = this.CData.soil;
- this.water = this.CData.water;
- this.forestry = this.CData.forestry;
- break;
- }
- },
- },
- created() {
- // 目录
- this.categoryData = Object.keys(street);
- // 默认A类
- this.soil = [];
- this.water = [];
- this.forestry = [];
- for (let i in soilData) {
- this.AData.soil.push(soilData[i].A);
- this.BData.soil.push(soilData[i].B);
- this.CData.soil.push(soilData[i].C);
- }
- for (let i in waterData) {
- this.AData.water.push(waterData[i].A);
- this.BData.water.push(waterData[i].B);
- this.CData.water.push(waterData[i].C);
- }
- for (let i in forestryData) {
- this.AData.forestry.push(forestryData[i].A);
- this.BData.forestry.push(forestryData[i].B);
- this.CData.forestry.push(forestryData[i].C);
- }
- this.soil = this.AData.soil;
- this.water = this.AData.water;
- this.forestry = this.AData.forestry;
- // 街道下拉框
- for (let key in street) {
- this.streetOptions.push({
- value: street[key],
- label: street[key],
- });
- }
- },
- };
- </script>
- <style lang="less" scoped>
- #LayoutContent {
- position: relative;
- width: 100%;
- height: 100%;
- box-sizing: border-box;
- }
- /* 左侧菜单列 */
- #leftMenus {
- position: absolute;
- left: 10px;
- top: 60px;
- width: 410px;
- height: calc(100% - 60px);
- z-index: 999999;
- box-sizing: border-box;
- }
- #mainMenus {
- position: absolute;
- left: 430px;
- top: 60px;
- width: calc(100% - 850px);
- height: calc(100% - 60px);
- box-sizing: border-box;
- &_topLeft {
- position: absolute;
- left: 20px;
- top: 30px;
- font-size: 18px;
- z-index: 99999;
- color: #fff;
- }
- &_topSelect {
- position: absolute;
- left: 100px;
- top: 30px;
- z-index: 99999;
- }
- &_topRight {
- position: absolute;
- right: 10px;
- top: 30px;
- z-index: 999999;
- .bar-btn {
- width: 100%;
- height: 10%;
- display: flex;
- align-items: center;
- justify-content: center;
- .btn-style {
- width: 65px;
- height: 35px;
- background: url("../assets/home/btn_unselected.png") no-repeat center;
- margin-bottom: 2px;
- cursor: pointer;
- border-radius: 3px;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #fff;
- }
- .button-selected {
- background: url("../assets/home/btn_selected.png") no-repeat center;
- }
- }
- .bar-content {
- width: 100%;
- height: 90%;
- background: rgba(100,100,100,0.3);
- .bar {
- width: 95%;
- height: 98%;
- }
- }
- }
- }
- #rightMenus {
- position: absolute;
- right: 10px;
- top: 60px;
- width: 410px;
- height: calc(100% - 60px);
- z-index: 999999;
- box-sizing: border-box;
- }
- .displayFlex {
- display: flex;
- align-content: center;
- align-items: center;
- justify-content: space-around;
- flex-wrap: nowrap;
- }
- </style>
|