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

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

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