场景问题修复

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/type.js
node_modules
dist-场景.zip

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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