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

智能发现获取方法更新

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