趋势图变更

This commit is contained in:
hey7845
2021-12-28 15:42:34 +08:00
parent 68fe43b0fc
commit 6b3b786bd4
3 changed files with 118 additions and 28 deletions

3
src/api/ecology/dict.js Normal file
View File

@@ -0,0 +1,3 @@
import axios from 'axios';
// 查询全部字典项
export const getDictData = params => axios.get("/sys/dictdata",{params})

View File

@@ -75,6 +75,9 @@ const getGisArea = function(data){
const getTrendChart = function(data){ const getTrendChart = function(data){
return axios.post("/sound/road/noise/trend/chart",data) return axios.post("/sound/road/noise/trend/chart",data)
} }
const getPlaceByRegionLevel = function(column){
return axios.get("/sound/road/noise/place/region",{params:{column}})
}
export { export {
pageBillUrl, pageBillUrl,
saveRoadNoiseBill, saveRoadNoiseBill,
@@ -96,5 +99,6 @@ export {
getGisBase, getGisBase,
getGisArea, getGisArea,
roadNoiseYearEnd, roadNoiseYearEnd,
getTrendChart getTrendChart,
getPlaceByRegionLevel
} }

View File

@@ -23,14 +23,27 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="4" :md="8" :sm="24" :xs="24"> <a-col :lg="4" :md="8" :sm="24" :xs="24">
<a-form-item label="区:"> <a-form-item label="区域等级:">
<a-select mode="multiple" :default-value="['南宁']" v-model:value="queryParams.areaList" :options="areaOptions" placeholder="城区"> <a-select v-model:value="queryParams.regionLevel" @change="handleRegionLevelChange" allowClear placeholder="请选择等级">
<a-select-option v-for="(item) in regionLevelOptions" :key="item.value">{{ item.label }}</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="4" :md="8" :sm="24" :xs="24">
<a-form-item label="区域:">
<a-select mode="multiple" v-model:value="queryParams.areaList" :options="areaOptions" placeholder="请选择区域">
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="4" :md="8" :sm="24" :xs="24"> <a-col :lg="4" :md="8" :sm="24" :xs="24">
<a-form-item label="测点名称:"> <a-form-item label="测点名称:">
<a-select mode="multiple" v-model:value="queryParams.placeList" :options="placeOptions" placeholder="测点名称"> <a-select mode="multiple" v-model:value="queryParams.placeList" :options="placeOptions" placeholder="请选择测点名称">
</a-select>
</a-form-item>
</a-col>
<a-col :lg="4" :md="8" :sm="24" :xs="24">
<a-form-item label="横坐标:">
<a-select v-model:value="queryParams.xco" :options="xOptions" allowClear placeholder="请选择横坐标">
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -54,8 +67,12 @@
import { markRaw } from 'vue' import { markRaw } from 'vue'
import { import {
getColumnOptions, getColumnOptions,
getTrendChart getTrendChart,
getPlaceByRegionLevel
} from "@/api/ecology/noise/road-sound"; } from "@/api/ecology/noise/road-sound";
import {
getDictData,
} from "@/api/ecology/dict";
export default { export default {
components: {}, components: {},
data() { data() {
@@ -63,14 +80,27 @@
queryParams: { queryParams: {
startYear: 2020, startYear: 2020,
endYear: 2021, endYear: 2021,
areaList: [], areaList: ['南宁'],
placeList: [] placeList: [],
regionLevel: '市级', // 区域等级
xco: '年度' // 横坐标
}, },
trendData: [], trendData: [],
chartColumn: null, chartColumn: null,
regionLevelOptions: [],
placeOptions: [], placeOptions: [],
areaOptions: [], areaOptions: [],
yearOptions: [] yearOptions: [],
xOptions: [
{
label: '年度',
value: '年度',
},
{
label: '区域/测点名称',
value: '区域/测点名称',
}
]
}; };
}, },
mounted() { mounted() {
@@ -80,23 +110,6 @@
methods: { methods: {
// 下拉列表 // 下拉列表
loadOptionData() { loadOptionData() {
getColumnOptions("place").then((res) => {
this.placeOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
getColumnOptions("area").then((res) => {
this.areaOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
this.areaOptions.unshift({ label: '南宁市', value: '南宁'})
});
getColumnOptions("monitor_year").then((res) => { getColumnOptions("monitor_year").then((res) => {
this.yearOptions = res.data.data.map((item) => { this.yearOptions = res.data.data.map((item) => {
return { return {
@@ -105,6 +118,64 @@
}; };
}); });
}); });
getColumnOptions("region_level").then((res) => {
this.regionLevelOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
});
this.getArea()
},
// 区域下拉列表
getArea() {
getDictData({dictName:'城区行政区划代码'}).then(res=>{
this.areaOptions = res.data.data.map((item) => {
return {
label: item.dictDataName,
value: item.dictDataName,
};
});
this.areaOptions.unshift({ label: '南宁市', value: '南宁市'})
})
},
// 县级
getCounty() {
getDictData({dictName:'县行政区划代码'}).then(res=>{
this.areaOptions = res.data.data.map((item) => {
return {
label: item.dictDataName,
value: item.dictDataName,
};
});
this.areaOptions.unshift({ label: '所有县', value: '所有县'})
})
},
// 测点名称下拉列表
getPlace(regionLevel) {
console.log('regionLevel', regionLevel);
getPlaceByRegionLevel(regionLevel).then((res) => {
this.placeOptions = res.data.data.map((item) => {
return {
label: item,
value: item,
};
});
// this.placeOptions.unshift({ label: '所有测点', value: '所有测点'})
});
},
handleRegionLevelChange(value) {
console.log(`selected ${value}`);
this.queryParams.areaList = []
this.queryParams.placeList = []
if (value == '市级') {
this.getArea()
this.getPlace(value)
} else if (value == '县级') {
this.getCounty()
this.getPlace(value)
}
}, },
// 趋势图 // 趋势图
drawTrend() { drawTrend() {
@@ -119,10 +190,22 @@
}) })
}, },
initChart() { initChart() {
// const colors = ['#5470C6', '#91CC75', '#EE6666'];
this.trendData.yAxis[0].axisLabel = { this.trendData.yAxis[0].axisLabel = {
formatter: function (value) { return value.toFixed(1);} formatter: function (value) { return value.toFixed(1);},
}; }
echarts.init(document.getElementById("chartColumn")).dispose(); // this.trendData.yAxis[0].axisLine = {
// show: true,
// lineStyle: {
// color: colors[0]
// }
// }
// this.trendData.yAxis[1].axisLine = {
// show: true,
// lineStyle: {
// color: colors[1]
// }
// }
this.chartColumn = markRaw(echarts.init(document.getElementById('chartColumn'))) this.chartColumn = markRaw(echarts.init(document.getElementById('chartColumn')))
this.chartColumn.setOption({ this.chartColumn.setOption({
tooltip: { tooltip: {