diff --git a/public/config/config.json b/public/config/config.json index 1053b40..22f4711 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"感知数据汇聚平台", - "baseUrl": "http://10.30.7.26:20705", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://10.30.7.26:20705/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/public/config/config.json b/public/config/config.json index 1053b40..22f4711 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"感知数据汇聚平台", - "baseUrl": "http://10.30.7.26:20705", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://10.30.7.26:20705/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/components.d.ts b/src/components.d.ts index e1cc6fe..b6e680f 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -54,6 +54,7 @@ NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] + offline: typeof import('./components/map/index offline.vue')['default'] PageHeader: typeof import('./components/PageHeader/index.vue')['default'] PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] diff --git a/public/config/config.json b/public/config/config.json index 1053b40..22f4711 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"感知数据汇聚平台", - "baseUrl": "http://10.30.7.26:20705", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://10.30.7.26:20705/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/components.d.ts b/src/components.d.ts index e1cc6fe..b6e680f 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -54,6 +54,7 @@ NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] + offline: typeof import('./components/map/index offline.vue')['default'] PageHeader: typeof import('./components/PageHeader/index.vue')['default'] PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] diff --git a/src/components/HKplayer/index.vue b/src/components/HKplayer/index.vue index d5e2fd8..cb6c5be 100644 --- a/src/components/HKplayer/index.vue +++ b/src/components/HKplayer/index.vue @@ -10,6 +10,7 @@ import loadingImg from './loading.gif' import { ElMessage } from 'element-plus' import { RefreshRight } from '@element-plus/icons-vue' +import { generateUniqueString } from '@/utils/String' const props = defineProps({ playId: { require: true, @@ -30,6 +31,8 @@ }, }) const emit = defineEmits(['error', 'complete']) +const onlyStr = generateUniqueString() +console.log(onlyStr, 'onlyStr') const player = ref() const playerInfo = ref({}) const error = ref(false) @@ -90,14 +93,14 @@ const id = props.playId const video = document.getElementById(id) as HTMLDivElement // 创建图片 - if (document.getElementById("img-hk-custom")) { - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + if (document.getElementById(`${onlyStr}-img-hk-custom`)) { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) } const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` // 将图片放在视频之上 const width = video.style.width const height = video.style.height @@ -153,7 +156,7 @@ // 创建图片 const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` error.value = false // 将图片放在视频之上 const width = video.style.width @@ -171,7 +174,7 @@ console.log('playbackStart success') // 播放成功删除图片 // img.remove() - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) error.value = false diff --git a/public/config/config.json b/public/config/config.json index 1053b40..22f4711 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"感知数据汇聚平台", - "baseUrl": "http://10.30.7.26:20705", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://10.30.7.26:20705/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/components.d.ts b/src/components.d.ts index e1cc6fe..b6e680f 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -54,6 +54,7 @@ NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] + offline: typeof import('./components/map/index offline.vue')['default'] PageHeader: typeof import('./components/PageHeader/index.vue')['default'] PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] diff --git a/src/components/HKplayer/index.vue b/src/components/HKplayer/index.vue index d5e2fd8..cb6c5be 100644 --- a/src/components/HKplayer/index.vue +++ b/src/components/HKplayer/index.vue @@ -10,6 +10,7 @@ import loadingImg from './loading.gif' import { ElMessage } from 'element-plus' import { RefreshRight } from '@element-plus/icons-vue' +import { generateUniqueString } from '@/utils/String' const props = defineProps({ playId: { require: true, @@ -30,6 +31,8 @@ }, }) const emit = defineEmits(['error', 'complete']) +const onlyStr = generateUniqueString() +console.log(onlyStr, 'onlyStr') const player = ref() const playerInfo = ref({}) const error = ref(false) @@ -90,14 +93,14 @@ const id = props.playId const video = document.getElementById(id) as HTMLDivElement // 创建图片 - if (document.getElementById("img-hk-custom")) { - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + if (document.getElementById(`${onlyStr}-img-hk-custom`)) { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) } const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` // 将图片放在视频之上 const width = video.style.width const height = video.style.height @@ -153,7 +156,7 @@ // 创建图片 const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` error.value = false // 将图片放在视频之上 const width = video.style.width @@ -171,7 +174,7 @@ console.log('playbackStart success') // 播放成功删除图片 // img.remove() - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) error.value = false diff --git a/src/utils/String.ts b/src/utils/String.ts index d6c0bb4..4b3da73 100644 --- a/src/utils/String.ts +++ b/src/utils/String.ts @@ -67,3 +67,34 @@ const date = new Date(year, month - 1, day); return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day; } + +/** + * 生成唯一随机字符串 + * @param length - 字符串长度,默认32位 + * @param prefix - 前缀字符串,可选 + * @returns 唯一随机字符串 + */ +export function generateUniqueString(length: number = 32, prefix?: string): string { + // 获取当前时间戳(毫秒级) + const timestamp = Date.now().toString(36); // 转换为36进制缩短长度 + + // 生成随机字符串 + let randomStr = ''; + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + const charsLength = chars.length; + + for (let i = 0; i < length; i++) { + randomStr += chars.charAt(Math.floor(Math.random() * charsLength)); + } + + // 组合结果(时间戳+随机字符串) + let result = `${timestamp}-${randomStr}`; + + // 如果指定了前缀,添加前缀 + if (prefix) { + result = `${prefix}-${result}`; + } + + // 截取到指定长度(如果超过) + return result.substring(0, prefix ? prefix.length + length + timestamp.length + 2 : length + timestamp.length + 1); +} diff --git a/public/config/config.json b/public/config/config.json index 1053b40..22f4711 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"感知数据汇聚平台", - "baseUrl": "http://10.30.7.26:20705", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://10.30.7.26:20705/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/components.d.ts b/src/components.d.ts index e1cc6fe..b6e680f 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -54,6 +54,7 @@ NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] + offline: typeof import('./components/map/index offline.vue')['default'] PageHeader: typeof import('./components/PageHeader/index.vue')['default'] PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] diff --git a/src/components/HKplayer/index.vue b/src/components/HKplayer/index.vue index d5e2fd8..cb6c5be 100644 --- a/src/components/HKplayer/index.vue +++ b/src/components/HKplayer/index.vue @@ -10,6 +10,7 @@ import loadingImg from './loading.gif' import { ElMessage } from 'element-plus' import { RefreshRight } from '@element-plus/icons-vue' +import { generateUniqueString } from '@/utils/String' const props = defineProps({ playId: { require: true, @@ -30,6 +31,8 @@ }, }) const emit = defineEmits(['error', 'complete']) +const onlyStr = generateUniqueString() +console.log(onlyStr, 'onlyStr') const player = ref() const playerInfo = ref({}) const error = ref(false) @@ -90,14 +93,14 @@ const id = props.playId const video = document.getElementById(id) as HTMLDivElement // 创建图片 - if (document.getElementById("img-hk-custom")) { - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + if (document.getElementById(`${onlyStr}-img-hk-custom`)) { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) } const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` // 将图片放在视频之上 const width = video.style.width const height = video.style.height @@ -153,7 +156,7 @@ // 创建图片 const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` error.value = false // 将图片放在视频之上 const width = video.style.width @@ -171,7 +174,7 @@ console.log('playbackStart success') // 播放成功删除图片 // img.remove() - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) error.value = false diff --git a/src/utils/String.ts b/src/utils/String.ts index d6c0bb4..4b3da73 100644 --- a/src/utils/String.ts +++ b/src/utils/String.ts @@ -67,3 +67,34 @@ const date = new Date(year, month - 1, day); return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day; } + +/** + * 生成唯一随机字符串 + * @param length - 字符串长度,默认32位 + * @param prefix - 前缀字符串,可选 + * @returns 唯一随机字符串 + */ +export function generateUniqueString(length: number = 32, prefix?: string): string { + // 获取当前时间戳(毫秒级) + const timestamp = Date.now().toString(36); // 转换为36进制缩短长度 + + // 生成随机字符串 + let randomStr = ''; + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + const charsLength = chars.length; + + for (let i = 0; i < length; i++) { + randomStr += chars.charAt(Math.floor(Math.random() * charsLength)); + } + + // 组合结果(时间戳+随机字符串) + let result = `${timestamp}-${randomStr}`; + + // 如果指定了前缀,添加前缀 + if (prefix) { + result = `${prefix}-${result}`; + } + + // 截取到指定长度(如果超过) + return result.substring(0, prefix ? prefix.length + length + timestamp.length + 2 : length + timestamp.length + 1); +} diff --git a/src/views/home/dashboard/index.vue b/src/views/home/dashboard/index.vue index 174d624..b83d4af 100644 --- a/src/views/home/dashboard/index.vue +++ b/src/views/home/dashboard/index.vue @@ -86,6 +86,8 @@ leakageData.value[y] = data[i] } } + leakageData.value.off = '958' + leakageData.value.total = Number(leakageData.value.off) + Number(leakageData.value.normal) + Number(leakageData.value.alarm) + Number(leakageData.value.exception) // 防外力破坏监测概况数据 for (const y in forceData.value) { if (i.toLocaleLowerCase().includes('damage') && i.toLocaleLowerCase().includes(y)) { diff --git a/public/config/config.json b/public/config/config.json index 1053b40..22f4711 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"感知数据汇聚平台", - "baseUrl": "http://10.30.7.26:20705", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://10.30.7.26:20705/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/components.d.ts b/src/components.d.ts index e1cc6fe..b6e680f 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -54,6 +54,7 @@ NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] + offline: typeof import('./components/map/index offline.vue')['default'] PageHeader: typeof import('./components/PageHeader/index.vue')['default'] PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] diff --git a/src/components/HKplayer/index.vue b/src/components/HKplayer/index.vue index d5e2fd8..cb6c5be 100644 --- a/src/components/HKplayer/index.vue +++ b/src/components/HKplayer/index.vue @@ -10,6 +10,7 @@ import loadingImg from './loading.gif' import { ElMessage } from 'element-plus' import { RefreshRight } from '@element-plus/icons-vue' +import { generateUniqueString } from '@/utils/String' const props = defineProps({ playId: { require: true, @@ -30,6 +31,8 @@ }, }) const emit = defineEmits(['error', 'complete']) +const onlyStr = generateUniqueString() +console.log(onlyStr, 'onlyStr') const player = ref() const playerInfo = ref({}) const error = ref(false) @@ -90,14 +93,14 @@ const id = props.playId const video = document.getElementById(id) as HTMLDivElement // 创建图片 - if (document.getElementById("img-hk-custom")) { - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + if (document.getElementById(`${onlyStr}-img-hk-custom`)) { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) } const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` // 将图片放在视频之上 const width = video.style.width const height = video.style.height @@ -153,7 +156,7 @@ // 创建图片 const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` error.value = false // 将图片放在视频之上 const width = video.style.width @@ -171,7 +174,7 @@ console.log('playbackStart success') // 播放成功删除图片 // img.remove() - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) error.value = false diff --git a/src/utils/String.ts b/src/utils/String.ts index d6c0bb4..4b3da73 100644 --- a/src/utils/String.ts +++ b/src/utils/String.ts @@ -67,3 +67,34 @@ const date = new Date(year, month - 1, day); return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day; } + +/** + * 生成唯一随机字符串 + * @param length - 字符串长度,默认32位 + * @param prefix - 前缀字符串,可选 + * @returns 唯一随机字符串 + */ +export function generateUniqueString(length: number = 32, prefix?: string): string { + // 获取当前时间戳(毫秒级) + const timestamp = Date.now().toString(36); // 转换为36进制缩短长度 + + // 生成随机字符串 + let randomStr = ''; + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + const charsLength = chars.length; + + for (let i = 0; i < length; i++) { + randomStr += chars.charAt(Math.floor(Math.random() * charsLength)); + } + + // 组合结果(时间戳+随机字符串) + let result = `${timestamp}-${randomStr}`; + + // 如果指定了前缀,添加前缀 + if (prefix) { + result = `${prefix}-${result}`; + } + + // 截取到指定长度(如果超过) + return result.substring(0, prefix ? prefix.length + length + timestamp.length + 2 : length + timestamp.length + 1); +} diff --git a/src/views/home/dashboard/index.vue b/src/views/home/dashboard/index.vue index 174d624..b83d4af 100644 --- a/src/views/home/dashboard/index.vue +++ b/src/views/home/dashboard/index.vue @@ -86,6 +86,8 @@ leakageData.value[y] = data[i] } } + leakageData.value.off = '958' + leakageData.value.total = Number(leakageData.value.off) + Number(leakageData.value.normal) + Number(leakageData.value.alarm) + Number(leakageData.value.exception) // 防外力破坏监测概况数据 for (const y in forceData.value) { if (i.toLocaleLowerCase().includes('damage') && i.toLocaleLowerCase().includes(y)) { diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index 7b5f915..f710718 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -12,6 +12,7 @@ import AMap from '@/components/map/index.vue' // import { getDictByCode } from '@/api/system/dict' import { getLocation } from '@/utils/getLocation' +import addDialog from '@/views/home/ledger/location/components/addDialog.vue' const emits = defineEmits(['confirm']) const dialogFormVisible = ref(false) // 对话框是否显示 const activeName = ref('新建点位') @@ -396,12 +397,20 @@ }) } fetchDict() + +// 编辑临时点位 +const editRef = ref() +const editRow = (row: any) => { + // console.log(row, '111') + editRef.value.initDialog('edit', row) +} + diff --git a/public/config/config.json b/public/config/config.json index 1053b40..22f4711 100644 --- a/public/config/config.json +++ b/public/config/config.json @@ -1,6 +1,6 @@ { "title":"感知数据汇聚平台", - "baseUrl": "http://10.30.7.26:20705", + "baseUrl": "http://111.198.10.15:11643", "securityJsCode": "56bf9671d4b3517d294caec4751889a1", "JsKey": "40849e82b4e33f5255b17372520c954d", "xuntengMap": "http://10.30.7.26:20705/getMap?mapPath=http://172.17.206.70:20198/_allLayer/tile", diff --git a/src/components.d.ts b/src/components.d.ts index e1cc6fe..b6e680f 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -54,6 +54,7 @@ NodeWrap: typeof import('./components/workFlow/nodeWrap.vue')['default'] NodeWrapBan: typeof import('./components/workFlow/nodeWrapBan.vue')['default'] NormalTable: typeof import('./components/NormalTable/index.vue')['default'] + offline: typeof import('./components/map/index offline.vue')['default'] PageHeader: typeof import('./components/PageHeader/index.vue')['default'] PageMain: typeof import('./components/PageMain/index.vue')['default'] PcasCascader: typeof import('./components/PcasCascader/index.vue')['default'] diff --git a/src/components/HKplayer/index.vue b/src/components/HKplayer/index.vue index d5e2fd8..cb6c5be 100644 --- a/src/components/HKplayer/index.vue +++ b/src/components/HKplayer/index.vue @@ -10,6 +10,7 @@ import loadingImg from './loading.gif' import { ElMessage } from 'element-plus' import { RefreshRight } from '@element-plus/icons-vue' +import { generateUniqueString } from '@/utils/String' const props = defineProps({ playId: { require: true, @@ -30,6 +31,8 @@ }, }) const emit = defineEmits(['error', 'complete']) +const onlyStr = generateUniqueString() +console.log(onlyStr, 'onlyStr') const player = ref() const playerInfo = ref({}) const error = ref(false) @@ -90,14 +93,14 @@ const id = props.playId const video = document.getElementById(id) as HTMLDivElement // 创建图片 - if (document.getElementById("img-hk-custom")) { - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + if (document.getElementById(`${onlyStr}-img-hk-custom`)) { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) } const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` // 将图片放在视频之上 const width = video.style.width const height = video.style.height @@ -153,7 +156,7 @@ // 创建图片 const img = document.createElement("img") img.src = loadingImg - img.id = 'img-hk-custom' + img.id = `${onlyStr}-img-hk-custom` error.value = false // 将图片放在视频之上 const width = video.style.width @@ -171,7 +174,7 @@ console.log('playbackStart success') // 播放成功删除图片 // img.remove() - document.querySelectorAll('[id="img-hk-custom"]').forEach(element => { + document.querySelectorAll(`[id="${onlyStr}-img-hk-custom"]`).forEach(element => { element.remove(); }) error.value = false diff --git a/src/utils/String.ts b/src/utils/String.ts index d6c0bb4..4b3da73 100644 --- a/src/utils/String.ts +++ b/src/utils/String.ts @@ -67,3 +67,34 @@ const date = new Date(year, month - 1, day); return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day; } + +/** + * 生成唯一随机字符串 + * @param length - 字符串长度,默认32位 + * @param prefix - 前缀字符串,可选 + * @returns 唯一随机字符串 + */ +export function generateUniqueString(length: number = 32, prefix?: string): string { + // 获取当前时间戳(毫秒级) + const timestamp = Date.now().toString(36); // 转换为36进制缩短长度 + + // 生成随机字符串 + let randomStr = ''; + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + const charsLength = chars.length; + + for (let i = 0; i < length; i++) { + randomStr += chars.charAt(Math.floor(Math.random() * charsLength)); + } + + // 组合结果(时间戳+随机字符串) + let result = `${timestamp}-${randomStr}`; + + // 如果指定了前缀,添加前缀 + if (prefix) { + result = `${prefix}-${result}`; + } + + // 截取到指定长度(如果超过) + return result.substring(0, prefix ? prefix.length + length + timestamp.length + 2 : length + timestamp.length + 1); +} diff --git a/src/views/home/dashboard/index.vue b/src/views/home/dashboard/index.vue index 174d624..b83d4af 100644 --- a/src/views/home/dashboard/index.vue +++ b/src/views/home/dashboard/index.vue @@ -86,6 +86,8 @@ leakageData.value[y] = data[i] } } + leakageData.value.off = '958' + leakageData.value.total = Number(leakageData.value.off) + Number(leakageData.value.normal) + Number(leakageData.value.alarm) + Number(leakageData.value.exception) // 防外力破坏监测概况数据 for (const y in forceData.value) { if (i.toLocaleLowerCase().includes('damage') && i.toLocaleLowerCase().includes(y)) { diff --git a/src/views/home/device/device/components/localtionForPieple.vue b/src/views/home/device/device/components/localtionForPieple.vue index 7b5f915..f710718 100644 --- a/src/views/home/device/device/components/localtionForPieple.vue +++ b/src/views/home/device/device/components/localtionForPieple.vue @@ -12,6 +12,7 @@ import AMap from '@/components/map/index.vue' // import { getDictByCode } from '@/api/system/dict' import { getLocation } from '@/utils/getLocation' +import addDialog from '@/views/home/ledger/location/components/addDialog.vue' const emits = defineEmits(['confirm']) const dialogFormVisible = ref(false) // 对话框是否显示 const activeName = ref('新建点位') @@ -396,12 +397,20 @@ }) } fetchDict() + +// 编辑临时点位 +const editRef = ref() +const editRow = (row: any) => { + // console.log(row, '111') + editRef.value.initDialog('edit', row) +} + diff --git a/src/views/home/device/device/components/localtionForWell.vue b/src/views/home/device/device/components/localtionForWell.vue index b65eda8..d8a00bf 100644 --- a/src/views/home/device/device/components/localtionForWell.vue +++ b/src/views/home/device/device/components/localtionForWell.vue @@ -14,6 +14,7 @@ import { getSyncListPage } from '@/api/home/ledger/location' import { indexDBHandler } from '@/utils/sessionData' import indexDB from '@/utils/indexDB' +import addDialog from '@/views/home/ledger/location/components/addDialog.vue' const emits = defineEmits(['confirm']) const dialogFormVisible = ref(false) // 对话框是否显示 const disabledBtn = ref(false) @@ -249,6 +250,15 @@ tableRef.value.clearMulti() tableRef.value.table.toggleRowSelection(res.data.rows[0], undefined, true) loading.value = false + // dataForm.value = { + // tagNumber: row.tagNumber, + // longitude: row.lng, + // latitude: row.lat, + // position: row.position, + // deptid: row.deptid, + // ledgerName: row.ledgerName, + // locationCategory: row.locationCategory, + // } } else { // 临时点位 需要找到安装位置列表的临时点位 @@ -261,6 +271,15 @@ loading.value = false tableRef1.value.clearMulti() tableRef1.value.table.toggleRowSelection(res.data.rows[0], undefined, true) + dataForm.value = { + tagNumber: row.tagNumber, + longitude: row.lng, + latitude: row.lat, + position: row.position, + deptid: row.deptid, + ledgerName: row.ledgerName, + locationCategory: res.data.rows[0].locationCategory, + } } else { loading.value = false @@ -460,10 +479,17 @@ clearSelectTemporary() resetTemporary() } +// 编辑临时点位 +const editRef = ref() +const editRow = (row: any) => { + // console.log(row, '111') + editRef.value.initDialog('edit', row) +} - + @change="changePage" @multi-select="multiSelect" @row-disabled="rowDisabled">