diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/src/views/home/alarm/current/components/detail.vue b/src/views/home/alarm/current/components/detail.vue index 3dab5a7..814a1ee 100644 --- a/src/views/home/alarm/current/components/detail.vue +++ b/src/views/home/alarm/current/components/detail.vue @@ -16,6 +16,7 @@ import monitorDataDialog from './monitorDataDialog.vue' import gasDataDialog from './gasDataDialog.vue' import { alarmValue } from '@/views/home/alarm/current/components/dict' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $router = useRouter() const $route = useRoute() // 页面详情数据 @@ -103,6 +104,9 @@ align: '', }, ]) +if($route.query.type === 'history') { + descriptionsList.value = descriptionsList.value.filter((item) => item.text !== '是否误报' && item.text) +} // 报警动态 const alarmDynamics = ref([]) const showDeviceTips = ref(false) // 展示设备编号提示 @@ -160,6 +164,10 @@ approvalPerson: '报警生成', dept_name: '', }) + alarmDynamics.value = alarmDynamics.value.map((item: any) => ({ + ...item, + approvalPerson: isEncrypt(item.approvalPerson) ? decrypt(item.approvalPerson) : item.approvalPerson, + })) loadingDynamics.value = false }).catch(() => { loadingDynamics.value = false @@ -252,6 +260,7 @@ gasRef.value.initDialog(detailInfo.value, timerange) } } + onMounted(() => { fetchDetail() }) diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/src/views/home/alarm/current/components/detail.vue b/src/views/home/alarm/current/components/detail.vue index 3dab5a7..814a1ee 100644 --- a/src/views/home/alarm/current/components/detail.vue +++ b/src/views/home/alarm/current/components/detail.vue @@ -16,6 +16,7 @@ import monitorDataDialog from './monitorDataDialog.vue' import gasDataDialog from './gasDataDialog.vue' import { alarmValue } from '@/views/home/alarm/current/components/dict' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $router = useRouter() const $route = useRoute() // 页面详情数据 @@ -103,6 +104,9 @@ align: '', }, ]) +if($route.query.type === 'history') { + descriptionsList.value = descriptionsList.value.filter((item) => item.text !== '是否误报' && item.text) +} // 报警动态 const alarmDynamics = ref([]) const showDeviceTips = ref(false) // 展示设备编号提示 @@ -160,6 +164,10 @@ approvalPerson: '报警生成', dept_name: '', }) + alarmDynamics.value = alarmDynamics.value.map((item: any) => ({ + ...item, + approvalPerson: isEncrypt(item.approvalPerson) ? decrypt(item.approvalPerson) : item.approvalPerson, + })) loadingDynamics.value = false }).catch(() => { loadingDynamics.value = false @@ -252,6 +260,7 @@ gasRef.value.initDialog(detailInfo.value, timerange) } } + onMounted(() => { fetchDetail() }) diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 4ba55f7..42c12be 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -218,19 +218,22 @@ style['border'] = `0.5px solid rgba(${hexToRgb(color)}, 0.5)` style['background'] = `rgba(${hexToRgb(color)}, 0.08)` } - if (name.includes('未读')) { + if(!name) { + return style + } + if (name?.includes('未读')) { handlerStyle('#f56c6c') } - else if (name.includes('已读')) { + else if (name?.includes('已读')) { handlerStyle('#0D76D4') } - else if (name.includes('待现场确认') || name.includes('待处置')) { + else if (name?.includes('待现场确认') || name?.includes('待处置')) { handlerStyle('#F7C948') } - else if (name.includes('挂起')) { + else if (name?.includes('挂起')) { handlerStyle('#F58800') } - else if (name.includes('已处置') || name.includes('已确认')) { + else if (name?.includes('已处置') || name?.includes('已确认')) { handlerStyle('#67c23a') } return style @@ -357,7 +360,8 @@ {{ info.processStatusName }}
-
+ +
现场确认情况: {{ info.confirmContent }} diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/src/views/home/alarm/current/components/detail.vue b/src/views/home/alarm/current/components/detail.vue index 3dab5a7..814a1ee 100644 --- a/src/views/home/alarm/current/components/detail.vue +++ b/src/views/home/alarm/current/components/detail.vue @@ -16,6 +16,7 @@ import monitorDataDialog from './monitorDataDialog.vue' import gasDataDialog from './gasDataDialog.vue' import { alarmValue } from '@/views/home/alarm/current/components/dict' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $router = useRouter() const $route = useRoute() // 页面详情数据 @@ -103,6 +104,9 @@ align: '', }, ]) +if($route.query.type === 'history') { + descriptionsList.value = descriptionsList.value.filter((item) => item.text !== '是否误报' && item.text) +} // 报警动态 const alarmDynamics = ref([]) const showDeviceTips = ref(false) // 展示设备编号提示 @@ -160,6 +164,10 @@ approvalPerson: '报警生成', dept_name: '', }) + alarmDynamics.value = alarmDynamics.value.map((item: any) => ({ + ...item, + approvalPerson: isEncrypt(item.approvalPerson) ? decrypt(item.approvalPerson) : item.approvalPerson, + })) loadingDynamics.value = false }).catch(() => { loadingDynamics.value = false @@ -252,6 +260,7 @@ gasRef.value.initDialog(detailInfo.value, timerange) } } + onMounted(() => { fetchDetail() }) diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 4ba55f7..42c12be 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -218,19 +218,22 @@ style['border'] = `0.5px solid rgba(${hexToRgb(color)}, 0.5)` style['background'] = `rgba(${hexToRgb(color)}, 0.08)` } - if (name.includes('未读')) { + if(!name) { + return style + } + if (name?.includes('未读')) { handlerStyle('#f56c6c') } - else if (name.includes('已读')) { + else if (name?.includes('已读')) { handlerStyle('#0D76D4') } - else if (name.includes('待现场确认') || name.includes('待处置')) { + else if (name?.includes('待现场确认') || name?.includes('待处置')) { handlerStyle('#F7C948') } - else if (name.includes('挂起')) { + else if (name?.includes('挂起')) { handlerStyle('#F58800') } - else if (name.includes('已处置') || name.includes('已确认')) { + else if (name?.includes('已处置') || name?.includes('已确认')) { handlerStyle('#67c23a') } return style @@ -357,7 +360,8 @@ {{ info.processStatusName }}
-
+ +
现场确认情况: {{ info.confirmContent }} diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index d8523d6..40abb2c 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -185,15 +185,15 @@ } as { [key: string]: string } list.value = list.value.map((item: any) => ({ ...item, - pipeInclineAlarm: item.pipeInclineAlarm === '1' || item.pipeInclineAlarm === '0' ? dict[item.pipeInclineAlarm] : item.pipeInclineAlarm, - pipeBreakAlarm: item.pipeBreakAlarm === '1' || item.pipeBreakAlarm === '0' ? dict[item.pipeBreakAlarm] : item.pipeBreakAlarm, - leftOffLineAlarm: item.leftOffLineAlarm === '1' || item.leftOffLineAlarm === '0' ? dict[item.leftOffLineAlarm] : item.leftOffLineAlarm, - leftVibrateAlarm: item.leftVibrateAlarm === '1' || item.leftVibrateAlarm === '0' ? dict[item.leftVibrateAlarm] : item.leftVibrateAlarm, - rightOffLineAlarm: item.rightOffLineAlarm === '1' || item.rightOffLineAlarm === '0' ? dict[item.rightOffLineAlarm] : item.rightOffLineAlarm, - rightVibrateAlarm: item.rightVibrateAlarm === '1' || item.rightVibrateAlarm === '0' ? dict[item.rightVibrateAlarm] : item.rightVibrateAlarm, + pipeInclineAlarm: String(item.pipeInclineAlarm) === '1' || String(item.pipeInclineAlarm) === '0' ? dict[String(item.pipeInclineAlarm)] : item.pipeInclineAlarm, + pipeBreakAlarm: String(item.pipeBreakAlarm) === '1' || String(item.pipeBreakAlarm) === '0' ? dict[String(item.pipeBreakAlarm)] : item.pipeBreakAlarm, + leftOffLineAlarm: String(item.leftOffLineAlarm) === '1' || String(item.leftOffLineAlarm) === '0' ? dict[String(item.leftOffLineAlarm)] : item.leftOffLineAlarm, + leftVibrateAlarm: String(item.leftVibrateAlarm) === '1' || String(item.leftVibrateAlarm) === '0' ? dict[String(item.leftVibrateAlarm)] : item.leftVibrateAlarm, + rightOffLineAlarm: String(item.rightOffLineAlarm) === '1' || String(item.rightOffLineAlarm) === '0' ? dict[String(item.rightOffLineAlarm)] : item.rightOffLineAlarm, + rightVibrateAlarm: String(item.rightVibrateAlarm) === '1' || String(item.rightVibrateAlarm) === '0' ? dict[String(item.rightVibrateAlarm)] : item.rightVibrateAlarm, })) } - xAxisData.value = list.value.slice().reverse().map(item => item.logtime) + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.logtime) let markLineData = [] as any[] // 判断阈值 const handlerthresholdFun = (value: string, threshold: string[]) => { @@ -256,7 +256,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.snr || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.snr || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -291,7 +291,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.gasval || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.gasval || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -332,18 +332,18 @@ data.value = [ { name: '左侧甲烷值', - data: list.value.slice().reverse().map(item => item.leftGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.leftGas || '0') }, { name: '右侧甲烷值', - data: list.value.slice().reverse().map(item => item.rightGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.rightGas || '0') } ] } else if (listQuery.value.typeName === '场站监测云台') { data.value = [ { name: '浓度', - data: list.value.slice().reverse().map(item => item.concentration || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.concentration || '0') } ] } @@ -452,9 +452,9 @@ background: 'rgba(255, 255, 255, 0.8)', }) exportExcel({ - json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, '7status': item.status })), + json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, })), name: `${info.value.devTypeName}燃气数据`, - titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/src/views/home/alarm/current/components/detail.vue b/src/views/home/alarm/current/components/detail.vue index 3dab5a7..814a1ee 100644 --- a/src/views/home/alarm/current/components/detail.vue +++ b/src/views/home/alarm/current/components/detail.vue @@ -16,6 +16,7 @@ import monitorDataDialog from './monitorDataDialog.vue' import gasDataDialog from './gasDataDialog.vue' import { alarmValue } from '@/views/home/alarm/current/components/dict' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $router = useRouter() const $route = useRoute() // 页面详情数据 @@ -103,6 +104,9 @@ align: '', }, ]) +if($route.query.type === 'history') { + descriptionsList.value = descriptionsList.value.filter((item) => item.text !== '是否误报' && item.text) +} // 报警动态 const alarmDynamics = ref([]) const showDeviceTips = ref(false) // 展示设备编号提示 @@ -160,6 +164,10 @@ approvalPerson: '报警生成', dept_name: '', }) + alarmDynamics.value = alarmDynamics.value.map((item: any) => ({ + ...item, + approvalPerson: isEncrypt(item.approvalPerson) ? decrypt(item.approvalPerson) : item.approvalPerson, + })) loadingDynamics.value = false }).catch(() => { loadingDynamics.value = false @@ -252,6 +260,7 @@ gasRef.value.initDialog(detailInfo.value, timerange) } } + onMounted(() => { fetchDetail() }) diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 4ba55f7..42c12be 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -218,19 +218,22 @@ style['border'] = `0.5px solid rgba(${hexToRgb(color)}, 0.5)` style['background'] = `rgba(${hexToRgb(color)}, 0.08)` } - if (name.includes('未读')) { + if(!name) { + return style + } + if (name?.includes('未读')) { handlerStyle('#f56c6c') } - else if (name.includes('已读')) { + else if (name?.includes('已读')) { handlerStyle('#0D76D4') } - else if (name.includes('待现场确认') || name.includes('待处置')) { + else if (name?.includes('待现场确认') || name?.includes('待处置')) { handlerStyle('#F7C948') } - else if (name.includes('挂起')) { + else if (name?.includes('挂起')) { handlerStyle('#F58800') } - else if (name.includes('已处置') || name.includes('已确认')) { + else if (name?.includes('已处置') || name?.includes('已确认')) { handlerStyle('#67c23a') } return style @@ -357,7 +360,8 @@ {{ info.processStatusName }}
-
+ +
现场确认情况: {{ info.confirmContent }} diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index d8523d6..40abb2c 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -185,15 +185,15 @@ } as { [key: string]: string } list.value = list.value.map((item: any) => ({ ...item, - pipeInclineAlarm: item.pipeInclineAlarm === '1' || item.pipeInclineAlarm === '0' ? dict[item.pipeInclineAlarm] : item.pipeInclineAlarm, - pipeBreakAlarm: item.pipeBreakAlarm === '1' || item.pipeBreakAlarm === '0' ? dict[item.pipeBreakAlarm] : item.pipeBreakAlarm, - leftOffLineAlarm: item.leftOffLineAlarm === '1' || item.leftOffLineAlarm === '0' ? dict[item.leftOffLineAlarm] : item.leftOffLineAlarm, - leftVibrateAlarm: item.leftVibrateAlarm === '1' || item.leftVibrateAlarm === '0' ? dict[item.leftVibrateAlarm] : item.leftVibrateAlarm, - rightOffLineAlarm: item.rightOffLineAlarm === '1' || item.rightOffLineAlarm === '0' ? dict[item.rightOffLineAlarm] : item.rightOffLineAlarm, - rightVibrateAlarm: item.rightVibrateAlarm === '1' || item.rightVibrateAlarm === '0' ? dict[item.rightVibrateAlarm] : item.rightVibrateAlarm, + pipeInclineAlarm: String(item.pipeInclineAlarm) === '1' || String(item.pipeInclineAlarm) === '0' ? dict[String(item.pipeInclineAlarm)] : item.pipeInclineAlarm, + pipeBreakAlarm: String(item.pipeBreakAlarm) === '1' || String(item.pipeBreakAlarm) === '0' ? dict[String(item.pipeBreakAlarm)] : item.pipeBreakAlarm, + leftOffLineAlarm: String(item.leftOffLineAlarm) === '1' || String(item.leftOffLineAlarm) === '0' ? dict[String(item.leftOffLineAlarm)] : item.leftOffLineAlarm, + leftVibrateAlarm: String(item.leftVibrateAlarm) === '1' || String(item.leftVibrateAlarm) === '0' ? dict[String(item.leftVibrateAlarm)] : item.leftVibrateAlarm, + rightOffLineAlarm: String(item.rightOffLineAlarm) === '1' || String(item.rightOffLineAlarm) === '0' ? dict[String(item.rightOffLineAlarm)] : item.rightOffLineAlarm, + rightVibrateAlarm: String(item.rightVibrateAlarm) === '1' || String(item.rightVibrateAlarm) === '0' ? dict[String(item.rightVibrateAlarm)] : item.rightVibrateAlarm, })) } - xAxisData.value = list.value.slice().reverse().map(item => item.logtime) + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.logtime) let markLineData = [] as any[] // 判断阈值 const handlerthresholdFun = (value: string, threshold: string[]) => { @@ -256,7 +256,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.snr || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.snr || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -291,7 +291,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.gasval || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.gasval || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -332,18 +332,18 @@ data.value = [ { name: '左侧甲烷值', - data: list.value.slice().reverse().map(item => item.leftGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.leftGas || '0') }, { name: '右侧甲烷值', - data: list.value.slice().reverse().map(item => item.rightGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.rightGas || '0') } ] } else if (listQuery.value.typeName === '场站监测云台') { data.value = [ { name: '浓度', - data: list.value.slice().reverse().map(item => item.concentration || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.concentration || '0') } ] } @@ -452,9 +452,9 @@ background: 'rgba(255, 255, 255, 0.8)', }) exportExcel({ - json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, '7status': item.status })), + json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, })), name: `${info.value.devTypeName}燃气数据`, - titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue index 666fe82..f2611a7 100644 --- a/src/views/home/alarm/current/components/monitorDataDialog.vue +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -92,7 +92,7 @@ setTimeout(() => { loadingTable.value = false }, 1500); - xAxisData.value = list.value.map((item: any) => item.logtime).reverse() + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.logtime) const indexDict = { 1: '一', 2: '二', @@ -131,7 +131,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.map((item: any) => item.strength).reverse(), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.strength).reverse(), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -205,9 +205,9 @@ exportExcel({ json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2strength': item.strength, '3pci': item.pci, - '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, '7status': item.status })), + '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, })), name: '浓度数据', - titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/index.html b/index.html index ab3d4a5..4201406 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@
-
<%= title %>载入中…
+
<%= title %>载入中…
为了您的体验,推荐使用以下浏览器
@@ -39,4 +39,14 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/src/views/home/alarm/current/components/detail.vue b/src/views/home/alarm/current/components/detail.vue index 3dab5a7..814a1ee 100644 --- a/src/views/home/alarm/current/components/detail.vue +++ b/src/views/home/alarm/current/components/detail.vue @@ -16,6 +16,7 @@ import monitorDataDialog from './monitorDataDialog.vue' import gasDataDialog from './gasDataDialog.vue' import { alarmValue } from '@/views/home/alarm/current/components/dict' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $router = useRouter() const $route = useRoute() // 页面详情数据 @@ -103,6 +104,9 @@ align: '', }, ]) +if($route.query.type === 'history') { + descriptionsList.value = descriptionsList.value.filter((item) => item.text !== '是否误报' && item.text) +} // 报警动态 const alarmDynamics = ref([]) const showDeviceTips = ref(false) // 展示设备编号提示 @@ -160,6 +164,10 @@ approvalPerson: '报警生成', dept_name: '', }) + alarmDynamics.value = alarmDynamics.value.map((item: any) => ({ + ...item, + approvalPerson: isEncrypt(item.approvalPerson) ? decrypt(item.approvalPerson) : item.approvalPerson, + })) loadingDynamics.value = false }).catch(() => { loadingDynamics.value = false @@ -252,6 +260,7 @@ gasRef.value.initDialog(detailInfo.value, timerange) } } + onMounted(() => { fetchDetail() }) diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 4ba55f7..42c12be 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -218,19 +218,22 @@ style['border'] = `0.5px solid rgba(${hexToRgb(color)}, 0.5)` style['background'] = `rgba(${hexToRgb(color)}, 0.08)` } - if (name.includes('未读')) { + if(!name) { + return style + } + if (name?.includes('未读')) { handlerStyle('#f56c6c') } - else if (name.includes('已读')) { + else if (name?.includes('已读')) { handlerStyle('#0D76D4') } - else if (name.includes('待现场确认') || name.includes('待处置')) { + else if (name?.includes('待现场确认') || name?.includes('待处置')) { handlerStyle('#F7C948') } - else if (name.includes('挂起')) { + else if (name?.includes('挂起')) { handlerStyle('#F58800') } - else if (name.includes('已处置') || name.includes('已确认')) { + else if (name?.includes('已处置') || name?.includes('已确认')) { handlerStyle('#67c23a') } return style @@ -357,7 +360,8 @@ {{ info.processStatusName }}
-
+ +
现场确认情况: {{ info.confirmContent }} diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index d8523d6..40abb2c 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -185,15 +185,15 @@ } as { [key: string]: string } list.value = list.value.map((item: any) => ({ ...item, - pipeInclineAlarm: item.pipeInclineAlarm === '1' || item.pipeInclineAlarm === '0' ? dict[item.pipeInclineAlarm] : item.pipeInclineAlarm, - pipeBreakAlarm: item.pipeBreakAlarm === '1' || item.pipeBreakAlarm === '0' ? dict[item.pipeBreakAlarm] : item.pipeBreakAlarm, - leftOffLineAlarm: item.leftOffLineAlarm === '1' || item.leftOffLineAlarm === '0' ? dict[item.leftOffLineAlarm] : item.leftOffLineAlarm, - leftVibrateAlarm: item.leftVibrateAlarm === '1' || item.leftVibrateAlarm === '0' ? dict[item.leftVibrateAlarm] : item.leftVibrateAlarm, - rightOffLineAlarm: item.rightOffLineAlarm === '1' || item.rightOffLineAlarm === '0' ? dict[item.rightOffLineAlarm] : item.rightOffLineAlarm, - rightVibrateAlarm: item.rightVibrateAlarm === '1' || item.rightVibrateAlarm === '0' ? dict[item.rightVibrateAlarm] : item.rightVibrateAlarm, + pipeInclineAlarm: String(item.pipeInclineAlarm) === '1' || String(item.pipeInclineAlarm) === '0' ? dict[String(item.pipeInclineAlarm)] : item.pipeInclineAlarm, + pipeBreakAlarm: String(item.pipeBreakAlarm) === '1' || String(item.pipeBreakAlarm) === '0' ? dict[String(item.pipeBreakAlarm)] : item.pipeBreakAlarm, + leftOffLineAlarm: String(item.leftOffLineAlarm) === '1' || String(item.leftOffLineAlarm) === '0' ? dict[String(item.leftOffLineAlarm)] : item.leftOffLineAlarm, + leftVibrateAlarm: String(item.leftVibrateAlarm) === '1' || String(item.leftVibrateAlarm) === '0' ? dict[String(item.leftVibrateAlarm)] : item.leftVibrateAlarm, + rightOffLineAlarm: String(item.rightOffLineAlarm) === '1' || String(item.rightOffLineAlarm) === '0' ? dict[String(item.rightOffLineAlarm)] : item.rightOffLineAlarm, + rightVibrateAlarm: String(item.rightVibrateAlarm) === '1' || String(item.rightVibrateAlarm) === '0' ? dict[String(item.rightVibrateAlarm)] : item.rightVibrateAlarm, })) } - xAxisData.value = list.value.slice().reverse().map(item => item.logtime) + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.logtime) let markLineData = [] as any[] // 判断阈值 const handlerthresholdFun = (value: string, threshold: string[]) => { @@ -256,7 +256,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.snr || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.snr || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -291,7 +291,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.gasval || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.gasval || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -332,18 +332,18 @@ data.value = [ { name: '左侧甲烷值', - data: list.value.slice().reverse().map(item => item.leftGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.leftGas || '0') }, { name: '右侧甲烷值', - data: list.value.slice().reverse().map(item => item.rightGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.rightGas || '0') } ] } else if (listQuery.value.typeName === '场站监测云台') { data.value = [ { name: '浓度', - data: list.value.slice().reverse().map(item => item.concentration || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.concentration || '0') } ] } @@ -452,9 +452,9 @@ background: 'rgba(255, 255, 255, 0.8)', }) exportExcel({ - json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, '7status': item.status })), + json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, })), name: `${info.value.devTypeName}燃气数据`, - titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue index 666fe82..f2611a7 100644 --- a/src/views/home/alarm/current/components/monitorDataDialog.vue +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -92,7 +92,7 @@ setTimeout(() => { loadingTable.value = false }, 1500); - xAxisData.value = list.value.map((item: any) => item.logtime).reverse() + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.logtime) const indexDict = { 1: '一', 2: '二', @@ -131,7 +131,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.map((item: any) => item.strength).reverse(), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.strength).reverse(), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -205,9 +205,9 @@ exportExcel({ json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2strength': item.strength, '3pci': item.pci, - '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, '7status': item.status })), + '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, })), name: '浓度数据', - titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 01cd2bb..253672c 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -6,6 +6,7 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/src/views/home/alarm/current/components/detail.vue b/src/views/home/alarm/current/components/detail.vue index 3dab5a7..814a1ee 100644 --- a/src/views/home/alarm/current/components/detail.vue +++ b/src/views/home/alarm/current/components/detail.vue @@ -16,6 +16,7 @@ import monitorDataDialog from './monitorDataDialog.vue' import gasDataDialog from './gasDataDialog.vue' import { alarmValue } from '@/views/home/alarm/current/components/dict' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $router = useRouter() const $route = useRoute() // 页面详情数据 @@ -103,6 +104,9 @@ align: '', }, ]) +if($route.query.type === 'history') { + descriptionsList.value = descriptionsList.value.filter((item) => item.text !== '是否误报' && item.text) +} // 报警动态 const alarmDynamics = ref([]) const showDeviceTips = ref(false) // 展示设备编号提示 @@ -160,6 +164,10 @@ approvalPerson: '报警生成', dept_name: '', }) + alarmDynamics.value = alarmDynamics.value.map((item: any) => ({ + ...item, + approvalPerson: isEncrypt(item.approvalPerson) ? decrypt(item.approvalPerson) : item.approvalPerson, + })) loadingDynamics.value = false }).catch(() => { loadingDynamics.value = false @@ -252,6 +260,7 @@ gasRef.value.initDialog(detailInfo.value, timerange) } } + onMounted(() => { fetchDetail() }) diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 4ba55f7..42c12be 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -218,19 +218,22 @@ style['border'] = `0.5px solid rgba(${hexToRgb(color)}, 0.5)` style['background'] = `rgba(${hexToRgb(color)}, 0.08)` } - if (name.includes('未读')) { + if(!name) { + return style + } + if (name?.includes('未读')) { handlerStyle('#f56c6c') } - else if (name.includes('已读')) { + else if (name?.includes('已读')) { handlerStyle('#0D76D4') } - else if (name.includes('待现场确认') || name.includes('待处置')) { + else if (name?.includes('待现场确认') || name?.includes('待处置')) { handlerStyle('#F7C948') } - else if (name.includes('挂起')) { + else if (name?.includes('挂起')) { handlerStyle('#F58800') } - else if (name.includes('已处置') || name.includes('已确认')) { + else if (name?.includes('已处置') || name?.includes('已确认')) { handlerStyle('#67c23a') } return style @@ -357,7 +360,8 @@ {{ info.processStatusName }}
-
+ +
现场确认情况: {{ info.confirmContent }} diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index d8523d6..40abb2c 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -185,15 +185,15 @@ } as { [key: string]: string } list.value = list.value.map((item: any) => ({ ...item, - pipeInclineAlarm: item.pipeInclineAlarm === '1' || item.pipeInclineAlarm === '0' ? dict[item.pipeInclineAlarm] : item.pipeInclineAlarm, - pipeBreakAlarm: item.pipeBreakAlarm === '1' || item.pipeBreakAlarm === '0' ? dict[item.pipeBreakAlarm] : item.pipeBreakAlarm, - leftOffLineAlarm: item.leftOffLineAlarm === '1' || item.leftOffLineAlarm === '0' ? dict[item.leftOffLineAlarm] : item.leftOffLineAlarm, - leftVibrateAlarm: item.leftVibrateAlarm === '1' || item.leftVibrateAlarm === '0' ? dict[item.leftVibrateAlarm] : item.leftVibrateAlarm, - rightOffLineAlarm: item.rightOffLineAlarm === '1' || item.rightOffLineAlarm === '0' ? dict[item.rightOffLineAlarm] : item.rightOffLineAlarm, - rightVibrateAlarm: item.rightVibrateAlarm === '1' || item.rightVibrateAlarm === '0' ? dict[item.rightVibrateAlarm] : item.rightVibrateAlarm, + pipeInclineAlarm: String(item.pipeInclineAlarm) === '1' || String(item.pipeInclineAlarm) === '0' ? dict[String(item.pipeInclineAlarm)] : item.pipeInclineAlarm, + pipeBreakAlarm: String(item.pipeBreakAlarm) === '1' || String(item.pipeBreakAlarm) === '0' ? dict[String(item.pipeBreakAlarm)] : item.pipeBreakAlarm, + leftOffLineAlarm: String(item.leftOffLineAlarm) === '1' || String(item.leftOffLineAlarm) === '0' ? dict[String(item.leftOffLineAlarm)] : item.leftOffLineAlarm, + leftVibrateAlarm: String(item.leftVibrateAlarm) === '1' || String(item.leftVibrateAlarm) === '0' ? dict[String(item.leftVibrateAlarm)] : item.leftVibrateAlarm, + rightOffLineAlarm: String(item.rightOffLineAlarm) === '1' || String(item.rightOffLineAlarm) === '0' ? dict[String(item.rightOffLineAlarm)] : item.rightOffLineAlarm, + rightVibrateAlarm: String(item.rightVibrateAlarm) === '1' || String(item.rightVibrateAlarm) === '0' ? dict[String(item.rightVibrateAlarm)] : item.rightVibrateAlarm, })) } - xAxisData.value = list.value.slice().reverse().map(item => item.logtime) + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.logtime) let markLineData = [] as any[] // 判断阈值 const handlerthresholdFun = (value: string, threshold: string[]) => { @@ -256,7 +256,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.snr || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.snr || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -291,7 +291,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.gasval || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.gasval || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -332,18 +332,18 @@ data.value = [ { name: '左侧甲烷值', - data: list.value.slice().reverse().map(item => item.leftGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.leftGas || '0') }, { name: '右侧甲烷值', - data: list.value.slice().reverse().map(item => item.rightGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.rightGas || '0') } ] } else if (listQuery.value.typeName === '场站监测云台') { data.value = [ { name: '浓度', - data: list.value.slice().reverse().map(item => item.concentration || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.concentration || '0') } ] } @@ -452,9 +452,9 @@ background: 'rgba(255, 255, 255, 0.8)', }) exportExcel({ - json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, '7status': item.status })), + json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, })), name: `${info.value.devTypeName}燃气数据`, - titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue index 666fe82..f2611a7 100644 --- a/src/views/home/alarm/current/components/monitorDataDialog.vue +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -92,7 +92,7 @@ setTimeout(() => { loadingTable.value = false }, 1500); - xAxisData.value = list.value.map((item: any) => item.logtime).reverse() + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.logtime) const indexDict = { 1: '一', 2: '二', @@ -131,7 +131,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.map((item: any) => item.strength).reverse(), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.strength).reverse(), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -205,9 +205,9 @@ exportExcel({ json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2strength': item.strength, '3pci': item.pci, - '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, '7status': item.status })), + '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, })), name: '浓度数据', - titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 01cd2bb..253672c 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -6,6 +6,7 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/src/views/home/alarm/current/components/detail.vue b/src/views/home/alarm/current/components/detail.vue index 3dab5a7..814a1ee 100644 --- a/src/views/home/alarm/current/components/detail.vue +++ b/src/views/home/alarm/current/components/detail.vue @@ -16,6 +16,7 @@ import monitorDataDialog from './monitorDataDialog.vue' import gasDataDialog from './gasDataDialog.vue' import { alarmValue } from '@/views/home/alarm/current/components/dict' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $router = useRouter() const $route = useRoute() // 页面详情数据 @@ -103,6 +104,9 @@ align: '', }, ]) +if($route.query.type === 'history') { + descriptionsList.value = descriptionsList.value.filter((item) => item.text !== '是否误报' && item.text) +} // 报警动态 const alarmDynamics = ref([]) const showDeviceTips = ref(false) // 展示设备编号提示 @@ -160,6 +164,10 @@ approvalPerson: '报警生成', dept_name: '', }) + alarmDynamics.value = alarmDynamics.value.map((item: any) => ({ + ...item, + approvalPerson: isEncrypt(item.approvalPerson) ? decrypt(item.approvalPerson) : item.approvalPerson, + })) loadingDynamics.value = false }).catch(() => { loadingDynamics.value = false @@ -252,6 +260,7 @@ gasRef.value.initDialog(detailInfo.value, timerange) } } + onMounted(() => { fetchDetail() }) diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 4ba55f7..42c12be 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -218,19 +218,22 @@ style['border'] = `0.5px solid rgba(${hexToRgb(color)}, 0.5)` style['background'] = `rgba(${hexToRgb(color)}, 0.08)` } - if (name.includes('未读')) { + if(!name) { + return style + } + if (name?.includes('未读')) { handlerStyle('#f56c6c') } - else if (name.includes('已读')) { + else if (name?.includes('已读')) { handlerStyle('#0D76D4') } - else if (name.includes('待现场确认') || name.includes('待处置')) { + else if (name?.includes('待现场确认') || name?.includes('待处置')) { handlerStyle('#F7C948') } - else if (name.includes('挂起')) { + else if (name?.includes('挂起')) { handlerStyle('#F58800') } - else if (name.includes('已处置') || name.includes('已确认')) { + else if (name?.includes('已处置') || name?.includes('已确认')) { handlerStyle('#67c23a') } return style @@ -357,7 +360,8 @@ {{ info.processStatusName }}
-
+ +
现场确认情况: {{ info.confirmContent }} diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index d8523d6..40abb2c 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -185,15 +185,15 @@ } as { [key: string]: string } list.value = list.value.map((item: any) => ({ ...item, - pipeInclineAlarm: item.pipeInclineAlarm === '1' || item.pipeInclineAlarm === '0' ? dict[item.pipeInclineAlarm] : item.pipeInclineAlarm, - pipeBreakAlarm: item.pipeBreakAlarm === '1' || item.pipeBreakAlarm === '0' ? dict[item.pipeBreakAlarm] : item.pipeBreakAlarm, - leftOffLineAlarm: item.leftOffLineAlarm === '1' || item.leftOffLineAlarm === '0' ? dict[item.leftOffLineAlarm] : item.leftOffLineAlarm, - leftVibrateAlarm: item.leftVibrateAlarm === '1' || item.leftVibrateAlarm === '0' ? dict[item.leftVibrateAlarm] : item.leftVibrateAlarm, - rightOffLineAlarm: item.rightOffLineAlarm === '1' || item.rightOffLineAlarm === '0' ? dict[item.rightOffLineAlarm] : item.rightOffLineAlarm, - rightVibrateAlarm: item.rightVibrateAlarm === '1' || item.rightVibrateAlarm === '0' ? dict[item.rightVibrateAlarm] : item.rightVibrateAlarm, + pipeInclineAlarm: String(item.pipeInclineAlarm) === '1' || String(item.pipeInclineAlarm) === '0' ? dict[String(item.pipeInclineAlarm)] : item.pipeInclineAlarm, + pipeBreakAlarm: String(item.pipeBreakAlarm) === '1' || String(item.pipeBreakAlarm) === '0' ? dict[String(item.pipeBreakAlarm)] : item.pipeBreakAlarm, + leftOffLineAlarm: String(item.leftOffLineAlarm) === '1' || String(item.leftOffLineAlarm) === '0' ? dict[String(item.leftOffLineAlarm)] : item.leftOffLineAlarm, + leftVibrateAlarm: String(item.leftVibrateAlarm) === '1' || String(item.leftVibrateAlarm) === '0' ? dict[String(item.leftVibrateAlarm)] : item.leftVibrateAlarm, + rightOffLineAlarm: String(item.rightOffLineAlarm) === '1' || String(item.rightOffLineAlarm) === '0' ? dict[String(item.rightOffLineAlarm)] : item.rightOffLineAlarm, + rightVibrateAlarm: String(item.rightVibrateAlarm) === '1' || String(item.rightVibrateAlarm) === '0' ? dict[String(item.rightVibrateAlarm)] : item.rightVibrateAlarm, })) } - xAxisData.value = list.value.slice().reverse().map(item => item.logtime) + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.logtime) let markLineData = [] as any[] // 判断阈值 const handlerthresholdFun = (value: string, threshold: string[]) => { @@ -256,7 +256,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.snr || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.snr || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -291,7 +291,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.gasval || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.gasval || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -332,18 +332,18 @@ data.value = [ { name: '左侧甲烷值', - data: list.value.slice().reverse().map(item => item.leftGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.leftGas || '0') }, { name: '右侧甲烷值', - data: list.value.slice().reverse().map(item => item.rightGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.rightGas || '0') } ] } else if (listQuery.value.typeName === '场站监测云台') { data.value = [ { name: '浓度', - data: list.value.slice().reverse().map(item => item.concentration || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.concentration || '0') } ] } @@ -452,9 +452,9 @@ background: 'rgba(255, 255, 255, 0.8)', }) exportExcel({ - json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, '7status': item.status })), + json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, })), name: `${info.value.devTypeName}燃气数据`, - titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue index 666fe82..f2611a7 100644 --- a/src/views/home/alarm/current/components/monitorDataDialog.vue +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -92,7 +92,7 @@ setTimeout(() => { loadingTable.value = false }, 1500); - xAxisData.value = list.value.map((item: any) => item.logtime).reverse() + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.logtime) const indexDict = { 1: '一', 2: '二', @@ -131,7 +131,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.map((item: any) => item.strength).reverse(), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.strength).reverse(), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -205,9 +205,9 @@ exportExcel({ json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2strength': item.strength, '3pci': item.pci, - '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, '7status': item.status })), + '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, })), name: '浓度数据', - titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 01cd2bb..253672c 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -6,6 +6,7 @@ <%- devtoolScript %> + diff --git a/public/config/config.json b/public/config/config.json index c21f0e1..d60ba89 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { - "title":"燃气物联感知平台", - "baseUrl": "http://192.168.228.39:8083", + "title":"感知数据汇聚平台", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://111.198.10.15:11643/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/App.vue b/src/App.vue index 4076bc2..3b3c411 100644 --- a/src/App.vue +++ b/src/App.vue @@ -71,10 +71,10 @@ ], () => { if (settingsStore.app.enableDynamicTitle && settingsStore.title) { const title = settingsStore.title - document.title = `${title} - ${import.meta.env.VITE_APP_TITLE}` + document.title = `${title} - ${window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE}` } else { - document.title = import.meta.env.VITE_APP_TITLE + document.title = window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE } }, { immediate: true, diff --git a/src/api/home/station/video.ts b/src/api/home/station/video.ts index 3ef12ec..58dc6ad 100644 --- a/src/api/home/station/video.ts +++ b/src/api/home/station/video.ts @@ -4,8 +4,11 @@ // 获取设备id export const getDeviceID = (deviceCode: any) => { return request({ - url: `/ptz/getOneDevice/${deviceCode}`, + url: `/ptz/getOneDevice`, method: 'post', + data: { + devcode: deviceCode + } }) } diff --git a/src/api/home/well/well.ts b/src/api/home/well/well.ts index 56fa626..ae43a8b 100644 --- a/src/api/home/well/well.ts +++ b/src/api/home/well/well.ts @@ -28,6 +28,15 @@ data, }) } +// 获取闸井下的设备类型 + +export function getTypeListByWellId(data: any) { + return request({ + url: '/system/busLedger/getTypeListByWellId', + method: 'post', + data, + }) +} // 全生命周期记录 export function getLifecycleRecord(data: any) { diff --git a/src/api/mobile/device.ts b/src/api/mobile/device.ts new file mode 100644 index 0000000..06b093e --- /dev/null +++ b/src/api/mobile/device.ts @@ -0,0 +1,21 @@ +/** + * 新装设备 + */ +import request from '@/api/index' + +// 基础列表 +export function addDevice(data: any) { + return request({ + url: `/system/busDevice/add`, + method: 'post', + data, + }) +} + +export function editDevice(data: any) { + return request({ + url: `/system/busDevice/edit`, + method: 'post', + data, + }) +} diff --git a/src/api/system/login.ts b/src/api/system/login.ts index 9b3c169..2da5e12 100644 --- a/src/api/system/login.ts +++ b/src/api/system/login.ts @@ -5,6 +5,9 @@ return request({ url: `${prefix}user/login`, method: 'post', + params: { + kaptcha: data.kaptcha + }, headers: { sid: data.sid, }, @@ -36,8 +39,8 @@ } // 获取验证码图片 -export function getKaptcha() { - return request.get(`${prefix}kaptcha/base64`) +export function getKaptcha(sid: string) { + return request.get(`${prefix}kaptcha/base64?sid=${sid}`) } // 用特定字符换取token export function getAdminToken(code: string) { diff --git a/src/components.d.ts b/src/components.d.ts index 2725c30..9ecab5e 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -87,6 +87,8 @@ VanPicker: typeof import('vant/es')['Picker'] VanPickerGroup: typeof import('vant/es')['PickerGroup'] VanPopup: typeof import('vant/es')['Popup'] + VanRadio: typeof import('vant/es')['Radio'] + VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanTextEllipsis: typeof import('vant/es')['TextEllipsis'] } } diff --git a/src/components/map/index offline.vue b/src/components/map/index offline.vue index e8c31b0..6387a43 100644 --- a/src/components/map/index offline.vue +++ b/src/components/map/index offline.vue @@ -47,6 +47,7 @@ resultFun(position) } else { + position = '' resultFun(position) } diff --git a/src/components/map/index.vue b/src/components/map/index.vue index 21f93d6..70f44d9 100644 --- a/src/components/map/index.vue +++ b/src/components/map/index.vue @@ -43,6 +43,7 @@ var geocoder = new AMap.value.Geocoder() var lnglat = location geocoder.getAddress(lnglat, (status: any, result: any) => { + console.log(status, result) if (status === 'complete' && result.info === 'OK') { // result为对应的地理位置详细信息 // console.log(result.regeocode.formattedAddress) diff --git a/src/layouts/components/Logo/index.vue b/src/layouts/components/Logo/index.vue index bdcd228..6a9e3dc 100644 --- a/src/layouts/components/Logo/index.vue +++ b/src/layouts/components/Logo/index.vue @@ -15,7 +15,7 @@ const settingsStore = useSettingsStore() -const title = ref(import.meta.env.VITE_APP_TITLE) +const title = ref(window.localStorage.getItem('project-name') || import.meta.env.VITE_APP_TITLE) const logo = ref(imgLogo) const to = computed(() => { diff --git a/src/main.ts b/src/main.ts index 8a420e8..59a469c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -52,17 +52,20 @@ window.localStorage.setItem('JsKey', result.data.JsKey) window.localStorage.setItem('areaCode', JSON.stringify(result.data.areaCode)) window.localStorage.setItem('xuntengMap', result.data.xuntengMap) - axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { - console.log('请求通了') - window.sessionStorage.setItem('ping-xunteng-layer', '1') - }).catch((error) => { - console.log('请求不通') - window.sessionStorage.setItem('ping-xunteng-layer', '') - if (error.message) { - console.log('网络异常') + window.localStorage.setItem('project-name', result.data.title) + if (window.localStorage.getItem('browser-type-bj-well') === 'pc') { + axios.get(`${window.localStorage.getItem('xuntengMap') as string}/L16/R00006105/C0000d2ba.png?ts=${new Date().getTime()}`).then(() => { + console.log('请求通了') + window.sessionStorage.setItem('ping-xunteng-layer', '1') + }).catch((error) => { + console.log('请求不通') window.sessionStorage.setItem('ping-xunteng-layer', '') - } - }) + if (error.message) { + console.log('网络异常') + window.sessionStorage.setItem('ping-xunteng-layer', '') + } + }) + } request.defaults.baseURL = result.data.baseUrl // 设置默认请求网址 app.config.globalProperties.config = result.data app.config.globalProperties.hasPerm = hasPermission @@ -101,7 +104,7 @@ } app.config.globalProperties.pauseAudio = () => { const audio = document.getElementById('eventAudio') as HTMLAudioElement - if(audio) { + if (audio) { audio.pause() } @@ -132,3 +135,4 @@ }).catch((error) => { console.error(`get baseConfig error...${error}`) }) + diff --git a/src/router/modules/mobile.ts b/src/router/modules/mobile.ts index 17f7f9c..55c8710 100644 --- a/src/router/modules/mobile.ts +++ b/src/router/modules/mobile.ts @@ -50,6 +50,18 @@ auth: '/mobile/device', }, }, + { + path: 'success', + component: () => import('@/views/mobile/device/success.vue'), + name: 'DeviceAddSuccess', + meta: { + title: '新装设备', + isHeader: true, // 是否需要头部 + isBack: true, // 是否需要返回按钮 + isHome: false, // 是否需要回到首页按钮 + auth: '/mobile/device', + }, + }, ], }, { diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 4577ab4..95be661 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -195,7 +195,7 @@ auth: '/sys/log/error/list', sidebar: true, breadcrumb: true, - activeMenu: '/system/error', + activeMenu: '/system/errorLog', }, }, { diff --git a/src/router/routes.ts b/src/router/routes.ts index b55ec3f..a18912c 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -5,7 +5,8 @@ import mobileRoute from './modules/mobile' import type { Route } from '@/global' import useSettingsStore from '@/store/modules/settings' - +import config from '/public/config/config.json' +// console.log(config) // 固定路由(默认路由) const constantRoutes: Route.recordRaw[] = [ { @@ -32,10 +33,11 @@ }, }, ] -const userAgent = navigator.userAgent || navigator.vendor || window.opera -const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// const userAgent = navigator.userAgent || navigator.vendor || window.opera +// const isMobile = /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) +// window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) +const isMobile = config.mode === 'mobile' window.localStorage.setItem('browser-type-bj-well', `${isMobile ? 'mobile' : 'pc'}`) -console.log(window.localStorage.getItem('browser-type-bj-well'), '路由中获取浏览器类型') // 系统路由 const systemRoutes: Route.recordRaw[] = [ { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index b6dc16b..bc66403 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -6,6 +6,7 @@ import type { Menu } from '@/global' import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' import indexDB from '@/utils/indexDB' +import { decrypt, isEncrypt } from '@/utils/security1' import { fetchCacheDevice, fetchCacheWell, fetchCacheStation, fetchCacheDept, fetchCacheWell95, fetchCacheVideo } from '@/utils/sessionData' const useUserStore = defineStore( // 唯一ID @@ -148,9 +149,8 @@ } this.id = res.data.id this.username = res.data.account - this.name = res.data.name + this.name = isEncrypt(res.data.name) ? decrypt(res.data.name) : res.data.name resolve(res.data) - console.log(indexDB.getStatus(), window.localStorage.getItem('browser-type-bj-well'), 'indexDB加载状态') if (indexDB.getStatus() && window.localStorage.getItem('browser-type-bj-well') === 'pc') { // 重新拉取缓存 fetchCacheDevice() diff --git a/src/utils/getLocation.ts b/src/utils/getLocation.ts index 145e800..e046f94 100644 --- a/src/utils/getLocation.ts +++ b/src/utils/getLocation.ts @@ -35,11 +35,7 @@ function successCallback(position: any) { var latitude = position.coords.latitude var longitude = position.coords.longitude - // console.log(`Latitude11: ${latitude}`) - // console.log(`Longitude11: ${longitude}`) const data = wgs84togcj02(Number(position.coords.longitude), Number(position.coords.latitude)) - // console.log(`latitude: ${data[1]}`) - // console.log(`longitude: ${data[0]}`) sessionStorage.setItem('latitude', data[1]) sessionStorage.setItem('longitude', data[0]) } diff --git a/src/utils/security.ts b/src/utils/security.ts index 160b4b0..1b55cfb 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -50,3 +50,5 @@ } return enRes } + + diff --git a/src/utils/security1.ts b/src/utils/security1.ts new file mode 100644 index 0000000..f367d7e --- /dev/null +++ b/src/utils/security1.ts @@ -0,0 +1,46 @@ +const encodedString = 'encrypt'.charCodeAt(0) - 3 +// 简易加密 +export function encrypt(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},${encodedString}`; +} +// 判断是否加密 +export function isEncrypt(str) { + if (str.includes(`,${encodedString}`)) { + return true + } + else { + return false + } +} +export function decrypt(str) { + if (!str) { + return '' + } + if (!isEncrypt(str)) { + return str + } + let decryptedNum = ''; + str = str.split(`,${encodedString}`)[0] + // 遍历每个字符并进行解密 + for (let i = 0; i < str.length; i++) { + // 将字符转换为 ASCII 码并减去常量 10 + let decryptedCharCode = str.charCodeAt(i) - 10; + // 将解密后的 ASCII 码转换为数字并拼接起来 + decryptedNum += String.fromCharCode(decryptedCharCode); + } + // 将字符串转换为数字并返回 + return decryptedNum + // return parseInt(decryptedNum); +} diff --git a/src/utils/structure.ts b/src/utils/structure.ts index 5f26866..feec9fc 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -220,4 +220,47 @@ return res; } +// 根据子元素的id找出所有父元素(树形结构数据) +export const findParentPids = (tree: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + const traverse = (node: TreeNode, parentPid?: string): boolean => { + if (node.id === targetId) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + + if (node.children) { + for (const child of node.children) { + if (traverse(child, node.id)) { + if (parentPid) { + parentPids.push(parentPid); + } + return true; + } + } + } + + return false; + }; + + for (const node of tree) { + traverse(node); + } + + return parentPids; +} +// 根据子元素的id找出所有父元素(平面数据数据) +export const findParentPids1 = (flatData: TreeNode[], targetId: string): string[] => { + const parentPids: string[] = []; + let currentNode = flatData.find(node => node.id === targetId); + + while (currentNode && currentNode.pid !== '0') { + parentPids.push(currentNode.pid); + currentNode = flatData.find(node => node.id === currentNode.pid); + } + + return parentPids; +}; diff --git a/src/views/home/alarm/current/components/detail.vue b/src/views/home/alarm/current/components/detail.vue index 3dab5a7..814a1ee 100644 --- a/src/views/home/alarm/current/components/detail.vue +++ b/src/views/home/alarm/current/components/detail.vue @@ -16,6 +16,7 @@ import monitorDataDialog from './monitorDataDialog.vue' import gasDataDialog from './gasDataDialog.vue' import { alarmValue } from '@/views/home/alarm/current/components/dict' +import { encrypt, decrypt, isEncrypt } from '@/utils/security1' const $router = useRouter() const $route = useRoute() // 页面详情数据 @@ -103,6 +104,9 @@ align: '', }, ]) +if($route.query.type === 'history') { + descriptionsList.value = descriptionsList.value.filter((item) => item.text !== '是否误报' && item.text) +} // 报警动态 const alarmDynamics = ref([]) const showDeviceTips = ref(false) // 展示设备编号提示 @@ -160,6 +164,10 @@ approvalPerson: '报警生成', dept_name: '', }) + alarmDynamics.value = alarmDynamics.value.map((item: any) => ({ + ...item, + approvalPerson: isEncrypt(item.approvalPerson) ? decrypt(item.approvalPerson) : item.approvalPerson, + })) loadingDynamics.value = false }).catch(() => { loadingDynamics.value = false @@ -252,6 +260,7 @@ gasRef.value.initDialog(detailInfo.value, timerange) } } + onMounted(() => { fetchDetail() }) diff --git a/src/views/home/alarm/current/components/detailInfoDialog.vue b/src/views/home/alarm/current/components/detailInfoDialog.vue index 4ba55f7..42c12be 100644 --- a/src/views/home/alarm/current/components/detailInfoDialog.vue +++ b/src/views/home/alarm/current/components/detailInfoDialog.vue @@ -218,19 +218,22 @@ style['border'] = `0.5px solid rgba(${hexToRgb(color)}, 0.5)` style['background'] = `rgba(${hexToRgb(color)}, 0.08)` } - if (name.includes('未读')) { + if(!name) { + return style + } + if (name?.includes('未读')) { handlerStyle('#f56c6c') } - else if (name.includes('已读')) { + else if (name?.includes('已读')) { handlerStyle('#0D76D4') } - else if (name.includes('待现场确认') || name.includes('待处置')) { + else if (name?.includes('待现场确认') || name?.includes('待处置')) { handlerStyle('#F7C948') } - else if (name.includes('挂起')) { + else if (name?.includes('挂起')) { handlerStyle('#F58800') } - else if (name.includes('已处置') || name.includes('已确认')) { + else if (name?.includes('已处置') || name?.includes('已确认')) { handlerStyle('#67c23a') } return style @@ -357,7 +360,8 @@ {{ info.processStatusName }}
-
+ +
现场确认情况: {{ info.confirmContent }} diff --git a/src/views/home/alarm/current/components/gasDataDialog.vue b/src/views/home/alarm/current/components/gasDataDialog.vue index d8523d6..40abb2c 100644 --- a/src/views/home/alarm/current/components/gasDataDialog.vue +++ b/src/views/home/alarm/current/components/gasDataDialog.vue @@ -185,15 +185,15 @@ } as { [key: string]: string } list.value = list.value.map((item: any) => ({ ...item, - pipeInclineAlarm: item.pipeInclineAlarm === '1' || item.pipeInclineAlarm === '0' ? dict[item.pipeInclineAlarm] : item.pipeInclineAlarm, - pipeBreakAlarm: item.pipeBreakAlarm === '1' || item.pipeBreakAlarm === '0' ? dict[item.pipeBreakAlarm] : item.pipeBreakAlarm, - leftOffLineAlarm: item.leftOffLineAlarm === '1' || item.leftOffLineAlarm === '0' ? dict[item.leftOffLineAlarm] : item.leftOffLineAlarm, - leftVibrateAlarm: item.leftVibrateAlarm === '1' || item.leftVibrateAlarm === '0' ? dict[item.leftVibrateAlarm] : item.leftVibrateAlarm, - rightOffLineAlarm: item.rightOffLineAlarm === '1' || item.rightOffLineAlarm === '0' ? dict[item.rightOffLineAlarm] : item.rightOffLineAlarm, - rightVibrateAlarm: item.rightVibrateAlarm === '1' || item.rightVibrateAlarm === '0' ? dict[item.rightVibrateAlarm] : item.rightVibrateAlarm, + pipeInclineAlarm: String(item.pipeInclineAlarm) === '1' || String(item.pipeInclineAlarm) === '0' ? dict[String(item.pipeInclineAlarm)] : item.pipeInclineAlarm, + pipeBreakAlarm: String(item.pipeBreakAlarm) === '1' || String(item.pipeBreakAlarm) === '0' ? dict[String(item.pipeBreakAlarm)] : item.pipeBreakAlarm, + leftOffLineAlarm: String(item.leftOffLineAlarm) === '1' || String(item.leftOffLineAlarm) === '0' ? dict[String(item.leftOffLineAlarm)] : item.leftOffLineAlarm, + leftVibrateAlarm: String(item.leftVibrateAlarm) === '1' || String(item.leftVibrateAlarm) === '0' ? dict[String(item.leftVibrateAlarm)] : item.leftVibrateAlarm, + rightOffLineAlarm: String(item.rightOffLineAlarm) === '1' || String(item.rightOffLineAlarm) === '0' ? dict[String(item.rightOffLineAlarm)] : item.rightOffLineAlarm, + rightVibrateAlarm: String(item.rightVibrateAlarm) === '1' || String(item.rightVibrateAlarm) === '0' ? dict[String(item.rightVibrateAlarm)] : item.rightVibrateAlarm, })) } - xAxisData.value = list.value.slice().reverse().map(item => item.logtime) + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.logtime) let markLineData = [] as any[] // 判断阈值 const handlerthresholdFun = (value: string, threshold: string[]) => { @@ -256,7 +256,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.snr || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.snr || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -291,7 +291,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.slice().reverse().map(item => item.gasval || '0'), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.gasval || '0'), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -332,18 +332,18 @@ data.value = [ { name: '左侧甲烷值', - data: list.value.slice().reverse().map(item => item.leftGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.leftGas || '0') }, { name: '右侧甲烷值', - data: list.value.slice().reverse().map(item => item.rightGas || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.rightGas || '0') } ] } else if (listQuery.value.typeName === '场站监测云台') { data.value = [ { name: '浓度', - data: list.value.slice().reverse().map(item => item.concentration || '0') + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map(item => item.concentration || '0') } ] } @@ -452,9 +452,9 @@ background: 'rgba(255, 255, 255, 0.8)', }) exportExcel({ - json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, '7status': item.status })), + json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2devcode': item.devcode, '3gasval': item.gasval, '4vbat': item.vbat, '5uptime': item.uptime, '6logtime': item.logtime, })), name: `${info.value.devTypeName}燃气数据`, - titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '设备编号', '燃气浓度(%LEL)', '电池电压(mV)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/monitorDataDialog.vue b/src/views/home/alarm/current/components/monitorDataDialog.vue index 666fe82..f2611a7 100644 --- a/src/views/home/alarm/current/components/monitorDataDialog.vue +++ b/src/views/home/alarm/current/components/monitorDataDialog.vue @@ -92,7 +92,7 @@ setTimeout(() => { loadingTable.value = false }, 1500); - xAxisData.value = list.value.map((item: any) => item.logtime).reverse() + xAxisData.value = JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.logtime) const indexDict = { 1: '一', 2: '二', @@ -131,7 +131,7 @@ data.value = [ { name: '燃气浓度', - data: list.value.map((item: any) => item.strength).reverse(), + data: JSON.parse(JSON.stringify(list.value)).slice().reverse().map((item: any) => item.strength).reverse(), symbol: list.value.length > 1 ? 'none' : 'circle', markLine: { data: markLineData, @@ -205,9 +205,9 @@ exportExcel({ json: list.value.map((item: any, index: number) => ({ '1index': index + 1, '2strength': item.strength, '3pci': item.pci, - '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, '7status': item.status })), + '4cell': item.cell, '5uptime': item.uptime,'6logtime': item.logtime, })), name: '浓度数据', - titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间', '设备状态'], + titleArr: ['序号', '燃气浓度(%LEL)', '信号强度', '电池电压(%)', '采集时间', '上传时间'], sheetName: 'sheet1', }) loading.close() diff --git a/src/views/home/alarm/current/components/processDialog.vue b/src/views/home/alarm/current/components/processDialog.vue index 01cd2bb..253672c 100644 --- a/src/views/home/alarm/current/components/processDialog.vue +++ b/src/views/home/alarm/current/components/processDialog.vue @@ -6,6 +6,7 @@