Commit d8bea079 authored by co_dengxiongwen's avatar co_dengxiongwen

tj

parent 44a8df15
...@@ -14,14 +14,14 @@ card-warp(title="室内气象分析", height="45px", showBackground) ...@@ -14,14 +14,14 @@ card-warp(title="室内气象分析", height="45px", showBackground)
el-button( el-button(
size="mini", size="mini",
type="primary", type="primary",
@click="handleDate(index)", @click="handleDate(item.id)",
v-for="(item, index) in typeList", v-for="(item, index) in typeList",
:key="index", :key="index",
:class="[index == currentActive ? 'isActive' : '']" :class="[item.id == currentActive ? 'isActive' : '']"
) {{ item.name }} ) {{ item.name }}
.echartsWarp(width="100%", flex) .echartsWarp(width="100%", flex)
div(v-for='item in chartList' :key='item.id') div(v-for='item in chartList' :key='item.id')
chart(:id="item.id", :data="data", :title="item.title", :color="item.color") chart(:id="item.id", :data="item.data", :title="item.title", :color="item.color")
</template> </template>
<script> <script>
...@@ -34,25 +34,17 @@ export default { ...@@ -34,25 +34,17 @@ export default {
return { return {
activeName: '1', activeName: '1',
typeList: [ typeList: [
{ name: '当日' }, { name: '当日', id: 1 },
{ name: '本周' }, { name: '本周', id: 2 },
{ name: '当月' }, { name: '当月', id: 3 },
{ name: '今年' } { name: '今年', id: 4 }
],
currentActive: '0',
data: [
['2019-8-14 8:00:00', 70],
['2019-8-14 8:00:01', 60],
['2019-8-14 8:00:02', 30],
['2019-8-14 8:00:03', 79],
['2019-8-14 8:00:06', 10],
['2019-8-14 8:00:20', 31]
], ],
currentActive: 1,
chartList: [ chartList: [
{ id: '11', title: '温度', color: '#21ACFC' }, { id: '11', title: '温度', color: '#21ACFC', data: [] },
{ id: '22', title: '湿度', color: '#36CBCB' }, { id: '22', title: '湿度', color: '#36CBCB', data: [] },
{ id: '55', title: 'CO2', color: '#4ECB74' }, { id: '33', title: 'CO2', color: '#4ECB74', data: [] },
{ id: '77', title: '故障报警', color: '#975FE4' } { id: '44', title: '故障报警', color: '#975FE4', data: [] }
] ]
} }
}, },
...@@ -60,8 +52,25 @@ export default { ...@@ -60,8 +52,25 @@ export default {
tabClick(tab, event) { tabClick(tab, event) {
console.log(tab, event) console.log(tab, event)
}, },
getDataList() {}, getDataList() {
// 当日 ,本周 this.$http({
url: this.$http.adornUrl('/analysis/getSnqxzInfoTj'),
method: 'get',
params: this.$http.adornParams({
region: Number(this.activeName), //区域类型
type: this.currentActive
})
}).then((data) => {
if (data && data.code === 0) {
// console.log('数据', data)
this.chartList[0].data = data.temperatureList
this.chartList[1].data = data.humidityList
this.chartList[2].data = data.carbonDioxideList
this.chartList[3].data = data.carbonDioxideList
}
})
},
// 当日 ,本周
handleDate(i) { handleDate(i) {
this.currentActive = i this.currentActive = i
} }
...@@ -113,7 +122,7 @@ export default { ...@@ -113,7 +122,7 @@ export default {
color: #000000; color: #000000;
line-height: 40px; line-height: 40px;
&::before { &::before {
content: ""; content: '';
display: inline-block; display: inline-block;
width: 10px; width: 10px;
height: 10px; height: 10px;
......
...@@ -11,16 +11,14 @@ card-warp(title="室外气象分析", height="45px", showBackground) ...@@ -11,16 +11,14 @@ card-warp(title="室外气象分析", height="45px", showBackground)
el-button( el-button(
size="mini", size="mini",
type="primary", type="primary",
@click="handleDate(index)", @click="handleDate(item.id)",
v-for="(item, index) in typeList", v-for="(item, index) in typeList",
:key="index", :key="index",
:class="[index == currentActive ? 'isActive' : '']" :class="[item.id == currentActive ? 'isActive' : '']"
) {{ item.name }} ) {{ item.name }}
.echartsWarp(width="100%", flex) .echartsWarp(width="100%", flex)
div(v-for='item in chartList' :key='item.id') div(v-for='item in chartList' :key='item.id')
chart(:id="item.id", :data="data", :title="item.title", :color="item.color") chart(:id="item.id", :data="item.data", :title="item.title", :color="item.color")
div
pie
</template> </template>
<script> <script>
...@@ -34,37 +32,54 @@ export default { ...@@ -34,37 +32,54 @@ export default {
data() { data() {
return { return {
chartList: [ chartList: [
{ id: '11', title: '温度', color: '#21ACFC' }, { id: '11', title: '温度', color: '#21ACFC', data: [] },
{ id: '22', title: '湿度', color: '#36CBCB' }, { id: '22', title: '湿度', color: '#36CBCB', data: [] },
{ id: '33', title: '风速', color: '#3AA0FF' }, { id: '33', title: '风速', color: '#3AA0FF', data: [] },
{ id: '44', title: '光照', color: '#FAD337' }, { id: '44', title: '光照', color: '#FAD337', data: [] },
{ id: '55', title: 'CO2', color: '#4ECB74' }, { id: '55', title: 'CO2', color: '#4ECB74', data: [] },
{ id: '66', title: 'PM2.5', color: '#999999' }, { id: '66', title: 'PM2.5', color: '#999999', data: [] },
{ id: '77', title: '辐射', color: '#975FE4' } { id: '77', title: '辐射', color: '#975FE4', data: [] },
], { id: '88', title: '故障报警数', color: '#F2637B', data: [] }
data: [
['2019-8-14 8:00:00', 70],
['2019-8-14 8:00:01', 60],
['2019-8-14 8:00:02', 30],
['2019-8-14 8:00:03', 79],
['2019-8-14 8:00:06', 10],
['2019-8-14 8:00:20', 31]
], ],
typeList: [ typeList: [
{ name: '当日' }, { name: '当日', id: 1 },
{ name: '本周' }, { name: '本周', id: 2 },
{ name: '当月' }, { name: '当月', id: 3 },
{ name: '今年' } { name: '今年', id: 4 }
], ],
currentActive: '0', currentActive: 1,
name: '室外气象站' name: '室外气象站'
} }
}, },
created() {
this.getDataList()
},
methods: { methods: {
getDataList() {}, getDataList() {
this.$http({
url: this.$http.adornUrl('/analysis/getSwqxzInfoTj'),
method: 'get',
params: this.$http.adornParams({
type: this.currentActive
})
}).then((data) => {
if (data && data.code === 0) {
// console.log('数据', data)
this.chartList[0].data = data.temperatureList
this.chartList[1].data = data.humidityList
this.chartList[2].data = data.windSpeedList
this.chartList[3].data = data.illuminanceList
this.chartList[4].data = data.carbonDioxideList
this.chartList[5].data = data.fineParticlesList
this.chartList[6].data = data.radiationList
this.chartList[7].data = data.radiationList
}
})
},
// 当日 ,本周 // 当日 ,本周
handleDate(i) { handleDate(i) {
this.currentActive = i this.currentActive = i
this.getDataList()
} }
} }
} }
...@@ -89,7 +104,7 @@ export default { ...@@ -89,7 +104,7 @@ export default {
color: #000000; color: #000000;
line-height: 40px; line-height: 40px;
&::before { &::before {
content: ""; content: '';
display: inline-block; display: inline-block;
width: 10px; width: 10px;
height: 10px; height: 10px;
......
...@@ -51,6 +51,7 @@ export default { ...@@ -51,6 +51,7 @@ export default {
currentActive: 1, currentActive: 1,
type: null, type: null,
pageSize: 10, pageSize: 10,
pageIndex: 1,
totalPage: 0, totalPage: 0,
visible: false, visible: false,
dataForm: { dataForm: {
......
...@@ -138,6 +138,7 @@ export default { ...@@ -138,6 +138,7 @@ export default {
dataList: [{ id: 1 }], dataList: [{ id: 1 }],
dataListLoading: false, dataListLoading: false,
pageSize: 10, pageSize: 10,
pageIndex: 1,
totalPage: 0 totalPage: 0
} }
}, },
......
...@@ -229,7 +229,7 @@ export default { ...@@ -229,7 +229,7 @@ export default {
}, },
getDataListTb() { getDataListTb() {
this.$http({ this.$http({
url: this.$http.adornUrl('/kanban/getSwqxzInfoTj'), url: this.$http.adornUrl('/analysis/getSwqxzInfoTj'),
method: 'get', method: 'get',
params: this.$http.adornParams({ params: this.$http.adornParams({
type: this.type type: this.type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment