diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }} - {{ item.unit }} - + {{ item.unit }} + 更多 @@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue index 1b7b85e..fd07381 100644 --- a/src/views/login-pc.vue +++ b/src/views/login-pc.vue @@ -17,6 +17,7 @@ const { proxy } = getCurrentInstance() as any const userStore = useUserStore() const menuStore = useMenuStore() +import indexDB from '@/utils/indexDB' const banner = new URL('../assets/images/login-banner.png', import.meta.url) .href @@ -216,6 +217,8 @@ // 清空面包屑 menuStore.resetBreadcrumb() localStorage.removeItem('token') + // 清空缓存 + indexDB.deleteAll() }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue index 1b7b85e..fd07381 100644 --- a/src/views/login-pc.vue +++ b/src/views/login-pc.vue @@ -17,6 +17,7 @@ const { proxy } = getCurrentInstance() as any const userStore = useUserStore() const menuStore = useMenuStore() +import indexDB from '@/utils/indexDB' const banner = new URL('../assets/images/login-banner.png', import.meta.url) .href @@ -216,6 +217,8 @@ // 清空面包屑 menuStore.resetBreadcrumb() localStorage.removeItem('token') + // 清空缓存 + indexDB.deleteAll() }) diff --git a/src/views/mobile/dashboard/userInfo.vue b/src/views/mobile/dashboard/userInfo.vue index 4fff389..541bea8 100644 --- a/src/views/mobile/dashboard/userInfo.vue +++ b/src/views/mobile/dashboard/userInfo.vue @@ -17,7 +17,7 @@ // 打开弹窗 const initDialog = () => { dialogFormVisible.value = true - console.log(userInfo, 'userInfo') + // console.log(userInfo, 'userInfo') } // 关闭 const cancel = () => { diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue index 1b7b85e..fd07381 100644 --- a/src/views/login-pc.vue +++ b/src/views/login-pc.vue @@ -17,6 +17,7 @@ const { proxy } = getCurrentInstance() as any const userStore = useUserStore() const menuStore = useMenuStore() +import indexDB from '@/utils/indexDB' const banner = new URL('../assets/images/login-banner.png', import.meta.url) .href @@ -216,6 +217,8 @@ // 清空面包屑 menuStore.resetBreadcrumb() localStorage.removeItem('token') + // 清空缓存 + indexDB.deleteAll() }) diff --git a/src/views/mobile/dashboard/userInfo.vue b/src/views/mobile/dashboard/userInfo.vue index 4fff389..541bea8 100644 --- a/src/views/mobile/dashboard/userInfo.vue +++ b/src/views/mobile/dashboard/userInfo.vue @@ -17,7 +17,7 @@ // 打开弹窗 const initDialog = () => { dialogFormVisible.value = true - console.log(userInfo, 'userInfo') + // console.log(userInfo, 'userInfo') } // 关闭 const cancel = () => { diff --git a/src/views/mobile/device/add.vue b/src/views/mobile/device/add.vue index 00d2224..a0da5db 100644 --- a/src/views/mobile/device/add.vue +++ b/src/views/mobile/device/add.vue @@ -190,7 +190,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -237,7 +237,7 @@ }) } const valiateMultipleResult = (action: string) => { - console.log(action, 'action') + // console.log(action, 'action') if (action === 'cancel') { return true } @@ -375,7 +375,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -467,7 +467,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -530,7 +530,7 @@ } // 选择安装位置 const selectTagNumber = (event: any) => { - console.log(event.target.classList, 'event') + // console.log(event.target.classList, 'event') if(event.target.innerText === '既有' || (Array(event.target.classList || [])).includes('el-tag')) { return } @@ -830,7 +830,7 @@ const watchObject = deviceTypeList.value.filter((item: any) => item.id === select[0].deviceType) deviceInfo.value.watchObject = watchObject[0].watchObject //1闸井 2场站 3管线 - console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') + // console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') if (deviceInfo.value.watchObject === '2') { addType.value = '既有' } @@ -901,9 +901,9 @@ // 获取当前位置 mapRef.value.getLocation((a, b) => { - console.log('success', a, b) + // console.log('success', a, b) }, (a, b) => { - console.log('error', a, b) + // console.log('error', a, b) }) } // 当前状态 收起retract/展开expand @@ -982,7 +982,7 @@ data[`photo${index + 1}`] = item }); (response.data.rows.length ? editDevice : addDevice)({ ...data, valid: '1', id: response.data.rows.length ? response.data.rows[0].id : undefined }).then(res => { - console.log(res.data, '新增成功') + // console.log(res.data, '新增成功') // 添加运维记录 addDeviceInstall({ repairType: '1', diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue index 1b7b85e..fd07381 100644 --- a/src/views/login-pc.vue +++ b/src/views/login-pc.vue @@ -17,6 +17,7 @@ const { proxy } = getCurrentInstance() as any const userStore = useUserStore() const menuStore = useMenuStore() +import indexDB from '@/utils/indexDB' const banner = new URL('../assets/images/login-banner.png', import.meta.url) .href @@ -216,6 +217,8 @@ // 清空面包屑 menuStore.resetBreadcrumb() localStorage.removeItem('token') + // 清空缓存 + indexDB.deleteAll() }) diff --git a/src/views/mobile/dashboard/userInfo.vue b/src/views/mobile/dashboard/userInfo.vue index 4fff389..541bea8 100644 --- a/src/views/mobile/dashboard/userInfo.vue +++ b/src/views/mobile/dashboard/userInfo.vue @@ -17,7 +17,7 @@ // 打开弹窗 const initDialog = () => { dialogFormVisible.value = true - console.log(userInfo, 'userInfo') + // console.log(userInfo, 'userInfo') } // 关闭 const cancel = () => { diff --git a/src/views/mobile/device/add.vue b/src/views/mobile/device/add.vue index 00d2224..a0da5db 100644 --- a/src/views/mobile/device/add.vue +++ b/src/views/mobile/device/add.vue @@ -190,7 +190,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -237,7 +237,7 @@ }) } const valiateMultipleResult = (action: string) => { - console.log(action, 'action') + // console.log(action, 'action') if (action === 'cancel') { return true } @@ -375,7 +375,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -467,7 +467,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -530,7 +530,7 @@ } // 选择安装位置 const selectTagNumber = (event: any) => { - console.log(event.target.classList, 'event') + // console.log(event.target.classList, 'event') if(event.target.innerText === '既有' || (Array(event.target.classList || [])).includes('el-tag')) { return } @@ -830,7 +830,7 @@ const watchObject = deviceTypeList.value.filter((item: any) => item.id === select[0].deviceType) deviceInfo.value.watchObject = watchObject[0].watchObject //1闸井 2场站 3管线 - console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') + // console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') if (deviceInfo.value.watchObject === '2') { addType.value = '既有' } @@ -901,9 +901,9 @@ // 获取当前位置 mapRef.value.getLocation((a, b) => { - console.log('success', a, b) + // console.log('success', a, b) }, (a, b) => { - console.log('error', a, b) + // console.log('error', a, b) }) } // 当前状态 收起retract/展开expand @@ -982,7 +982,7 @@ data[`photo${index + 1}`] = item }); (response.data.rows.length ? editDevice : addDevice)({ ...data, valid: '1', id: response.data.rows.length ? response.data.rows[0].id : undefined }).then(res => { - console.log(res.data, '新增成功') + // console.log(res.data, '新增成功') // 添加运维记录 addDeviceInstall({ repairType: '1', diff --git a/src/views/mobile/device/success.vue b/src/views/mobile/device/success.vue index 125eb71..becc185 100644 --- a/src/views/mobile/device/success.vue +++ b/src/views/mobile/device/success.vue @@ -26,7 +26,7 @@ const searchHeaderHeight = document.getElementById('base-info')?.offsetHeight || 0 const headerHeight = document.getElementById('header')?.offsetHeight || 0 scrollHeight.value = window.innerHeight - 40 - exportBtnHeight - searchHeaderHeight - 30 - headerHeight - 15 - console.log('scrollHeight', scrollHeight.value) + // console.log('scrollHeight', scrollHeight.value) } window.addEventListener('resize', () => { calcHeight() diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue index 1b7b85e..fd07381 100644 --- a/src/views/login-pc.vue +++ b/src/views/login-pc.vue @@ -17,6 +17,7 @@ const { proxy } = getCurrentInstance() as any const userStore = useUserStore() const menuStore = useMenuStore() +import indexDB from '@/utils/indexDB' const banner = new URL('../assets/images/login-banner.png', import.meta.url) .href @@ -216,6 +217,8 @@ // 清空面包屑 menuStore.resetBreadcrumb() localStorage.removeItem('token') + // 清空缓存 + indexDB.deleteAll() }) diff --git a/src/views/mobile/dashboard/userInfo.vue b/src/views/mobile/dashboard/userInfo.vue index 4fff389..541bea8 100644 --- a/src/views/mobile/dashboard/userInfo.vue +++ b/src/views/mobile/dashboard/userInfo.vue @@ -17,7 +17,7 @@ // 打开弹窗 const initDialog = () => { dialogFormVisible.value = true - console.log(userInfo, 'userInfo') + // console.log(userInfo, 'userInfo') } // 关闭 const cancel = () => { diff --git a/src/views/mobile/device/add.vue b/src/views/mobile/device/add.vue index 00d2224..a0da5db 100644 --- a/src/views/mobile/device/add.vue +++ b/src/views/mobile/device/add.vue @@ -190,7 +190,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -237,7 +237,7 @@ }) } const valiateMultipleResult = (action: string) => { - console.log(action, 'action') + // console.log(action, 'action') if (action === 'cancel') { return true } @@ -375,7 +375,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -467,7 +467,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -530,7 +530,7 @@ } // 选择安装位置 const selectTagNumber = (event: any) => { - console.log(event.target.classList, 'event') + // console.log(event.target.classList, 'event') if(event.target.innerText === '既有' || (Array(event.target.classList || [])).includes('el-tag')) { return } @@ -830,7 +830,7 @@ const watchObject = deviceTypeList.value.filter((item: any) => item.id === select[0].deviceType) deviceInfo.value.watchObject = watchObject[0].watchObject //1闸井 2场站 3管线 - console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') + // console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') if (deviceInfo.value.watchObject === '2') { addType.value = '既有' } @@ -901,9 +901,9 @@ // 获取当前位置 mapRef.value.getLocation((a, b) => { - console.log('success', a, b) + // console.log('success', a, b) }, (a, b) => { - console.log('error', a, b) + // console.log('error', a, b) }) } // 当前状态 收起retract/展开expand @@ -982,7 +982,7 @@ data[`photo${index + 1}`] = item }); (response.data.rows.length ? editDevice : addDevice)({ ...data, valid: '1', id: response.data.rows.length ? response.data.rows[0].id : undefined }).then(res => { - console.log(res.data, '新增成功') + // console.log(res.data, '新增成功') // 添加运维记录 addDeviceInstall({ repairType: '1', diff --git a/src/views/mobile/device/success.vue b/src/views/mobile/device/success.vue index 125eb71..becc185 100644 --- a/src/views/mobile/device/success.vue +++ b/src/views/mobile/device/success.vue @@ -26,7 +26,7 @@ const searchHeaderHeight = document.getElementById('base-info')?.offsetHeight || 0 const headerHeight = document.getElementById('header')?.offsetHeight || 0 scrollHeight.value = window.innerHeight - 40 - exportBtnHeight - searchHeaderHeight - 30 - headerHeight - 15 - console.log('scrollHeight', scrollHeight.value) + // console.log('scrollHeight', scrollHeight.value) } window.addEventListener('resize', () => { calcHeight() diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue index deb0bfe..6a98ee0 100644 --- a/src/views/system/area/listArea.vue +++ b/src/views/system/area/listArea.vue @@ -118,7 +118,7 @@ resolve: (date: any[]) => void, ) => { getAreaByPid(row.id).then((res) => { - console.log(res.data, 'res.data') + // console.log(res.data, 'res.data') const data = res.data.map((item: any) => ({ ...item, hasChildren: true })) resolve(data) }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue index 1b7b85e..fd07381 100644 --- a/src/views/login-pc.vue +++ b/src/views/login-pc.vue @@ -17,6 +17,7 @@ const { proxy } = getCurrentInstance() as any const userStore = useUserStore() const menuStore = useMenuStore() +import indexDB from '@/utils/indexDB' const banner = new URL('../assets/images/login-banner.png', import.meta.url) .href @@ -216,6 +217,8 @@ // 清空面包屑 menuStore.resetBreadcrumb() localStorage.removeItem('token') + // 清空缓存 + indexDB.deleteAll() }) diff --git a/src/views/mobile/dashboard/userInfo.vue b/src/views/mobile/dashboard/userInfo.vue index 4fff389..541bea8 100644 --- a/src/views/mobile/dashboard/userInfo.vue +++ b/src/views/mobile/dashboard/userInfo.vue @@ -17,7 +17,7 @@ // 打开弹窗 const initDialog = () => { dialogFormVisible.value = true - console.log(userInfo, 'userInfo') + // console.log(userInfo, 'userInfo') } // 关闭 const cancel = () => { diff --git a/src/views/mobile/device/add.vue b/src/views/mobile/device/add.vue index 00d2224..a0da5db 100644 --- a/src/views/mobile/device/add.vue +++ b/src/views/mobile/device/add.vue @@ -190,7 +190,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -237,7 +237,7 @@ }) } const valiateMultipleResult = (action: string) => { - console.log(action, 'action') + // console.log(action, 'action') if (action === 'cancel') { return true } @@ -375,7 +375,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -467,7 +467,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -530,7 +530,7 @@ } // 选择安装位置 const selectTagNumber = (event: any) => { - console.log(event.target.classList, 'event') + // console.log(event.target.classList, 'event') if(event.target.innerText === '既有' || (Array(event.target.classList || [])).includes('el-tag')) { return } @@ -830,7 +830,7 @@ const watchObject = deviceTypeList.value.filter((item: any) => item.id === select[0].deviceType) deviceInfo.value.watchObject = watchObject[0].watchObject //1闸井 2场站 3管线 - console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') + // console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') if (deviceInfo.value.watchObject === '2') { addType.value = '既有' } @@ -901,9 +901,9 @@ // 获取当前位置 mapRef.value.getLocation((a, b) => { - console.log('success', a, b) + // console.log('success', a, b) }, (a, b) => { - console.log('error', a, b) + // console.log('error', a, b) }) } // 当前状态 收起retract/展开expand @@ -982,7 +982,7 @@ data[`photo${index + 1}`] = item }); (response.data.rows.length ? editDevice : addDevice)({ ...data, valid: '1', id: response.data.rows.length ? response.data.rows[0].id : undefined }).then(res => { - console.log(res.data, '新增成功') + // console.log(res.data, '新增成功') // 添加运维记录 addDeviceInstall({ repairType: '1', diff --git a/src/views/mobile/device/success.vue b/src/views/mobile/device/success.vue index 125eb71..becc185 100644 --- a/src/views/mobile/device/success.vue +++ b/src/views/mobile/device/success.vue @@ -26,7 +26,7 @@ const searchHeaderHeight = document.getElementById('base-info')?.offsetHeight || 0 const headerHeight = document.getElementById('header')?.offsetHeight || 0 scrollHeight.value = window.innerHeight - 40 - exportBtnHeight - searchHeaderHeight - 30 - headerHeight - 15 - console.log('scrollHeight', scrollHeight.value) + // console.log('scrollHeight', scrollHeight.value) } window.addEventListener('resize', () => { calcHeight() diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue index deb0bfe..6a98ee0 100644 --- a/src/views/system/area/listArea.vue +++ b/src/views/system/area/listArea.vue @@ -118,7 +118,7 @@ resolve: (date: any[]) => void, ) => { getAreaByPid(row.id).then((res) => { - console.log(res.data, 'res.data') + // console.log(res.data, 'res.data') const data = res.data.map((item: any) => ({ ...item, hasChildren: true })) resolve(data) }) diff --git a/src/views/system/dept/listDept.vue b/src/views/system/dept/listDept.vue index 3b1ca48..348ca69 100644 --- a/src/views/system/dept/listDept.vue +++ b/src/views/system/dept/listDept.vue @@ -39,7 +39,7 @@ // 查询数据 function fetchData() { loading.value = true - console.log(listQuery, 'listQuery') + // console.log(listQuery, 'listQuery') getDeptList(listQuery).then((res) => { const treeData = toTreeList(res.data.list, '0', false) list.value = treeData diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue index 1b7b85e..fd07381 100644 --- a/src/views/login-pc.vue +++ b/src/views/login-pc.vue @@ -17,6 +17,7 @@ const { proxy } = getCurrentInstance() as any const userStore = useUserStore() const menuStore = useMenuStore() +import indexDB from '@/utils/indexDB' const banner = new URL('../assets/images/login-banner.png', import.meta.url) .href @@ -216,6 +217,8 @@ // 清空面包屑 menuStore.resetBreadcrumb() localStorage.removeItem('token') + // 清空缓存 + indexDB.deleteAll() }) diff --git a/src/views/mobile/dashboard/userInfo.vue b/src/views/mobile/dashboard/userInfo.vue index 4fff389..541bea8 100644 --- a/src/views/mobile/dashboard/userInfo.vue +++ b/src/views/mobile/dashboard/userInfo.vue @@ -17,7 +17,7 @@ // 打开弹窗 const initDialog = () => { dialogFormVisible.value = true - console.log(userInfo, 'userInfo') + // console.log(userInfo, 'userInfo') } // 关闭 const cancel = () => { diff --git a/src/views/mobile/device/add.vue b/src/views/mobile/device/add.vue index 00d2224..a0da5db 100644 --- a/src/views/mobile/device/add.vue +++ b/src/views/mobile/device/add.vue @@ -190,7 +190,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -237,7 +237,7 @@ }) } const valiateMultipleResult = (action: string) => { - console.log(action, 'action') + // console.log(action, 'action') if (action === 'cancel') { return true } @@ -375,7 +375,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -467,7 +467,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -530,7 +530,7 @@ } // 选择安装位置 const selectTagNumber = (event: any) => { - console.log(event.target.classList, 'event') + // console.log(event.target.classList, 'event') if(event.target.innerText === '既有' || (Array(event.target.classList || [])).includes('el-tag')) { return } @@ -830,7 +830,7 @@ const watchObject = deviceTypeList.value.filter((item: any) => item.id === select[0].deviceType) deviceInfo.value.watchObject = watchObject[0].watchObject //1闸井 2场站 3管线 - console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') + // console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') if (deviceInfo.value.watchObject === '2') { addType.value = '既有' } @@ -901,9 +901,9 @@ // 获取当前位置 mapRef.value.getLocation((a, b) => { - console.log('success', a, b) + // console.log('success', a, b) }, (a, b) => { - console.log('error', a, b) + // console.log('error', a, b) }) } // 当前状态 收起retract/展开expand @@ -982,7 +982,7 @@ data[`photo${index + 1}`] = item }); (response.data.rows.length ? editDevice : addDevice)({ ...data, valid: '1', id: response.data.rows.length ? response.data.rows[0].id : undefined }).then(res => { - console.log(res.data, '新增成功') + // console.log(res.data, '新增成功') // 添加运维记录 addDeviceInstall({ repairType: '1', diff --git a/src/views/mobile/device/success.vue b/src/views/mobile/device/success.vue index 125eb71..becc185 100644 --- a/src/views/mobile/device/success.vue +++ b/src/views/mobile/device/success.vue @@ -26,7 +26,7 @@ const searchHeaderHeight = document.getElementById('base-info')?.offsetHeight || 0 const headerHeight = document.getElementById('header')?.offsetHeight || 0 scrollHeight.value = window.innerHeight - 40 - exportBtnHeight - searchHeaderHeight - 30 - headerHeight - 15 - console.log('scrollHeight', scrollHeight.value) + // console.log('scrollHeight', scrollHeight.value) } window.addEventListener('resize', () => { calcHeight() diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue index deb0bfe..6a98ee0 100644 --- a/src/views/system/area/listArea.vue +++ b/src/views/system/area/listArea.vue @@ -118,7 +118,7 @@ resolve: (date: any[]) => void, ) => { getAreaByPid(row.id).then((res) => { - console.log(res.data, 'res.data') + // console.log(res.data, 'res.data') const data = res.data.map((item: any) => ({ ...item, hasChildren: true })) resolve(data) }) diff --git a/src/views/system/dept/listDept.vue b/src/views/system/dept/listDept.vue index 3b1ca48..348ca69 100644 --- a/src/views/system/dept/listDept.vue +++ b/src/views/system/dept/listDept.vue @@ -39,7 +39,7 @@ // 查询数据 function fetchData() { loading.value = true - console.log(listQuery, 'listQuery') + // console.log(listQuery, 'listQuery') getDeptList(listQuery).then((res) => { const treeData = toTreeList(res.data.list, '0', false) list.value = treeData diff --git a/src/views/system/resource/editResource.vue b/src/views/system/resource/editResource.vue index 7673d89..3a3c65f 100644 --- a/src/views/system/resource/editResource.vue +++ b/src/views/system/resource/editResource.vue @@ -82,7 +82,7 @@ ).then(() => { resetForm() nextTick(() => { - console.log('clearValidate') + // console.log('clearValidate') dataFormRef.value?.clearValidate(['name', 'url']) fetchResourceTree() }) @@ -119,7 +119,7 @@ num: 0, icon: '', } - console.log('resetForm') + // console.log('resetForm') nextTick(() => { dataFormRef.value?.clearValidate() }) diff --git a/src/api/index.ts b/src/api/index.ts index dd01e75..637d02f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -37,9 +37,12 @@ * 全局拦截请求发送前提交的参数 * 以下代码为示例,在请求头里带上 token 信息 */ - if (userStore.isLogin && request.headers) { + if (userStore.isLogin && request.headers && window.localStorage.getItem('token')) { request.headers.token = userStore.token } + else { + request.headers.token = undefined + } // request.headers['Accept-Encoding'] = 'gzip, deflate, br, zstd' // 是否将 POST 请求参数进行字符串化处理 if (request.method === 'post') { @@ -67,6 +70,7 @@ if (useUserStore().isLogout === 0) { ElMessage.error(response.data.message || '发生错误') } + localStorage.removeItem('token') useUserStore().toLogout() } } @@ -106,6 +110,7 @@ const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) if (needLogin > -1) { toLogin() + localStorage.removeItem('token') } else { const message: string = error.response.data.message diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 2da5e12..14689af 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -10,11 +10,30 @@ }, headers: { sid: data.sid, + token: '' }, data, }) } +// 移动端登陆 +export function doAppLogin(data: { username: string; password: string }) { + const result = { + username: data.username.trim(), + password: data.password, + isApp: true + } + return request({ + url: `${prefix}user/appLogin`, + method: 'post', + headers: { + token: '' + }, + params: result + // data: { + // }, + }) +} // 获取用户信息 export function getInfo() { return request.get(`${prefix}user/info`) @@ -35,7 +54,14 @@ // 获取系统基础配置:公钥,验证码是否开启 export function getConfig() { - return request.get(`${prefix}config/baseConfig`) + + return request({ + method: 'get', + url: `${prefix}config/baseConfig`, + headers: { + token: '' + } + }) } // 获取验证码图片 diff --git a/src/layouts/components/Tools/alarmList.vue b/src/layouts/components/Tools/alarmList.vue index ceb907c..0df6c88 100644 --- a/src/layouts/components/Tools/alarmList.vue +++ b/src/layouts/components/Tools/alarmList.vue @@ -109,6 +109,10 @@ if (isLoading) { loading.value = false } + if(window.localStorage.getItem('browser-type-bj-well') === 'mobile') { + loading.value = false + return + } getAlarmList({ }).then((res) => { messageList.value = res.data.rows.map((item: any) => ({ ...item, diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 319884e..9cb7096 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -5,7 +5,8 @@ import { asyncRoutes, systemRoutes } from '@/router/routes' import type { Menu, Route } from '@/global' import { getUserMenus } from '@/api/system/login' - +import indexDB from '@/utils/indexDB' +import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' function hasPermission(permissions: Menu.menu[], route: Route.recordMainRaw | Route.recordRaw) { let isAuth = false if (route.meta?.auth) { @@ -220,6 +221,19 @@ else { accessedRoutes = cloneDeep(asyncRoutes) } + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } // 设置 routes 数据 this.isGenerate = true this.routes = accessedRoutes.filter(item => item.children.length !== 0) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index bc66403..1a586b3 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -1,7 +1,7 @@ import { reject } from 'lodash-es' import useRouteStore from './route' import useMenuStore from './menu' -import { doLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' +import { doLogin, doAppLogin, getConfig, getInfo, getUserMenus, logoutApi } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' @@ -98,6 +98,22 @@ }) }) }, + appLogin(data: { + username: string + password: string + }) { + return new Promise((resolve, reject) => { + doAppLogin(data).then((res) => { + localStorage.setItem('token', res.data.token) + this.username = res.data.username + this.token = res.data.token + this.isLogout = 0 + resolve() + }).catch((error) => { + reject(error) + }) + }) + }, // 注销 logout() { return new Promise((resolve) => { @@ -151,15 +167,6 @@ this.username = res.data.account this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { - // 重新拉取缓存 - fetchCacheDevice() - fetchCacheWell() - fetchCacheWell95() - fetchCacheStation() - fetchCacheDept() - fetchCacheVideo() - } }).catch(() => { reject('获取用户信息错误') }) @@ -205,6 +212,19 @@ } this.menus = menus this.btns = btns + if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { + console.log('获取缓存') + // 重新拉取缓存 + fetchCacheDept() + fetchCacheVideo() + fetchCacheWell95() + fetchCacheDevice() + setTimeout(() => { + fetchCacheWell() + fetchCacheStation() + }, 5000) + + } resolve(btns) }) }) diff --git a/src/utils/security1.ts b/src/utils/security1.ts index f367d7e..974c233 100644 --- a/src/utils/security1.ts +++ b/src/utils/security1.ts @@ -1,4 +1,7 @@ const encodedString = 'encrypt'.charCodeAt(0) - 3 +export const getencodedString = () => { + return encodedString +} // 简易加密 export function encrypt(str) { if (!str) { @@ -15,6 +18,21 @@ // 返回加密后的字符串 return `${encryptedStr},${encodedString}`; } +export function encryptNoCodedString(str) { + if (!str) { + return '' + } + let encryptedStr = ''; + // 遍历每个字符并进行加密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并加上常量 10 + let encryptedCharCode = str.charCodeAt(i) + 10; + // 将加密后的字符拼接起来 + encryptedStr += String.fromCharCode(encryptedCharCode); + } + // 返回加密后的字符串 + return `${encryptedStr}`; +} // 判断是否加密 export function isEncrypt(str) { if (str.includes(`,${encodedString}`)) { diff --git a/src/utils/structure.ts b/src/utils/structure.ts index feec9fc..fde6619 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -44,7 +44,7 @@ export function toTreeList(plainList: T[], rootId = '0', isSelect = false): T[] { const pid = findPid(plainList) if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 - console.log(pid, 'pid') + // console.log(pid, 'pid') return plainList } else if (pid.length === 1) { diff --git a/src/views/home/alarm/count/components/locationAnalysis.vue b/src/views/home/alarm/count/components/locationAnalysis.vue index 57d85ad..6f43d9c 100644 --- a/src/views/home/alarm/count/components/locationAnalysis.vue +++ b/src/views/home/alarm/count/components/locationAnalysis.vue @@ -73,7 +73,7 @@ ElMessage.warning(`该数据缺少${row.type}信息`) return } - console.log(row, 'row') + // console.log(row, 'row') if (row.type === '闸井') { $router.push({ path: '/well/detail', @@ -105,7 +105,7 @@ begTime: query.begTime, endTime: query.endTime }).then(res => { - console.log(res.data, '111') + // console.log(res.data, '111') if (!res.data) { ElMessage.warning('未找到关联设备') return @@ -146,7 +146,7 @@ } else { // 当前报警 - console.log('当前报警') + // console.log('当前报警') $router.push({ path: '/alarm/current', query: { diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 42c12be..697a18b 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -54,7 +54,7 @@ typeName: '', manufactureName: '', } - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow dialogFormVisible.value = true @@ -64,9 +64,9 @@ (type.value === 'data' ? detailAlarm : deviceAlarmView)(e.info.id).then((res) => { info.value = toHumpObject(res.data) as any info.value.alarmType = e.info.alarmType - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') if (type.value === 'data') { - console.log(type.value, 'type.value') + // console.log(type.value, 'type.value') // alarmValue watchObject info.value.alarmContent = info.value.alarmCategory.includes('浓度') ? `${info.value.alarmValue}${info.value.watchObject === '2' ? 'PPM.M' : '%LEL'}` : (alarmValue[info.value.alarmValue] || '其他') // console.log(info.value.alarmContent, 'info.value.alarmContent') @@ -193,7 +193,7 @@ emits('refresh'); (type.value === 'data' ? detailAlarm : deviceAlarmView)(info.value.id).then((res) => { info.value = toHumpObject(res.data) as any - console.log(info.value, 'info.value') + // console.log(info.value, 'info.value') }) } defineExpose({ initDialog, close }) diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index 40abb2c..a66f430 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -209,7 +209,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/alarm/current/components/map.vue b/src/views/home/alarm/current/components/map.vue index 59d204b..3a15897 100644 --- a/src/views/home/alarm/current/components/map.vue +++ b/src/views/home/alarm/current/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 253672c..d093fa3 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -72,7 +72,7 @@ // 当前时间 const time2 = new Date().getTime() let result = time2 - time1 + durationTime - console.log(result, 'result') + // console.log(result, 'result') // 已超过 const day = Math.floor(Math.abs(result) / (24 * 60 * 60 * 1000)) const hour = day > 0 ? Math.floor((Math.abs(result) - day * (24 * 60 * 60 * 1000)) / (60 * 60 * 1000)) : Math.floor(Math.abs(result) / (60 * 60 * 1000)) @@ -90,7 +90,7 @@ // 初始化对话框 const loading = ref(true) const initDialog = (row: any) => { - console.log(row, 'row') + // console.log(row, 'row') dialogFormVisible.value = true loading.value = true processData.value = JSON.parse(JSON.stringify(initData)) @@ -101,7 +101,7 @@ APPROVAL_PERSON: isEncrypt(item.APPROVAL_PERSON) ? decrypt(item.APPROVAL_PERSON) : item.APPROVAL_PERSON, NAME: isEncrypt(item.NAME) ? decrypt(item.NAME) : item.NAME, })) - console.log(res.data, '报警流程') + // console.log(res.data, '报警流程') const last = res.data[res.data.length - 1] // 挂起流程 if (last.FLOW_STATUS === '3') { @@ -141,7 +141,7 @@ 挂起原因: ${pending[0].DESCN?.split('|')[1] || ''}
剩余时长: ${computedDuartion(pending[0].APPROVAL_TIME, pending[0].DESCN?.split('|')[0])}
` - console.log(processData.value, ' processData.value[1]') + // console.log(processData.value, ' processData.value[1]') } else { const data = uniqueMultiArray(res.data, 'process_name') diff --git a/src/views/home/alarm/current/components/remindDialog.vue b/src/views/home/alarm/current/components/remindDialog.vue index a79a16e..8b020b3 100644 --- a/src/views/home/alarm/current/components/remindDialog.vue +++ b/src/views/home/alarm/current/components/remindDialog.vue @@ -53,7 +53,7 @@ resetForm() dataForm.value.alarmId = row.id isOtherUser.value = false - console.log(row, 'row') + // console.log(row, 'row') dataForm.value.remindContent = `${row.ledgerNumber}${row.position}疑似发现${row.alarmMsg},请尽快去现场确认` } defineExpose({ @@ -141,7 +141,7 @@ } // 负责人 if (newVal[0] && newVal[0] !== 'other') { - console.log(newVal) + // console.log(newVal) // TODO // 暂未开发,未提供负责人列表数据 } diff --git a/src/views/home/alarm/history/index.vue b/src/views/home/alarm/history/index.vue index 443bc8d..767da42 100644 --- a/src/views/home/alarm/history/index.vue +++ b/src/views/home/alarm/history/index.vue @@ -92,7 +92,7 @@ const fetchData = () => { loadingTable.value = true getHistoryAlarmListPage(listQuery.value).then((res) => { - console.log(res.data.rows, '查询数据') + // console.log(res.data.rows, '查询数据') list.value = res.data.rows.map((item: any) => ({ ...item, cancelDuration: item.alarmTime && item.cancelTime ? getDateDiff(item.alarmTime, item.cancelTime) : '' , @@ -264,7 +264,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/dashboard/components/alarmDialog.vue b/src/views/home/dashboard/components/alarmDialog.vue index 99c4eb2..02dda0f 100644 --- a/src/views/home/dashboard/components/alarmDialog.vue +++ b/src/views/home/dashboard/components/alarmDialog.vue @@ -21,7 +21,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow info.value = e.info diff --git a/src/views/home/dashboard/components/eventMap.vue b/src/views/home/dashboard/components/eventMap.vue index c417766..d965170 100644 --- a/src/views/home/dashboard/components/eventMap.vue +++ b/src/views/home/dashboard/components/eventMap.vue @@ -120,7 +120,7 @@ } legendData.value.push(obj) }) - console.log(legendData.value, 'legendData.value') + // console.log(legendData.value, 'legendData.value') } // 获取报警 const alarmList = ref([]) diff --git a/src/views/home/dashboard/fullScreen-components/alarmCount.vue b/src/views/home/dashboard/fullScreen-components/alarmCount.vue index dae4ff0..4c559a6 100644 --- a/src/views/home/dashboard/fullScreen-components/alarmCount.vue +++ b/src/views/home/dashboard/fullScreen-components/alarmCount.vue @@ -28,7 +28,7 @@ setTimeout(() => { data.value = [1212, 598, 449, 1387] xAxisData.value = ['高压管线', '次高压管线', '中压管线', '低压管线'] - console.log(3000) + // console.log(3000) }, 3000) }) diff --git a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue index a937367..81e9856 100644 --- a/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/allAlarmStatus.vue @@ -70,7 +70,7 @@ return pre + next }) }) -console.log(pre.value, next.value) +// console.log(pre.value, next.value) // 获取数据 const loading = ref(true) const fetchData = () => { diff --git a/src/views/home/dashboard/fullScreen-components/baseOver.vue b/src/views/home/dashboard/fullScreen-components/baseOver.vue index 8a62b2b..d56005f 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOver.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOver.vue @@ -32,7 +32,7 @@ const fetchData = () => { loading.value = true overall({ type: '1' }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/baseOverView.vue b/src/views/home/dashboard/fullScreen-components/baseOverView.vue index d86d3ed..5c33bd1 100644 --- a/src/views/home/dashboard/fullScreen-components/baseOverView.vue +++ b/src/views/home/dashboard/fullScreen-components/baseOverView.vue @@ -63,7 +63,7 @@ const fetchData = () => { loading.value = true overall({ type: $props.type }).then((res) => { - console.log(res.data, '基本概括') + // console.log(res.data, '基本概括') const dataDict = { 调压箱: 'tyx', 闸井: 'zj', diff --git a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue index ae05317..73da3b1 100644 --- a/src/views/home/dashboard/fullScreen-components/currentAlarm.vue +++ b/src/views/home/dashboard/fullScreen-components/currentAlarm.vue @@ -32,7 +32,7 @@ onMounted(() => { loadingTable.value = true getCurrentAlarmListPage({ offset: 1, limit: 999 }).then(res => { - console.log(res.data.rows, '当前报警数据') + // console.log(res.data.rows, '当前报警数据') list.value = res.data.rows loadingTable.value = false }) diff --git a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue index 333db5c..fbdefbd 100644 --- a/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue +++ b/src/views/home/dashboard/fullScreen-components/deviceRunStatus.vue @@ -58,14 +58,14 @@ const fetchData = () => { loading.value = true deviceTrendStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '设备运行态势') + // console.log(res.data, '设备运行态势') xAxisData.value = [] data.value = [] const data1 = [] as string[] const data2 = [] as string[] res.data.forEach((item: any) => { for (const i in item) { - console.log(i) + // console.log(i) xAxisData.value.push(i) data1.push(item[i]['1']) data2.push(item[i]['2']) diff --git a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue index 39e6e22..4e93f0e 100644 --- a/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue +++ b/src/views/home/dashboard/fullScreen-components/pipeNetworkType.vue @@ -42,7 +42,7 @@ const fetchData = () => { loading.value = true pipeTypeStatistics({ type: $props.type }).then((res) => { - console.log(res.data, '管网类型统计') + // console.log(res.data, '管网类型统计') xAxisData.value = res.data.map((item: any) => item.name) data.value = res.data.map((item: any) => item.value) // data.value = res.data diff --git a/src/views/home/device/device/components/alarmRecord.vue b/src/views/home/device/device/components/alarmRecord.vue index 84dafa5..b2e8b47 100644 --- a/src/views/home/device/device/components/alarmRecord.vue +++ b/src/views/home/device/device/components/alarmRecord.vue @@ -9,6 +9,7 @@ import { getDictByCode } from '@/api/system/dict' import { toHumpObject } from '@/utils/String' import { getAlarmLevelListPage, getAlarmTypeListPage } from '@/api/home/rule/alarm' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $route = useRoute() const listQuery = ref({ devcode: '', @@ -58,8 +59,9 @@ // alarmTypeName: alarmTypeList.value.filter((citem: any) => citem.id === item.alarmTypeId)[0]?.alarmType || '', // alarmLevelName: alarmLevelList.value.filter((citem: any) => citem.id === item.alarmLevel)[0]?.alarmLevel || '', // processStatusName: alarmStatusList.value.filter((citem: any) => citem.value === item.processStatus)[0]?.name || '', + processPerson: isEncrypt(item.processPerson) ? decrypt(item.processPerson) : item.processPerson })) - console.log(list.value, 'list.value') + // console.log(list.value, 'list.value') loadingTable.value = false }).catch(() => { loadingTable.value = false diff --git a/src/views/home/device/device/components/controlRecord.vue b/src/views/home/device/device/components/controlRecord.vue index 16cf58a..8509c94 100644 --- a/src/views/home/device/device/components/controlRecord.vue +++ b/src/views/home/device/device/components/controlRecord.vue @@ -106,7 +106,7 @@ return str.join() }) result = solve.join() - console.log(instructionContent, 'instructionContent') + // console.log(instructionContent, 'instructionContent') } return result } @@ -142,7 +142,7 @@ const $router = useRouter() const addControl = () => { const data = JSON.parse($route.query.row as string) - console.log(data, 'data') + // console.log(data, 'data') $router.push({ path: '/device/instruction', query: { diff --git a/src/views/home/device/device/components/dataSearch.vue b/src/views/home/device/device/components/dataSearch.vue index 9cdb8e8..5bada69 100644 --- a/src/views/home/device/device/components/dataSearch.vue +++ b/src/views/home/device/device/components/dataSearch.vue @@ -217,7 +217,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } diff --git a/src/views/home/device/device/components/electricityAnalyse.vue b/src/views/home/device/device/components/electricityAnalyse.vue index 133ad6a..bb98035 100644 --- a/src/views/home/device/device/components/electricityAnalyse.vue +++ b/src/views/home/device/device/components/electricityAnalyse.vue @@ -39,10 +39,15 @@ { text: '电量', value: 'cell', align: 'center' }, { text: '采集时间', value: 'uptime', align: 'center' }, ]) +const resizePage = () => { + setTimeout(() => { + const resize = new Event('resize') + window.dispatchEvent(resize) + }, 500) +} const fetchData = () => { const result = JSON.parse($route.query.row as string) listQuery.value.devcode = result.devcode - console.log(deviceTypeList.value, 'deviceTypeList.value') listQuery.value.typeName = deviceTypeList.value.filter((item: any) => item.typeName === result.deviceType || item.id === result.deviceType)[0]?.typeName || '' loadingTable.value = true getElectricityAnalyse({ ...listQuery.value, offset: 1, limit: 9999 }).then((res) => { @@ -58,6 +63,7 @@ symbol: 'none', }, ] + resizePage() }).catch(() => { loadingTable.value = false }) diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index f42d999..8dd38d8 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -154,7 +154,7 @@ activeName.value === '新建点位' // mapRef.value.removeMarker() if (row.tagNumber && row.deptid) { - console.log('找到绑定关系') + // console.log('找到绑定关系') loading.value = true getPositionListPage({ tagNumber: row.tagNumber, deptid: row.deptid, offset: 1, limit: 1 }).then(res => { if (res.data.rows.length) { @@ -200,7 +200,7 @@ } else { loading.value = false - console.log('没有找到绑定关系') + // console.log('没有找到绑定关系') dataForm.value.longitude = '' dataForm.value.latitude = '' dataForm.value.position = '' diff --git a/src/views/home/device/device/index.vue b/src/views/home/device/device/index.vue index 1aa4006..bc90489 100644 --- a/src/views/home/device/device/index.vue +++ b/src/views/home/device/device/index.vue @@ -347,7 +347,7 @@ // 从编辑或者新增页面回来需要重新获取列表数据 // $router.options.history.state.back 上一次路由地址 if (!($router.options.history.state.back as string || '').includes('detail')) { - console.log('需要重新获取列表') + // console.log('需要重新获取列表') fetchData() } }) diff --git a/src/views/home/device/instruction/components/editDialog.vue b/src/views/home/device/instruction/components/editDialog.vue index bcce523..72ee2e5 100644 --- a/src/views/home/device/instruction/components/editDialog.vue +++ b/src/views/home/device/instruction/components/editDialog.vue @@ -256,7 +256,7 @@ dataFormRef.value?.resetFields() const data = JSON.parse($route.query.row as string) dataForm.value = data - console.log([data.devcode]) + // console.log([data.devcode]) setTimeout(() => { dataForm.value.devCodeList = [dataForm.value.devcode] }, 100) diff --git a/src/views/home/device/type/index.vue b/src/views/home/device/type/index.vue index 2344e57..46ef2b9 100644 --- a/src/views/home/device/type/index.vue +++ b/src/views/home/device/type/index.vue @@ -39,7 +39,7 @@ const fetchData = () => { loadingTable.value = true getDeviceTypeListPage(listQuery.value).then((res) => { - console.log(res.data, '数据列表') + // console.log(res.data, '数据列表') list.value = res.data.rows total.value = res.data.total loadingTable.value = false diff --git a/src/views/home/ledger/location/index.vue b/src/views/home/ledger/location/index.vue index 7f14787..9a75f54 100644 --- a/src/views/home/ledger/location/index.vue +++ b/src/views/home/ledger/location/index.vue @@ -48,7 +48,7 @@ const fetchData = () => { loadingTable.value = true getSyncListPage(listQuery.value).then(res => { - console.log(res.data.rows) + // console.log(res.data.rows) list.value = res.data.rows.map((item: any) => ({ ...item, // typeName: item.type === '1' ? '其他监测点' : item.type === '3' ? '管线监测点' : '', diff --git a/src/views/home/operation/alarm/components/detail.vue b/src/views/home/operation/alarm/components/detail.vue index 5428d22..b909083 100644 --- a/src/views/home/operation/alarm/components/detail.vue +++ b/src/views/home/operation/alarm/components/detail.vue @@ -161,7 +161,7 @@ const mapRef = ref() const { proxy } = getCurrentInstance() as any const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') if (data.text === '位置') { if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { const watchObject = { diff --git a/src/views/home/operation/alarm/components/map.vue b/src/views/home/operation/alarm/components/map.vue index fc0820f..b870c79 100644 --- a/src/views/home/operation/alarm/components/map.vue +++ b/src/views/home/operation/alarm/components/map.vue @@ -24,7 +24,7 @@ // 地图加载完成 const completeMap = () => { completeFlag.value = true - console.log('地图加载完成') + // console.log('地图加载完成') } // 点标记弹窗 const detail = ref() diff --git a/src/views/home/operation/history/detail.vue b/src/views/home/operation/history/detail.vue index 3e2f85c..af6c736 100644 --- a/src/views/home/operation/history/detail.vue +++ b/src/views/home/operation/history/detail.vue @@ -158,7 +158,7 @@ // 点击经纬度展示地图 const mapRef = ref() const showMap = (data: any) => { - console.log(data, 'data') + // console.log(data, 'data') // if (data.text === '位置') { // if (detailInfo.value.watchObject && detailInfo.value.devcode && detailInfo.value.ledgerId) { // const watchObject = { diff --git a/src/views/home/operation/trajectory/detail.vue b/src/views/home/operation/trajectory/detail.vue index 96f3e6b..82e917a 100644 --- a/src/views/home/operation/trajectory/detail.vue +++ b/src/views/home/operation/trajectory/detail.vue @@ -42,7 +42,7 @@ endTime: listQuery.value.endTime, devCode: row.devcode, }).then((res) => { - console.log(res.data) + // console.log(res.data) loading.value = false if (res.data.length === 1) { if (res.data[0].LONGITUDE_LATITUDE) { @@ -77,7 +77,7 @@ }) // 绘制轨迹 const trajectory = res.data.filter((item: any) => item.LONGITUDE_LATITUDE).map((item: any) => (item.LONGITUDE_LATITUDE || '').split(',')) - console.log(trajectory, 'trajectory') + // console.log(trajectory, 'trajectory') mapRef.value.addPolyline({ // path: [[116.307719, 39.979882], [116.295562, 39.978876]], path: trajectory, @@ -148,8 +148,8 @@ content: content.join('
'), // 传入字符串拼接的 DOM 元素 }) setTimeout(() => { - console.log(data.data, '1') - console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) + // console.log(data.data, '1') + // console.log(data.data.data?.LONGITUDE_LATITUDE.split(',')) infoWindow.open(data.map, data.data.data?.LONGITUDE_LATITUDE.split(',') || data.map.getCenter()) }) } diff --git a/src/views/home/pipeline/components/detailInfoDialog.vue b/src/views/home/pipeline/components/detailInfoDialog.vue index 36d9fd4..356806a 100644 --- a/src/views/home/pipeline/components/detailInfoDialog.vue +++ b/src/views/home/pipeline/components/detailInfoDialog.vue @@ -114,7 +114,7 @@ const gasData = ref([]) const rowData = ref() const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row diff --git a/src/views/home/rule/alarm/components/alarmTypeList.vue b/src/views/home/rule/alarm/components/alarmTypeList.vue index 0f752eb..d2d62b3 100644 --- a/src/views/home/rule/alarm/components/alarmTypeList.vue +++ b/src/views/home/rule/alarm/components/alarmTypeList.vue @@ -30,7 +30,7 @@ getAlarmTypeListPage(listQuery.value).then((res) => { list.value = [] list.value = res.data.rows.map((item: any) => ({ ...item, enabledName: item.enabled === '1' ? '是' : '否' })) - console.log(res.data.rows, 'res.data.rows') + // console.log(res.data.rows, 'res.data.rows') total.value = res.data.total loadingTable.value = false }).catch(() => { diff --git a/src/views/home/rule/special/components/editDialog.vue b/src/views/home/rule/special/components/editDialog.vue index 7627e8f..e362c0d 100644 --- a/src/views/home/rule/special/components/editDialog.vue +++ b/src/views/home/rule/special/components/editDialog.vue @@ -113,7 +113,7 @@ ...JSON.parse(JSON.stringify(row)), } initDeviceCode.value = dataForm.value.devcode - console.log(row, '123') + // console.log(row, '123') const alarmLevelIds = dataForm.value.alarmLevelIds.split(',') const alarmRuleIds = dataForm.value.alarmRuleIds.split(',') const alarmThresholds = dataForm.value.alarmThresholds.split(',') diff --git a/src/views/home/station/station/components/detailInfoDialog copy.vue b/src/views/home/station/station/components/detailInfoDialog copy.vue index eb5b0a5..7da3e26 100644 --- a/src/views/home/station/station/components/detailInfoDialog copy.vue +++ b/src/views/home/station/station/components/detailInfoDialog copy.vue @@ -117,7 +117,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -128,7 +128,7 @@ // 获取详细信息 loading.value = true getWellDetail(e.info.id).then((res) => { - console.log(res.data, '123') + // console.log(res.data, '123') detailInfo.value = res.data loading.value = false }).catch(() => { diff --git a/src/views/home/station/station/components/map.vue b/src/views/home/station/station/components/map.vue index 534a783..5d3c218 100644 --- a/src/views/home/station/station/components/map.vue +++ b/src/views/home/station/station/components/map.vue @@ -55,7 +55,7 @@ else { legendShowData.value.push(type) } - console.log(legendShowData.value, 'legendShowData.value') + // console.log(legendShowData.value, 'legendShowData.value') resetDraw() } // 初次加载标识 @@ -95,13 +95,14 @@ 2: 1, 3: 2, } as { [key: string]: number } - const data = $props.data.map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ + const data = JSON.parse(JSON.stringify($props.data)).map((item: any) => ({ ...item, monitorState: item.monitorState || '0' })).filter((item: any) => legendShowData.value.includes(item.monitorState)).filter((item: any) => item.lngGaode && item.latGaode).map((item: any) => ({ lnglat: [item.lngGaode, item.latGaode], name: item.ledgerName, style: item.monitorState ? styleDict[item.monitorState] : 3, id: item.id, row: item, })) + console.log(data, '场站点位') mapRef.value.addCluster(data, style) // mapRef.value.addMassMarks({ // path: data, @@ -190,7 +191,7 @@ } // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { @@ -244,7 +245,8 @@ width: 20px; height: 20px; } - .transparent{ + + .transparent { opacity: 0.25; } diff --git a/src/views/home/station/station/components/monitorDataGasList.vue b/src/views/home/station/station/components/monitorDataGasList.vue index e72282f..ccfaa52 100644 --- a/src/views/home/station/station/components/monitorDataGasList.vue +++ b/src/views/home/station/station/components/monitorDataGasList.vue @@ -86,7 +86,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -188,20 +188,20 @@ } } const blurTime = () => { - console.log('blurTime') + // console.log('blurTime') } const changeTime = () => { - console.log('changeTime') + // console.log('changeTime') isConfirm.value = true } const clearTime = () => { - console.log('clearTime') + // console.log('clearTime') isConfirm.value = false fetchData(true) } const visibleTime = (type: boolean) => { - console.log('visibleTime') - console.log(type, 'type') + // console.log('visibleTime') + // console.log(type, 'type') if (!type) { // 判断是否点击过确认 if (isConfirm.value) { diff --git a/src/views/home/station/station/components/videoControl.vue b/src/views/home/station/station/components/videoControl.vue index 9e3bb92..3ec3b9d 100644 --- a/src/views/home/station/station/components/videoControl.vue +++ b/src/views/home/station/station/components/videoControl.vue @@ -93,7 +93,7 @@ } unref(playRef).playerFun.stopAllPlay() videoType.value = type - console.log('重新播放') + // console.log('重新播放') if (type === 'real') { getVideoUrl({ deviceId: currentDeviceId.value, diff --git a/src/views/home/temporary/components/map.vue b/src/views/home/temporary/components/map.vue index a2c8456..0eb5dda 100644 --- a/src/views/home/temporary/components/map.vue +++ b/src/views/home/temporary/components/map.vue @@ -264,7 +264,7 @@ // 地图绘制完毕 const completeMap = () => { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() clickLegend('智能警示桩') diff --git a/src/views/home/well/components/detailData.vue b/src/views/home/well/components/detailData.vue index 3a1aed1..d56150a 100644 --- a/src/views/home/well/components/detailData.vue +++ b/src/views/home/well/components/detailData.vue @@ -17,7 +17,7 @@ : proxy.hasPerm('/well/monitor/maintenance') ? '监控设备维护记录' : '', ) const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } defineExpose({ activeName, diff --git a/src/views/home/well/components/detailInfoDialog.vue b/src/views/home/well/components/detailInfoDialog.vue index 9840c62..3ed498b 100644 --- a/src/views/home/well/components/detailInfoDialog.vue +++ b/src/views/home/well/components/detailInfoDialog.vue @@ -109,7 +109,7 @@ // 初始化 const loading = ref(true) const initDialog = (e: any) => { - console.log(e, '信息窗体接收的数据') + // console.log(e, '信息窗体接收的数据') overlay.value = e.overlay infoWindow.value = e.infoWindow baseInfo.value = e.info.row @@ -126,7 +126,7 @@ detailInfo.value = res.data descriptionsList.value = descriptionsList.value.filter((item: any) => !item.text.includes('产权单位') && !item.text.includes('联系人')) if (baseInfo.value.manageTypeName === '自有' || baseInfo.value.manageTypeName === '') { - console.log(1) + // console.log(1) } else { descriptionsList.value.splice(2, 0, ...[ @@ -157,8 +157,8 @@ devcode: res.data[i].devcode, state: res.data[i].state, value: res.data[i].latestValue || '-', - text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', - unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', + text: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? '燃气浓度' : res.data[i].devTypeName.includes('液位') ? '液位状态' : res.data[i].devTypeName.includes('井盖') ? '井盖状态' : '', + unit: res.data[i].devTypeName.includes('燃气智能监测终端') || res.data[i].devTypeName.includes('管网哨兵') ? ' %LEL' : '', stateName: res.data[i].state === '1' ? '正常' : res.data[i].state === '0' ? '离线' : res.data[i].state === '2' ? '异常' : '', alarmContent: res.data[i].alarmContent, offDays: res.data[i].offDays @@ -197,11 +197,17 @@ } defineExpose({ initDialog, close }) -const goDeviceDetail = (code: string) => { +const goDeviceDetail = (item: any) => { + console.log(item, 'item') $router.push({ path: '/manage/detail', query: { - row: JSON.stringify({ devcode: code }), + row: JSON.stringify({ + devcode: item.devcode, + devTypeName: item.name, + deviceType: item.typeName, + deviceTypeName: item.typeName, + }) }, }) } @@ -257,8 +263,10 @@ :class="`${item.state === '2' ? 'error' : item.state === '0' && item.value !== '-' ? 'offline-color' : ''}`"> {{ item.name.includes('燃气智能监测终端') || item.name.includes('管网哨兵') ? item.value : item.stateName }}
- {{ item.unit }} - + {{ item.unit }} + 更多
@@ -271,7 +279,7 @@ 感知设备运行情况
- {{ + {{ item.devcode }} { - console.log('地图绘制完毕') + // console.log('地图绘制完毕') // 绘制海量点 resetDraw() setTimeout(() => { diff --git a/src/views/home/well/components/monitorData.vue b/src/views/home/well/components/monitorData.vue index 191615c..958c6d1 100644 --- a/src/views/home/well/components/monitorData.vue +++ b/src/views/home/well/components/monitorData.vue @@ -10,7 +10,7 @@ const $route = useRoute() const activeName = ref('燃气浓度') const handleClick = (tab: TabsPaneContext, event: Event) => { - console.log(tab, event) + // console.log(tab, event) } const showGas = ref(false) // 是否展示燃气浓度 const showLiquid = ref(false) // 是否展示井下水位 diff --git a/src/views/home/well/components/monitorDataGasList.vue b/src/views/home/well/components/monitorDataGasList.vue index 0e9915f..698a295 100644 --- a/src/views/home/well/components/monitorDataGasList.vue +++ b/src/views/home/well/components/monitorDataGasList.vue @@ -102,7 +102,7 @@ return Number(value) > Number(threshold[0]) ? '报警' : '正常' } else { - console.log(value, threshold) + // console.log(value, threshold) return Number(value) < Number(threshold[0]) && Number(value) < Number(threshold[threshold.length - 1]) ? '正常' : '报警' } } @@ -144,7 +144,7 @@ status: handlerthresholdFun(item.strength, (res1.data || []).map((item: any) => item.alarmThreshold)), rsrpName: item.rsrp ? handlerSignalStrength(Number(item.rsrp)) : '' }) as any) - console.log(markLineData, 'markLineData') + // console.log(markLineData, 'markLineData') data.value = [ { name: '燃气浓度', diff --git a/src/views/login-mobile.vue b/src/views/login-mobile.vue index 95c921b..5b36071 100644 --- a/src/views/login-mobile.vue +++ b/src/views/login-mobile.vue @@ -71,7 +71,7 @@ // 加密 finalForm.password = await RSAencrypt(loginForm.value.password) userStore - .login(finalForm) + .appLogin(finalForm) .then(() => { ElMessage({ message: '登录成功', diff --git a/src/views/login-pc.vue b/src/views/login-pc.vue index 1b7b85e..fd07381 100644 --- a/src/views/login-pc.vue +++ b/src/views/login-pc.vue @@ -17,6 +17,7 @@ const { proxy } = getCurrentInstance() as any const userStore = useUserStore() const menuStore = useMenuStore() +import indexDB from '@/utils/indexDB' const banner = new URL('../assets/images/login-banner.png', import.meta.url) .href @@ -216,6 +217,8 @@ // 清空面包屑 menuStore.resetBreadcrumb() localStorage.removeItem('token') + // 清空缓存 + indexDB.deleteAll() }) diff --git a/src/views/mobile/dashboard/userInfo.vue b/src/views/mobile/dashboard/userInfo.vue index 4fff389..541bea8 100644 --- a/src/views/mobile/dashboard/userInfo.vue +++ b/src/views/mobile/dashboard/userInfo.vue @@ -17,7 +17,7 @@ // 打开弹窗 const initDialog = () => { dialogFormVisible.value = true - console.log(userInfo, 'userInfo') + // console.log(userInfo, 'userInfo') } // 关闭 const cancel = () => { diff --git a/src/views/mobile/device/add.vue b/src/views/mobile/device/add.vue index 00d2224..a0da5db 100644 --- a/src/views/mobile/device/add.vue +++ b/src/views/mobile/device/add.vue @@ -190,7 +190,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -237,7 +237,7 @@ }) } const valiateMultipleResult = (action: string) => { - console.log(action, 'action') + // console.log(action, 'action') if (action === 'cancel') { return true } @@ -375,7 +375,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -467,7 +467,7 @@ let ParentPids = findParentPids1(allDeptList.value.filter(item => item.id !== '0'), deviceInfo.value.deptid) if (ParentPids.length) { ParentPids = ParentPids.reverse() - console.log(ParentPids, 'ParentPids') + // console.log(ParentPids, 'ParentPids') ParentPids.push(result.deptid) const dict = { 0: pickerGroupDept, @@ -530,7 +530,7 @@ } // 选择安装位置 const selectTagNumber = (event: any) => { - console.log(event.target.classList, 'event') + // console.log(event.target.classList, 'event') if(event.target.innerText === '既有' || (Array(event.target.classList || [])).includes('el-tag')) { return } @@ -830,7 +830,7 @@ const watchObject = deviceTypeList.value.filter((item: any) => item.id === select[0].deviceType) deviceInfo.value.watchObject = watchObject[0].watchObject //1闸井 2场站 3管线 - console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') + // console.log(deviceInfo.value.watchObject, '1闸井 2场站 3管线') if (deviceInfo.value.watchObject === '2') { addType.value = '既有' } @@ -901,9 +901,9 @@ // 获取当前位置 mapRef.value.getLocation((a, b) => { - console.log('success', a, b) + // console.log('success', a, b) }, (a, b) => { - console.log('error', a, b) + // console.log('error', a, b) }) } // 当前状态 收起retract/展开expand @@ -982,7 +982,7 @@ data[`photo${index + 1}`] = item }); (response.data.rows.length ? editDevice : addDevice)({ ...data, valid: '1', id: response.data.rows.length ? response.data.rows[0].id : undefined }).then(res => { - console.log(res.data, '新增成功') + // console.log(res.data, '新增成功') // 添加运维记录 addDeviceInstall({ repairType: '1', diff --git a/src/views/mobile/device/success.vue b/src/views/mobile/device/success.vue index 125eb71..becc185 100644 --- a/src/views/mobile/device/success.vue +++ b/src/views/mobile/device/success.vue @@ -26,7 +26,7 @@ const searchHeaderHeight = document.getElementById('base-info')?.offsetHeight || 0 const headerHeight = document.getElementById('header')?.offsetHeight || 0 scrollHeight.value = window.innerHeight - 40 - exportBtnHeight - searchHeaderHeight - 30 - headerHeight - 15 - console.log('scrollHeight', scrollHeight.value) + // console.log('scrollHeight', scrollHeight.value) } window.addEventListener('resize', () => { calcHeight() diff --git a/src/views/system/area/listArea.vue b/src/views/system/area/listArea.vue index deb0bfe..6a98ee0 100644 --- a/src/views/system/area/listArea.vue +++ b/src/views/system/area/listArea.vue @@ -118,7 +118,7 @@ resolve: (date: any[]) => void, ) => { getAreaByPid(row.id).then((res) => { - console.log(res.data, 'res.data') + // console.log(res.data, 'res.data') const data = res.data.map((item: any) => ({ ...item, hasChildren: true })) resolve(data) }) diff --git a/src/views/system/dept/listDept.vue b/src/views/system/dept/listDept.vue index 3b1ca48..348ca69 100644 --- a/src/views/system/dept/listDept.vue +++ b/src/views/system/dept/listDept.vue @@ -39,7 +39,7 @@ // 查询数据 function fetchData() { loading.value = true - console.log(listQuery, 'listQuery') + // console.log(listQuery, 'listQuery') getDeptList(listQuery).then((res) => { const treeData = toTreeList(res.data.list, '0', false) list.value = treeData diff --git a/src/views/system/resource/editResource.vue b/src/views/system/resource/editResource.vue index 7673d89..3a3c65f 100644 --- a/src/views/system/resource/editResource.vue +++ b/src/views/system/resource/editResource.vue @@ -82,7 +82,7 @@ ).then(() => { resetForm() nextTick(() => { - console.log('clearValidate') + // console.log('clearValidate') dataFormRef.value?.clearValidate(['name', 'url']) fetchResourceTree() }) @@ -119,7 +119,7 @@ num: 0, icon: '', } - console.log('resetForm') + // console.log('resetForm') nextTick(() => { dataFormRef.value?.clearValidate() }) diff --git a/src/views/system/user/listUser.vue b/src/views/system/user/listUser.vue index c6433a7..1e00753 100644 --- a/src/views/system/user/listUser.vue +++ b/src/views/system/user/listUser.vue @@ -10,7 +10,7 @@ import { toTreeList } from '@/utils/structure' import { RSAencrypt } from '@/utils/security' import type { TableColumn } from '@/components/NormalTable/table_interface' -import { encrypt, decrypt, isEncrypt } from '@/utils/security1' +import { encryptNoCodedString, encrypt, decrypt, isEncrypt } from '@/utils/security1' // 逻辑代码 interface Tree { name: string @@ -58,9 +58,9 @@ select.value = '' getUserList({ ...listQuery, - keywords: /^[A-Za-z]+$/.test(listQuery.keywords) ? listQuery.keywords : encrypt(listQuery.keywords) + keywords: /^[A-Za-z]+$/.test(listQuery.keywords) ? listQuery.keywords : encryptNoCodedString(listQuery.keywords) }).then((res) => { - list.value = res.data.rows.map((item: any) => ({ + list.value = JSON.parse(JSON.stringify(res.data.rows || [])).map((item: any) => ({ ...item, name: isEncrypt(item.name) ? decrypt(item.name) : item.name, phone: isEncrypt(item.phone) ? decrypt(item.phone) : item.phone, @@ -69,18 +69,26 @@ total.value = res.data.total loadingTable.value = false - // list.value.forEach((item: any) => { - // if (!isEncrypt(item.name) && !isEncrypt(item.phone) && !isEncrypt(item.email)) { - // updateUser({ - // ...item, - // name: encrypt(item.name), - // phone: encrypt(item.phone), - // email: encrypt(item.email) - // }).then(res => { - // console.log('更新成功') - // }) - // } - // }) + + if (JSON.parse(JSON.stringify(res.data.rows || [])).some((item: any) => !isEncrypt(item.name))) { + console.log('需要加密') + list.value.forEach((item: any) => { + // if (!isEncrypt(item.name) && !isEncrypt(item.phone) && !isEncrypt(item.email)) { + updateUser({ + ...item, + name: encrypt(item.name), + phone: encrypt(item.phone), + email: encrypt(item.email) + }).then(res => { + console.log('更新成功') + }) + // } + }) + } + else { + console.log('不需要加密') + } + }).catch(() => { loadingTable.value = false })