|
@@ -10,6 +10,8 @@ export default {
|
|
|
data() {
|
|
|
let range = this.$util.dateUtil.getNearlyMonthRange();
|
|
|
return {
|
|
|
+ today: this.$moment(range.endDate, 'YYYY/MM/DD'),
|
|
|
+ envData: [],
|
|
|
queryData: {
|
|
|
companyId: '0',
|
|
|
deptId: '0',
|
|
@@ -63,7 +65,10 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- this.$store.loadingStore().loadingWithApi(this.getCoreData(), 2000)
|
|
|
+ this.$util.asyncPromise(
|
|
|
+ this.getCoreData(),
|
|
|
+ this.getEnvInfo(),
|
|
|
+ );
|
|
|
},
|
|
|
reset() {
|
|
|
console.log('reset')
|
|
@@ -85,6 +90,32 @@ export default {
|
|
|
this.coreData[3].content = res.list[3].value
|
|
|
this.coreData[4].content = res.worthAttention
|
|
|
})
|
|
|
+ },
|
|
|
+ getEnvInfo(date) {
|
|
|
+ if (date) {
|
|
|
+ this.queryData['date'] = date;
|
|
|
+ } else {
|
|
|
+ this.queryData['date'] = this.today;
|
|
|
+ }
|
|
|
+
|
|
|
+ return apiLifeHealthyHome.getEnvironmentalDetection(this.queryData).then(res=>{
|
|
|
+ let envData = [];
|
|
|
+ res.forEach(item=>{
|
|
|
+ let obj = {};
|
|
|
+ obj['title'] = item.title.toUpperCase();
|
|
|
+ obj['value'] = item.value;
|
|
|
+ if (item.type == '1') {
|
|
|
+ obj['icon'] = 'life/'+item.key+'_green.png';
|
|
|
+ } else {
|
|
|
+ obj['icon'] = 'life/'+item.key+'_blue.png';
|
|
|
+ }
|
|
|
+ envData.push(obj)
|
|
|
+ });
|
|
|
+ this.envData = envData;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onEnvDateChange(val) {
|
|
|
+ this.getEnvInfo(val);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -123,6 +154,10 @@ export default {
|
|
|
<div class="lifeHealthyHome-right">
|
|
|
<div class="lifeHealthyHome-top ioc-card-content">
|
|
|
<Card title="环境监测">
|
|
|
+ <template #title-extra>
|
|
|
+ <a-date-picker size="small" style="width: 120px" :default-value="today" :valueFormat="'YYYY/MM/DD'" @change="onEnvDateChange" />
|
|
|
+ </template>
|
|
|
+
|
|
|
<a-row :gutter="[12,18]" style="padding: 12px">
|
|
|
<a-col style="color: #B3B3B3">
|
|
|
<div style="width: 50%;display: inline-block;text-align: center">
|
|
@@ -134,23 +169,8 @@ export default {
|
|
|
<span style="display: inline-block;vertical-align: text-bottom;margin-left: 12px">室外</span>
|
|
|
</div>
|
|
|
</a-col>
|
|
|
- <a-col :span="12">
|
|
|
- <LifeHealthyHomeMonitor title="PM2.5" :value="'75'" icon="life/pm_green.png"></LifeHealthyHomeMonitor>
|
|
|
- </a-col>
|
|
|
- <a-col :span="12">
|
|
|
- <LifeHealthyHomeMonitor title="PM2.5" :value="'75'" icon="life/pm_blue.png"></LifeHealthyHomeMonitor>
|
|
|
- </a-col>
|
|
|
- <a-col :span="12">
|
|
|
- <LifeHealthyHomeMonitor title="湿 度" :value="'75'" icon="life/humidity_green.png"></LifeHealthyHomeMonitor>
|
|
|
- </a-col>
|
|
|
- <a-col :span="12">
|
|
|
- <LifeHealthyHomeMonitor title="湿 度" :value="'75'" icon="life/humidity_blue.png"></LifeHealthyHomeMonitor>
|
|
|
- </a-col>
|
|
|
- <a-col :span="12">
|
|
|
- <LifeHealthyHomeMonitor title="温 度" :value="'75'" icon="life/temperature_green.png"></LifeHealthyHomeMonitor>
|
|
|
- </a-col>
|
|
|
- <a-col :span="12">
|
|
|
- <LifeHealthyHomeMonitor title="温 度" :value="'75'" icon="life/temperature_blue.png"></LifeHealthyHomeMonitor>
|
|
|
+ <a-col :span="12" v-for="(item,index) in envData" :key="index" >
|
|
|
+ <LifeHealthyHomeMonitor :title="item.title" :value="item.value" :icon="item.icon"></LifeHealthyHomeMonitor>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</Card>
|