Commit 3da9fa44 authored by 郭铭瑶's avatar 郭铭瑶 🤘

加入街镇判断,传参调接口

parent 8d0bad7c
......@@ -5,8 +5,8 @@
<span>{{curDate}}</span>
</DatePicker>
</span> -->
<div class="btn back" @click="toAli" />
<div class="btn close" @click="toAli" />
<div class="btn back" @click="closePage" />
<div class="btn close" @click="closePage" />
<span v-if="!hideTime" class="moment time">
<!-- <span class="switch"><img src="@/assets/images/switch.png"/> 切换街道</span> -->
{{curDate}} {{time}}
......@@ -88,8 +88,11 @@ export default {
this.$store.commit('SET_CURDATE', date)
this.openDatePicker = false
},
toAli() {
window.location = 'http://10.89.1.208/share/ypdp'
// toAli() {
// window.location = 'http://10.89.1.208/share/ypdp'
// },
closePage() {
window.close()
},
}
}
......@@ -106,6 +109,7 @@ export default {
// font-family $font-pang
font-weight bold
>.btn
display block
position absolute
width .2rem
height @width
......
......@@ -3,9 +3,11 @@ import api from '@/server/api'
import com from '@/util/common'
import moment from 'moment'
const curStreet = '新江湾城街道'
let streetId = null
export default {
initData({dispatch}) {
initData({dispatch, state}) {
streetId = state.currentStreetInfo.id
dispatch('getGreenInfo')
dispatch('getDiscoverTrend')
dispatch('getRepairRate')
......@@ -29,7 +31,7 @@ export default {
getDiscoverTrend({commit}) {
ajax.get({
url: api.GET_DISCOVER_TREND,
params: {days: 10}
params: {days: 10, streetId}
}).then(res => {
const {content} = res.data
const keys = (content && Object.keys(content)) ||[]
......@@ -41,7 +43,7 @@ export default {
})
},
getRepairRate({commit}) {
ajax.get({url: api.GET_REPAIR_RATE}).then(res => {
ajax.get({url: api.GET_REPAIR_RATE, params: {streetId}}).then(res => {
const data = com.confirm(res, 'data.content', [])
const result = data.map(item => ({
name: item.troubleType,
......@@ -51,15 +53,15 @@ export default {
})
},
getResourceSum({commit}) {
ajax.get({url: api.GET_RESOURCE_SUM}).then(res => {
ajax.get({url: api.GET_RESOURCE_SUM, params: {streetId}}).then(res => {
commit('SET_RESOURCE_SUM', com.confirm(res, 'data.content', {}))
})
},
getCheckSum({commit}) {
ajax.get({url: api.GET_CHECK_SUM}).then(res => {
commit('SET_CHECK_SUM', com.confirm(res, 'data.content', {}))
})
},
// getCheckSum({commit}) {
// ajax.get({url: api.GET_CHECK_SUM}).then(res => {
// commit('SET_CHECK_SUM', com.confirm(res, 'data.content', {}))
// })
// },
async getGridSum({commit}) {
const start = moment().add(-10, 'days').format('YYYY-MM-DD')
const end = moment().format('YYYY-MM-DD')
......@@ -133,6 +135,7 @@ export default {
getDiscoverInfo({commit}) {
ajax.get({
url: api.GET_DISCOVER_INFO,
params: {streetId},
}).then(res => {
const sum = {total: 0, today: 0}
const data = com.confirm(res, 'data.content', [])
......@@ -152,6 +155,7 @@ export default {
getRepairInfo({commit}) {
ajax.get({
url: api.GET_TS_BX,
params: {streetId},
}).then(res => {
const data = com.confirm(res, 'data.content', {})
const result = [
......@@ -162,7 +166,7 @@ export default {
})
},
getHandleList({commit}) { // 获取并全局设置联勤联动处置列表
ajax.get({url: api.GET_HANDLE_LIST}).then(res => {
ajax.get({url: api.GET_HANDLE_LIST, params: {streetId}}).then(res => {
commit('SET_HANDLE_LIST', com.confirm(res, 'data.content', []))
})
},
......
export default {
SET_CURRENT_STREET(state, name) {
if (!name) return
state.currentStreetInfo = state.streets.find(street => street.name.indexOf(name) >= 0)
},
SET_LOADING(state, val) {
state.showLoading = val
},
......
export default {
streets: [
{id: 310110001000, name: '定海路街道'},
{id: 310110006000, name: '平凉路街道'},
{id: 310110008000, name: '江浦路街道'},
{id: 310110009000, name: '四平路街道'},
{id: 310110012000, name: '控江路街道'},
{id: 310110013000, name: '长白新村街道'},
{id: 310110015000, name: '延吉新村街道'},
{id: 310110016000, name: '殷行街道'},
{id: 310110018000, name: '大桥街道'},
{id: 310110019000, name: '五角场街道'},
{id: 310110020000, name: '新江湾城街道'},
{id: 310110101000, name: '五角场镇'},
],
currentStreetInfo: {id: 310110020000, name: '新江湾城街道'},
showLoading: false,
curDate: null,
curSmartType: null,
......
......@@ -10,7 +10,7 @@
:complete="complete"
>
<m-map ref="map" @complete="mapComplete" @event="handleMapClick"/>
<m-title area="title" :bgImg="require('@/assets/images/title-bg.png')">新江湾城街道城市运行平台</m-title>
<m-title area="title" :bgImg="require('@/assets/images/title-bg.png')">{{currentStreetInfo.name}}城市运行平台</m-title>
<m-animate enter="fadeInLeft" leave="fadeOutLeft">
<LeftComponent v-show="!fullView" area="left"/>
</m-animate>
......@@ -171,6 +171,7 @@ export default {
},
computed: {
...mapState([
'currentStreetInfo',
'curSmartType',
'xinjiangwanPaths',
'commandLayout',
......@@ -180,6 +181,10 @@ export default {
'handleList',
])
},
beforeCreate() {
const {name} = this.$route.query
this.$store.commit('SET_CURRENT_STREET', name)
},
beforeDestroy() {
clearInterval(this.timer)
this.timer = null
......
This diff is collapsed.
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