This commit is contained in:
2026-03-05 16:34:25 +08:00
parent 13ee9e66cc
commit 69e199e9cc
15 changed files with 1398 additions and 677 deletions

View File

@ -179,32 +179,42 @@
text: 'PCS',
categoryName: 'PCS'
},
{
page: 'db',
icon: 'icon-dianbiao4',
text: '电表',
categoryName: 'AMMETER'
},
{
page: 'dtdc',
icon: 'icon-dantidianchi',
text: '单体电池',
{
page: 'db',
icon: 'icon-dianbiao4',
text: '电表',
categoryName: 'AMMETER'
},
{
page: 'yl',
icon: 'icon-gongneng-diandongji',
text: '冷却',
categoryName: 'COOLING'
},
{
page: 'dtdc',
icon: 'icon-dantidianchi',
text: '单体电池',
categoryName: 'BATTERY'
}
]
}
},
computed: {
...mapGetters(['belongSite']),
siteGirdList() {
return this.gridList.filter(i => this.deviceCategoryOptions.includes(i.categoryName))
}
},
methods: {
// 更新一周冲放曲线时间范围 重置图表
updateWeekChartDate(data) {
this.weekChartTimeRange = data || []
this.siteId && this.getWeekChartData()
computed: {
...mapGetters(['belongSite', 'currentSiteId']),
siteGirdList() {
return this.gridList.filter(i => this.deviceCategoryOptions.includes(i.categoryName))
}
},
methods: {
isAvailableSite(siteId) {
const site = (this.siteTypeOptions.find(i => i.value === 'cn')?.children || []).find(item => item.value === siteId)
return !!(site && !site.disable)
},
// 更新一周冲放曲线时间范围 重置图表
updateWeekChartDate(data) {
this.weekChartTimeRange = data || []
this.siteId && this.getWeekChartData()
},
// 更新当日功率曲线时间范围 重置图表
updateActiveChartDate(data) {
@ -221,16 +231,15 @@
} = e.detail
this.$tab.navigateTo(`/pages/work/${this.siteGirdList[index].page}/index?siteId=${this.siteId}`)
},
selectedSite(data) {
const [typeObj, siteObj] = data.detail.value
const {
text,
value
} = siteObj
if (value === this.siteId) return
this.siteId = value
this.updateSiteInfo()
},
selectedSite(data) {
const siteObj = (data.detail.value || [])[1]
const value = siteObj?.value
if (!value) return
if (value === this.siteId) return
this.siteId = value
this.$store.commit('SET_CURRENTSITEID', value)
this.updateSiteInfo()
},
updateSiteInfo() {
if (!this.siteId) return
this.getSiteBaseInfo()
@ -241,24 +250,27 @@
getSiteList() {
getAllSites().then(response => {
const data = response?.data || []
this.siteTypeOptions.find(i => i.value === 'cn').children = data.map(item => {
return {
text: item.siteName,
value: item.siteId,
this.siteTypeOptions.find(i => i.value === 'cn').children = data.map(item => {
return {
text: item.siteName,
value: item.siteId,
id: item.id,
disable: !this.belongSite || this.belongSite.length === 0 || this
.belongSite.includes('all') ? false : !this.belongSite.includes(item
.siteId)
}
})
// 设置默认展示的站点
this.siteId = this.siteTypeOptions.find(i => i.children && i.children.length > 0)?.children
.find(
item => !item
.disable)?.value || ''
this.siteId && this.updateSiteInfo()
})
},
}
})
const siteChildren = this.siteTypeOptions.find(i => i.value === 'cn')?.children || []
// 设置默认展示的站点
const defaultSiteId = this.isAvailableSite(this.currentSiteId) ? this.currentSiteId : (siteChildren.find(item =>
!item.disable)?.value || '')
if (defaultSiteId) {
this.siteId = defaultSiteId
this.$store.commit('SET_CURRENTSITEID', defaultSiteId)
this.updateSiteInfo()
}
})
},
getSiteBaseInfo() {
getSingleSiteBaseInfo({
siteId: this.siteId
@ -369,12 +381,20 @@
]
}))
}).finally(() => this.$refs.weekChartDateRangeSelect.showBtnLoading(false))
}
},
// 页面切换不会重新调用如果希望每次切换页面都重新调接口使用onShow
onLoad() {
this.$nextTick(() => {
this.getSiteList()
}
},
watch: {
currentSiteId(newSiteId) {
if (!newSiteId || newSiteId === this.siteId) return
if (!this.isAvailableSite(newSiteId)) return
this.siteId = newSiteId
this.updateSiteInfo()
}
},
// 页面切换不会重新调用如果希望每次切换页面都重新调接口使用onShow
onLoad() {
this.$nextTick(() => {
this.getSiteList()
this.$refs.weekChartDateRangeSelect.init()
this.$refs.activeChartDateRangeSelect.init(true)
})
@ -581,4 +601,4 @@
}
@media screen and (min-width: 500px) {}
</style>
</style>