Commit 0a9b8640 authored by 郭铭瑶's avatar 郭铭瑶 🤘

智能发现获取方法更新

parent d6fd6ce0
......@@ -133,7 +133,7 @@ export default {
}).then(res => {
const sum = {done: 0, today: 0}
const data = com.confirm(res, 'data.content', [])
const keys = ['accCtl', 'heap', 'nonVehicleCharg', 'streetMonitor']
const keys = com.getTypesByStreetName(curStreet)
// const keys = ['heap', 'parkFireExit', 'nonVehicleCharg', 'buildingVibration', 'trash', 'manholeCover', 'waterTank', 'roofWater', 'hermeticSpace', 'accCtl', 'streetMonitor']
const result = data.filter(item => keys.indexOf(item.types) >= 0)
result.forEach(e => {
......
......@@ -60,4 +60,11 @@ export default {
}
return data[type]
},
getTypesByStreetName(name) {
let keys = ['accCtl', 'heap', 'nonVehicleCharg', 'streetMonitor']
if (name === '长白新村街道') {
keys = ['accCtl', 'heap', 'nonVehicleCharg', 'fire']
}
return keys
},
}
......@@ -67,6 +67,9 @@ export default {
curSmartType() {
return this.$store.state.curSmartType
},
curStreetName() {
return this.$store.state.currentStreetInfo.name
},
sum() {
const {done, today} = this.$store.state.discoverSum
return [
......@@ -76,17 +79,25 @@ export default {
},
list() {
const {discoverInfo} = this.$store.state
const keys = ['accCtl', 'heap', 'nonVehicleCharg', 'streetMonitor']
const keys = this.$com.getTypesByStreetName(this.curStreetName)
const result = []
for (let i = 0; i < keys.length; i++) {
const item = discoverInfo.find(e => e && e.types === keys[i])
if (!item) return
result.push({
name: this.$com.transType(item.types),
value: +item.numbers || 0,
types: item.types,
visible: this.calcVisible(item.types),
})
if (!item) {
result.push({
name: this.$com.transType(keys[i]),
value: 0,
types: keys[i],
visible: this.calcVisible(keys[i]),
})
} else {
result.push({
name: this.$com.transType(item.types),
value: +item.numbers || 0,
types: item.types,
visible: this.calcVisible(item.types),
})
}
}
return result
}
......@@ -98,7 +109,7 @@ export default {
}
},
calcVisible(type) {
const {name} = this.$store.state.currentStreetInfo
const name = this.curStreetName
const keys = [
'平凉路街道',
'控江路街道',
......
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