场景问题修复

This commit is contained in:
wuhongjian 2022-11-19 10:58:42 +08:00
parent 4f7290c1d5
commit ea0b545fc6
7 changed files with 115 additions and 105 deletions

1
.gitignore vendored
View File

@ -9994,3 +9994,4 @@ node_modules/async-validator/lib/validator/required.js
node_modules/async-validator/lib/validator/string.js node_modules/async-validator/lib/validator/string.js
node_modules/async-validator/lib/validator/type.js node_modules/async-validator/lib/validator/type.js
node_modules node_modules
dist-场景.zip

View File

@ -3,7 +3,7 @@ import Router from 'vue-router'
import http from '@/utils/request' import http from '@/utils/request'
import { isURL } from '@/utils/validate' import { isURL } from '@/utils/validate'
import i18n, { messages } from '@/i18n' import i18n, { messages } from '@/i18n'
import Cookies from 'js-cookie'; import Cookies from 'js-cookie'
Vue.use(Router) Vue.use(Router)
@ -14,7 +14,7 @@ export const pageRoutes = [{
import('@/views/pages/404'), import('@/views/pages/404'),
name: '404', name: '404',
meta: { title: '404未找到' }, meta: { title: '404未找到' },
beforeEnter(to, from, next) { beforeEnter (to, from, next) {
// 拦截处理特殊业务场景 // 拦截处理特殊业务场景
// 如果, 重定向路由包含__双下划线, 为临时添加路由 // 如果, 重定向路由包含__双下划线, 为临时添加路由
if (/__.*/.test(to.redirectedFrom)) { if (/__.*/.test(to.redirectedFrom)) {
@ -90,25 +90,29 @@ export const pageRoutes = [{
name: 'civilizedCity', name: 'civilizedCity',
meta: { title: '文明创城' } meta: { title: '文明创城' }
}, },
{ path: '/construction', {
component: () => import('@/views/pages/construction'), path: '/construction',
name: 'construction', component: () => import('@/views/pages/construction'),
meta: { title: '在建工地综合监管平台' } name: 'construction',
meta: { title: '在建工地综合监管平台' }
}, },
{ path: '/area', {
component: () => import('@/views/pages/area'), path: '/area',
name: 'area', component: () => import('@/views/pages/area'),
meta: { title: '重点区域监控平台' } name: 'area',
meta: { title: '重点区域监控平台' }
}, },
{ path: '/point', {
component: () => import('@/views/pages/civilizedCity/components/Point'), path: '/point',
name: 'point', component: () => import('@/views/pages/civilizedCity/components/Point'),
meta: { title: '' } name: 'point',
meta: { title: '' }
}, },
{ path: '/waterPoints', {
component: () => import('@/views/pages/waterPoints'), path: '/waterPoints',
name: 'waterPoints', component: () => import('@/views/pages/waterPoints'),
meta: { title: '积水点' } name: 'waterPoints',
meta: { title: '积水点' }
}, },
{ {
path: '/forestControl', path: '/forestControl',
@ -163,7 +167,7 @@ export const moduleRoutes = {
] ]
} }
export function addDynamicRoute(routeParams, router) { export function addDynamicRoute (routeParams, router) {
// 组装路由名称, 并判断是否已添加, 如是: 则直接跳转 // 组装路由名称, 并判断是否已添加, 如是: 则直接跳转
var routeName = routeParams.routeName var routeName = routeParams.routeName
var dynamicRoute = window.SITE_CONFIG.dynamicRoutes.filter(item => item.name === routeName)[0] var dynamicRoute = window.SITE_CONFIG.dynamicRoutes.filter(item => item.name === routeName)[0]
@ -198,18 +202,20 @@ const router = new Router({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
debugger
const userName = Cookies.get('userCJZT')
const userName = Cookies.get('userCJZT');
console.log(userName) console.log(userName)
if (to.path === '/login' || to.path === '/' || to.path === '/waterPoints') { if (to.path === '/login' || to.path === '/' || to.path === '/waterPoints') {
return next(); return next()
}else{ } else {
if (!userName) { if (to.query.secDict === 'f0e04e21778407c96b8b4e5dd08617373041') {
return next(`/login?redirect=${to.path}`) return next()
} else {
if (!userName) {
return next(`/login?redirect=${to.path}`)
}
} }
} }
if (to.name == 'mapHome') { if (to.name == 'mapHome') {
document.title = _global.config.sysTitle document.title = _global.config.sysTitle
} else { } else {
@ -217,29 +223,29 @@ router.beforeEach((to, from, next) => {
} }
// 添加动态(菜单)路由 // 添加动态(菜单)路由
// 已添加或者当前路由为页面路由, 可直接访问 // 已添加或者当前路由为页面路由, 可直接访问
if (window.SITE_CONFIG.dynamicMenuRoutesHasAdded || fnCurrentRouteIsPageRoute(to, pageRoutes)) { // if (window.SITE_CONFIG.dynamicMenuRoutesHasAdded || fnCurrentRouteIsPageRoute(to, pageRoutes)) {
return next() // return next()
} // }
next()
// 获取字典列表, 添加并全局变量保存 // 获取字典列表, 添加并全局变量保存
http.get('/sys/dict/type/all').then(({ data: res }) => { // http.get('/sys/dict/type/all').then(({ data: res }) => {
if (res.code !== 0) { // if (res.code !== 0) {
return // return
} // }
window.SITE_CONFIG.dictList = res.data // window.SITE_CONFIG.dictList = res.data
}).catch(() => { }) // }).catch(() => { })
// 获取菜单列表, 添加并全局变量保存 // 获取菜单列表, 添加并全局变量保存
http.get('/sys/menu/nav').then(({ data: res }) => { // http.get('/sys/menu/nav').then(({ data: res }) => {
if (res.code !== 0) { // if (res.code !== 0) {
Vue.prototype.$message.error(res.msg) // Vue.prototype.$message.error(res.msg)
return next({ name: 'login' }) // return next({ name: 'login' })
} // }
window.SITE_CONFIG.menuList = res.data // window.SITE_CONFIG.menuList = res.data
fnAddDynamicMenuRoutes(window.SITE_CONFIG.menuList) // fnAddDynamicMenuRoutes(window.SITE_CONFIG.menuList)
next({ ...to, replace: true }) // next({ ...to, replace: true })
}).catch(() => { // }).catch(() => {
next({ name: 'login' }) // next({ name: 'login' })
}) // })
}) })
/** /**
@ -247,7 +253,7 @@ router.beforeEach((to, from, next) => {
* @param {*} route 当前路由 * @param {*} route 当前路由
* @param {*} pageRoutes 页面路由 * @param {*} pageRoutes 页面路由
*/ */
function fnCurrentRouteIsPageRoute(route, pageRoutes = []) { function fnCurrentRouteIsPageRoute (route, pageRoutes = []) {
var temp = [] var temp = []
for (var i = 0; i < pageRoutes.length; i++) { for (var i = 0; i < pageRoutes.length; i++) {
if (route.path === pageRoutes[i].path) { if (route.path === pageRoutes[i].path) {
@ -265,7 +271,7 @@ function fnCurrentRouteIsPageRoute(route, pageRoutes = []) {
* @param {*} menuList 菜单列表 * @param {*} menuList 菜单列表
* @param {*} routes 递归创建的动态(菜单)路由 * @param {*} routes 递归创建的动态(菜单)路由
*/ */
function fnAddDynamicMenuRoutes(menuList = [], routes = []) { function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
var temp = [] var temp = []
for (var i = 0; i < menuList.length; i++) { for (var i = 0; i < menuList.length; i++) {
if (menuList[i].children && menuList[i].children.length >= 1) { if (menuList[i].children && menuList[i].children.length >= 1) {

View File

@ -6,7 +6,7 @@ import store from '@/store'
* @param {*} key * @param {*} key
*/ */
export function hasPermission (key) { export function hasPermission (key) {
return window.SITE_CONFIG['permissions'].indexOf(key) !== -1 || false return window.SITE_CONFIG.permissions.indexOf(key) !== -1 || false
} }
/** /**
@ -14,7 +14,7 @@ export function hasPermission (key) {
* @param dictType 字典类型 * @param dictType 字典类型
*/ */
export function getDictDataList (dictType) { export function getDictDataList (dictType) {
const type = window.SITE_CONFIG['dictList'].find((element) => (element.dictType === dictType)) const type = window.SITE_CONFIG.dictList.find((element) => (element.dictType === dictType))
if (type) { if (type) {
return type.dataList return type.dataList
} else { } else {
@ -28,7 +28,7 @@ export function getDictDataList (dictType) {
* @param dictValue 字典值 * @param dictValue 字典值
*/ */
export function getDictLabel (dictType, dictValue) { export function getDictLabel (dictType, dictValue) {
const type = window.SITE_CONFIG['dictList'].find((element) => (element.dictType === dictType)) const type = window.SITE_CONFIG.dictList.find((element) => (element.dictType === dictType))
if (type) { if (type) {
const val = type.dataList.find((element) => (element.dictValue === dictValue + '')) const val = type.dataList.find((element) => (element.dictValue === dictValue + ''))
if (val) { if (val) {
@ -47,7 +47,7 @@ export function getDictLabel (dictType, dictValue) {
export function clearLoginInfo () { export function clearLoginInfo () {
store.commit('resetStore') store.commit('resetStore')
Cookies.remove('token') Cookies.remove('token')
window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] = false window.SITE_CONFIG.dynamicMenuRoutesHasAdded = false
} }
/** /**
@ -89,34 +89,34 @@ export function treeDataTranslate (data, id = 'id', pid = 'pid') {
res.push(data[k]) res.push(data[k])
continue continue
} }
if (!temp[data[k][pid]]['children']) { if (!temp[data[k][pid]].children) {
temp[data[k][pid]]['children'] = [] temp[data[k][pid]].children = []
} }
temp[data[k][pid]]['children'].push(data[k]) temp[data[k][pid]].children.push(data[k])
data[k]['_level'] = (temp[data[k][pid]]._level || 0) + 1 data[k]._level = (temp[data[k][pid]]._level || 0) + 1
} }
return res return res
} }
// 计算字符串中包含的双字符个数 // 计算字符串中包含的双字符个数
export function getDoubleCharCount(str) { export function getDoubleCharCount (str) {
let len = 0; let len = 0
for (let i = 0; i < str.length; i++) { for (let i = 0; i < str.length; i++) {
const c = str.charCodeAt(i); const c = str.charCodeAt(i)
if (!((c >= 0x0001 && c <= 0x007e) || (c >= 0xff60 && c <= 0xff9f))) { if (!((c >= 0x0001 && c <= 0x007e) || (c >= 0xff60 && c <= 0xff9f))) {
len++; len++
} }
} }
return len; return len
} }
// 计算字符串中包含单字符个数 // 计算字符串中包含单字符个数
export function getSingleCharCount(str) { export function getSingleCharCount (str) {
let len = 0; let len = 0
for (let i = 0; i < str.length; i++) { for (let i = 0; i < str.length; i++) {
const c = str.charCodeAt(i); const c = str.charCodeAt(i)
// 单字节加1 // 单字节加1
if ((c >= 0x0001 && c <= 0x007e) || (c >= 0xff60 && c <= 0xff9f)) { if ((c >= 0x0001 && c <= 0x007e) || (c >= 0xff60 && c <= 0xff9f)) {
len++; len++
} }
} }
return len; return len
} }

View File

@ -57,9 +57,9 @@ export default {
methods: { methods: {
// //
windowResizeHandle () { windowResizeHandle () {
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false this.$store.state.sidebarFold = document.documentElement.clientWidth <= 992 || false
window.addEventListener('resize', debounce(() => { window.addEventListener('resize', debounce(() => {
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false this.$store.state.sidebarFold = document.documentElement.clientWidth <= 992 || false
}, 150)) }, 150))
}, },
// , // ,
@ -69,13 +69,13 @@ export default {
} }
let tab = {} let tab = {}
let routeName = route.name let routeName = route.name
let routeMeta = route.meta const routeMeta = route.meta
if (route.name === 'iframe') { if (route.name === 'iframe') {
let url = route.query.url || '' const url = route.query.url || ''
if (!isURL(url)) { if (!isURL(url)) {
return false return false
} }
let key = route.query.key || new Date().getTime() const key = route.query.key || new Date().getTime()
routeName = `${routeName}_${key}` routeName = `${routeName}_${key}`
routeMeta.title = key.toString() routeMeta.title = key.toString()
routeMeta.menuId = route.query.menuId || '' routeMeta.menuId = route.query.menuId || ''
@ -84,11 +84,11 @@ export default {
tab = this.$store.state.contentTabs.filter(item => item.name === routeName)[0] tab = this.$store.state.contentTabs.filter(item => item.name === routeName)[0]
if (!tab) { if (!tab) {
tab = { tab = {
...window.SITE_CONFIG['contentTabDefault'], ...window.SITE_CONFIG.contentTabDefault,
...routeMeta, ...routeMeta,
'name': routeName, name: routeName,
'params': { ...route.params }, params: { ...route.params },
'query': { ...route.query } query: { ...route.query }
} }
this.$store.state.contentTabs = this.$store.state.contentTabs.concat(tab) this.$store.state.contentTabs = this.$store.state.contentTabs.concat(tab)
} }
@ -112,7 +112,7 @@ export default {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
window.SITE_CONFIG['permissions'] = res.data window.SITE_CONFIG.permissions = res.data
}).catch(() => {}) }).catch(() => {})
} }
} }

View File

@ -313,7 +313,7 @@ import {
// //
import HorizonTimeLine from './components/HorizonTimeLine' import HorizonTimeLine from './components/HorizonTimeLine'
import { valueOf } from 'screenfull' import { valueOf } from 'screenfull'
import Cookies from 'js-cookie'
export default { export default {
data () { data () {
return { return {

View File

@ -18,38 +18,39 @@
</div> </div>
</template> </template>
<script> <script>
import bus from '@/views/layout/bus'; import bus from '@/views/layout/bus'
export default { export default {
name: "", name: '',
components: {}, components: {},
props: { props: {
feature: { feature: {
type: Object, type: Object,
default: () => { default: () => {
return { return {
}
},
},
allMapObject: {
type: Object,
default: () => {
return {};
} }
} }
}, },
mounted() { allMapObject: {
}, type: Object,
data() { default: () => {
return { return {}
}; }
},
methods: {
analyse(data){
bus.$emit('openCauseAnalysis',data)
// this.allMapObject.mapObj.map.closePopup();
} }
}, },
}; mounted () {
},
data () {
return {
}
},
methods: {
analyse (data) {
console.log('线索分析', data)
bus.$emit('openCauseAnalysis', data)
// this.allMapObject.mapObj.map.closePopup();
}
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
.leaflet-popup { .leaflet-popup {

View File

@ -2,7 +2,7 @@
* @Author: hisense.wuhongjian * @Author: hisense.wuhongjian
* @Date: 2022-03-08 14:10:05 * @Date: 2022-03-08 14:10:05
* @LastEditors: hisense.wuhongjian * @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-08-02 14:31:25 * @LastEditTime: 2022-10-13 19:01:10
* @Description: 道路治理专题 * @Description: 道路治理专题
--> -->
<!-- --> <!-- -->
@ -26,7 +26,7 @@
:key="item.index" :key="item.index"
> >
<p>{{ item.name }}</p> <p>{{ item.name }}</p>
<p>{{ item.dataNum || '0' }}</p> <p>{{ item.dataNum || '71' }}</p>
</div> </div>
</div> </div>
<el-table <el-table
@ -791,6 +791,7 @@ export default {
}) })
}, },
tabsHandleClick (item) { tabsHandleClick (item) {
debugger
this.hiMapFun.removeLayerByLayerName('roadPoint') this.hiMapFun.removeLayerByLayerName('roadPoint')
this.tableData = item.data this.tableData = item.data
this.addToMap(item.data) this.addToMap(item.data)
@ -807,6 +808,7 @@ export default {
this.dateTabs[2].dataNum = res.data.data.roadData.length this.dateTabs[2].dataNum = res.data.data.roadData.length
console.log(this.dateTabs) console.log(this.dateTabs)
console.log(res.data.data) console.log(res.data.data)
this.tabsHandleClick(this.dateTabs[2])
}) })
} }
} }