使用全等判断 删除不需要的log
This commit is contained in:
@ -49,7 +49,7 @@ export default {
|
||||
methods: {
|
||||
setData(res = {}){
|
||||
this.data.forEach((item)=>{
|
||||
item.num =(res[item.attr] || res[item.attr] == 0) ? res[item.attr] : '—'
|
||||
item.num =(res[item.attr] || res[item.attr] === 0) ? res[item.attr] : '—'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -49,9 +49,10 @@ import {getAllSites} from '@/api/ems/zddt'
|
||||
this.siteList = response.data || []
|
||||
console.log("获取站点列表返回数据",response,this.siteList)
|
||||
// 页面初始化 设置默认选中的站点
|
||||
const defaultSite = this.defaultSiteId
|
||||
if(defaultSite&& this.siteList.find(item=>item.id == defaultSite)){
|
||||
this.id = parseInt(defaultSite)//defaultSite会传来字符串类型 电站列表返回的书number类型 两个数据的类型不匹配时下拉框的默认值会显示有问题
|
||||
//defaultSite会传来字符串类型 getAllSites接口返回的id是number类型 两个数据的类型不匹配时下拉框的默认值会显示有问题
|
||||
const defaultSite = parseInt(this.defaultSiteId)
|
||||
if(defaultSite&& this.siteList.find(item=>item.id === defaultSite)){
|
||||
this.id = defaultSite
|
||||
}else if(!defaultSite && this.siteList.length>0){
|
||||
this.id = this.siteList[0].id
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
label="状态"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span class="warning-status">{{ scope.row.status == 0 ? '中断':'todo不是0是什么告警'}}</span>
|
||||
<span class="warning-status">{{ scope.row.status === 0 ? '中断':'todo不是0是什么告警'}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -96,10 +96,9 @@ export default {
|
||||
methods:{
|
||||
getData(siteId){
|
||||
getDzjkHomeView(siteId).then(response => {
|
||||
console.log(`获取单站监控id=${siteId}的基本信息`,response)
|
||||
const data = response.data || {}
|
||||
this.sjglData.forEach(item=>{
|
||||
item.value = (data[item.attr] || data[item.attr] == 0) ? data[item.attr] : '-'
|
||||
item.value = (data[item.attr] || data[item.attr] === 0) ? data[item.attr] : '-'
|
||||
})
|
||||
this.tableData = data?.siteMonitorHomeAlarmVo || []
|
||||
this.$refs.nllzChart.setOption(data)
|
||||
|
@ -27,7 +27,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
setOption(data){
|
||||
console.log('初始化单个站点充、放电量柱状图',data)
|
||||
const source = [['日期','充电量','放电量']]
|
||||
data.forEach(item=>{
|
||||
source.push([item.ammeterDate, item.chargedCap,item.disChargedCap])
|
||||
|
@ -33,16 +33,11 @@ export default {
|
||||
initChart() {
|
||||
// ECharts 默认有提供了一个简单的加载动画。只需要调用 showLoading 方法显示。数据加载完成后再调用 hideLoading 方法隐藏加载动画。
|
||||
this.chart = echarts.init(document.querySelector('#zddtChart'))
|
||||
this.setOption([])
|
||||
},
|
||||
setOption(data) {
|
||||
this.chart.setOption({
|
||||
color:['#FFBD00'],
|
||||
backgroundColor: 'transparent', //背景色
|
||||
// tooltip: {
|
||||
// trigger: 'item',
|
||||
// show: true,
|
||||
// },
|
||||
geo: { //地理坐标系组件 地理坐标系组件用于地图的绘制,支持在地理坐标系上绘制
|
||||
map: 'china', //地图类型 这儿展示的是中国地图
|
||||
aspectScale: 0.85,
|
||||
|
@ -96,7 +96,8 @@ export default {
|
||||
methods:{
|
||||
// 站点选中
|
||||
submitSite(id){
|
||||
console.log('选中的站点id',id)
|
||||
if(this.singleSiteId === id){return console.log(`点击搜索按钮 搜索相同的站点id= ${id}不再调用获取基本信息接口`)}
|
||||
console.log('点击搜索按钮 选中的站点id',id)
|
||||
this.singleSiteId = id
|
||||
getSingleSiteBaseInfo(id).then(response => {
|
||||
console.log('单个站点详情数据',response)
|
||||
@ -104,10 +105,10 @@ export default {
|
||||
this.singleSiteName = res?.siteName || ''//站点名称
|
||||
this.singleSiteLocation = res?.siteLocation || []//站点坐标
|
||||
this.singleZdSqaure.forEach(item=>{
|
||||
item.value =( res[item.attr] || res[item.attr] == 0 ) ? res[item.attr] : '-'
|
||||
item.value =( res[item.attr] || res[item.attr] === 0 ) ? res[item.attr] : '-'
|
||||
})
|
||||
this.singleZdInfo.forEach(item=>{
|
||||
item.value = ( res[item.attr] || res[item.attr] == 0 ) ? res[item.attr] : '-'
|
||||
item.value = ( res[item.attr] || res[item.attr] === 0 ) ? res[item.attr] : '-'
|
||||
})
|
||||
this.$refs.barChart.setOption(res?.sevenDayDisChargeStats || [])
|
||||
this.$refs.mapChart.setOption([{name:this.singleSiteName,value:this.singleSiteLocation}])
|
||||
|
Reference in New Issue
Block a user