调整台账

This commit is contained in:
guanj
2026-04-03 14:47:36 +08:00
parent 0b9aafc1b5
commit 3ffb11defa
5 changed files with 183 additions and 149 deletions

View File

@@ -2,6 +2,7 @@
<div class="mac-address-input" :class="{ disabled: disabled }">
<el-input
ref="inputRef"
placeholder="请输入设备mac地址"
v-model="macValue"
type="text"
maxlength="17"
@@ -92,12 +93,10 @@ const handleKeydown = (event: KeyboardEvent) => {
if (event.key === 'Backspace') {
// 处理在冒号前删除的情况
const cursorPos = target.selectionStart || 0
if (cursorPos > 0 && macValue.value[cursorPos - 1] === ':' &&
target.selectionStart === target.selectionEnd) {
if (cursorPos > 0 && macValue.value[cursorPos - 1] === ':' && target.selectionStart === target.selectionEnd) {
event.preventDefault()
// 删除冒号前的两个字符
const newValue = macValue.value.substring(0, cursorPos - 3) +
macValue.value.substring(cursorPos)
const newValue = macValue.value.substring(0, cursorPos - 3) + macValue.value.substring(cursorPos)
macValue.value = newValue
// 设置光标位置
setTimeout(() => {
@@ -135,7 +134,7 @@ const handlePaste = (event: ClipboardEvent) => {
// 监听modelValue变化
watch(
() => props.modelValue,
(newVal) => {
newVal => {
const cleanNewVal = (newVal || '').replace(/[^0-9a-fA-F]/g, '').toUpperCase()
const currentCleanValue = macValue.value.replace(/:/g, '')

View File

@@ -193,7 +193,10 @@
</el-form-item>
<!--项目-->
<div style="width: 100%" v-if="nodeLevel > 0 || pageStatus == 2">
<div
style="width: 100%"
v-if="(nodeLevel > 0 || pageStatus == 2) && formData.projectInfoList.length > 0"
>
<el-tabs
v-model="deviceIndex"
type="card"
@@ -333,7 +336,11 @@
<!--设备-->
<div
style="width: 100%"
v-if="(nodeLevel > 1 || pageStatus == 2) && (nodeLevel >= 2 || pageStatus == 2)"
v-if="
(nodeLevel > 1 || pageStatus == 2) &&
(nodeLevel >= 2 || pageStatus == 2) &&
formData.deviceInfoList.length > 0
"
>
<el-tabs
v-model="busBarIndex"
@@ -656,7 +663,11 @@
<!--监测点-->
<div
style="width: 100%"
v-if="(nodeLevel > 2 || pageStatus == 2) && (nodeLevel >= 3 || pageStatus == 2)"
v-if="
(nodeLevel > 2 || pageStatus == 2) &&
(nodeLevel >= 3 || pageStatus == 2) &&
formData.lineInfoList.length > 0
"
>
<el-tabs
type="card"
@@ -703,7 +714,7 @@
:rules="{
required: true,
message: '请选择线路号',
trigger: 'blur'
trigger: 'change'
}"
>
<el-select
@@ -731,7 +742,11 @@
class="form-item"
label="接线方式:"
:prop="'lineInfoList[' + lIndex + '].conType'"
:rules="{ required: true, message: '请选择接线方式', trigger: 'blur' }"
:rules="{
required: true,
message: '请选择接线方式',
trigger: 'change'
}"
>
<el-select
clearable
@@ -758,7 +773,11 @@
class="form-item"
label="统计间隔:"
:prop="'lineInfoList[' + lIndex + '].lineInterval'"
:rules="{ required: true, message: '请选择统计间隔', trigger: 'blur' }"
:rules="{
required: true,
message: '请选择统计间隔',
trigger: 'change'
}"
>
<el-select
clearable
@@ -975,7 +994,11 @@
class="form-item"
label="电压等级:"
:prop="'lineInfoList[' + lIndex + '].volGrade'"
:rules="{ required: true, message: '请选择电压等级', trigger: 'blur' }"
:rules="{
required: true,
message: '请选择电压等级',
trigger: 'change'
}"
>
<el-select
clearable
@@ -1027,7 +1050,7 @@
:rules="{
required: true,
message: '请选择监测对象类型',
trigger: 'blur'
trigger: 'change'
}"
>
<el-select
@@ -1058,7 +1081,7 @@
:rules="{
required: true,
message: '请选择监测位置',
trigger: 'blur'
trigger: 'change'
}"
>
<el-select
@@ -1113,7 +1136,11 @@
class="form-item"
label="运行状态:"
:prop="'lineInfoList[' + lIndex + '].runStatus'"
:rules="{ required: true, message: '请选择运行状态', trigger: 'blur' }"
:rules="{
required: true,
message: '请选择运行状态',
trigger: 'change'
}"
>
<!-- 0运行1检修2停运3调试4退运 -->
<el-select
@@ -1351,7 +1378,7 @@
</el-select>
</el-form-item>
<el-form-item class="form-item" label="通讯状态:">
<el-form-item class="form-item" label="运行状态:">
<!-- 0运行1检修2停运3调试4退运 -->
<el-select
clearable
@@ -1360,8 +1387,11 @@
placeholder="请选择通讯状态"
:disabled="true"
>
<el-option label="离线" :value="1" />
<el-option label="在线" :value="2" />
<el-option label="运行" :value="0" />
<el-option label="检修" :value="1" />
<el-option label="停运" :value="2" />
<el-option label="调试" :value="3" />
<el-option label="退运" :value="4" />
</el-select>
</el-form-item>
</div>
@@ -1476,6 +1506,7 @@ const loading = ref(false)
const nextfalg = ref(false)
const dictData = useDictData()
const nodeLevel = ref(0)
const nodeLevelCopy = ref(0)
const pageStatus = ref(1)
const titleList: any = ref([])
const nodeData: any = ref([])
@@ -1941,7 +1972,7 @@ const add = () => {
return
}
pageStatus.value = 2
nodeLevelCopy.value = nodeLevel.value
// 根据当前节点层级添加对应的tab页
switch (nodeLevel.value) {
case 0: // 新增工程不需要添加tab
@@ -2243,8 +2274,8 @@ const remove = () => {
type: 'warning'
})
.then(() => {
switch (nodeLevel.value) {
case 1:
switch (nodeData.value.level) {
case 0:
let data = {
id: nodeData.value.id,
status: '0'
@@ -2262,7 +2293,7 @@ const remove = () => {
})
break
case 2: // 项目层级
case 1: // 项目层级
// 删除项目后选中工程节点
const engineeringId = nodeData.value.pids ? nodeData.value.pids.split(',')[1] : null
deleteProject(nodeData.value.id, '', '', '', 0, '', '').then((res: any) => {
@@ -2282,7 +2313,7 @@ const remove = () => {
})
break
case 3: // 设备层级
case 2: // 设备层级
// 删除设备后选中项目节点
const projectId = nodeData.value.pids ? nodeData.value.pids.split(',')[2] : null
deleteEquipment(nodeData.value.id).then((res: any) => {
@@ -2302,7 +2333,7 @@ const remove = () => {
})
break
case 4: // 监测点层级
case 3: // 监测点层级
const deviceId = nodeData.value.pids ? nodeData.value.pids.split(',')[3] : null
deleteLine(nodeData.value.id).then((res: any) => {
@@ -2502,21 +2533,21 @@ const submitAllLevelData = async () => {
const engineeringData = tempAllLevelData.value.engineering || { ...formData.value.engineeringParam }
// 项目信息
const projectData =
const projectData: any =
tempAllLevelData.value.projects.length > 0
? tempAllLevelData.value.projects.find(project => project !== undefined) || {}
: formData.value.projectInfoList[0] || {}
// 如果是从根节点开始新增工程和项目
if (nodeData.value.level === 0) {
if (nodeData.value.level === -1) {
submitData = {
engineering: engineeringData,
project: projectData
project: { ...projectData, topoIds: [projectData.topoId] }
}
} else {
// 如果是从工程节点开始新增项目
submitData = {
engineeringIndex: nodeData.value?.id || '',
project: projectData
project: { ...projectData, topoIds: [projectData.topoId] }
}
}
break
@@ -2541,10 +2572,10 @@ const submitAllLevelData = async () => {
}
// 如果是从根节点开始新增
if (nodeData.value.level === 0) {
if (nodeData.value.level === -1) {
submitData = {
engineering: engineeringData2,
project: projectData2,
project: { ...projectData2, topoIds: [projectData2.topoId] },
device: devices.map((device: any) => ({
...device,
ndid: device.mac ? device.mac.replace(/:/g, '') : ''
@@ -2552,10 +2583,10 @@ const submitAllLevelData = async () => {
}
}
// 如果是从工程节点开始新增
else if (nodeData.value.level === 1) {
else if (nodeData.value.level === 0) {
submitData = {
engineeringIndex: nodeData.value?.id || '',
project: projectData2,
project: { ...projectData2, topoIds: [projectData2.topoId] },
device: devices.map((device: any) => ({
...device,
ndid: device.mac ? device.mac.replace(/:/g, '') : ''
@@ -2563,7 +2594,7 @@ const submitAllLevelData = async () => {
}
}
// 如果是从项目节点开始新增
else if (nodeData.value.level === 2) {
else if (nodeData.value.level === 1) {
const pidsArray = nodeData.value?.pids ? nodeData.value.pids.split(',') : []
const engineeringId = pidsArray.length >= 2 ? pidsArray[1] : ''
@@ -2578,8 +2609,8 @@ const submitAllLevelData = async () => {
}
break
case 3: // 工程 + 项目 + 设备 + 监测点
case 4:
// case 3: // 工程 + 项目 + 设备 + 监测点
case 3:
// 工程信息
const engineeringData3 = tempAllLevelData.value.engineering || {
...formData.value.engineeringParam
@@ -2608,10 +2639,10 @@ const submitAllLevelData = async () => {
}
// 如果是从根节点开始新增
if (nodeData.value.level === 0) {
if (nodeData.value.level === -1) {
submitData = {
engineering: engineeringData3,
project: projectData3,
project: { ...projectData3, topoIds: [projectData3.topoId] },
device: devices2.map((device: any) => ({
...device,
ndid: device.mac ? device.mac.replace(/:/g, '') : ''
@@ -2638,7 +2669,7 @@ const submitAllLevelData = async () => {
}
}
// 如果是从工程节点开始新增
else if (nodeData.value.level === 1) {
else if (nodeData.value.level === 0) {
submitData = {
engineeringIndex: nodeData.value?.id || '',
project: projectData3,
@@ -2668,7 +2699,7 @@ const submitAllLevelData = async () => {
}
}
// 如果是从项目节点开始新增
else if (nodeData.value.level === 2) {
else if (nodeData.value.level === 1) {
const pidsArray = nodeData.value?.pids ? nodeData.value.pids.split(',') : []
const engineeringId = pidsArray.length >= 2 ? pidsArray[1] : ''
@@ -2701,7 +2732,7 @@ const submitAllLevelData = async () => {
}
}
// 如果是从设备节点开始新增
else if (nodeData.value.level === 3) {
else if (nodeData.value.level === 2) {
const pidsArray2 = nodeData.value?.pids ? nodeData.value.pids.split(',') : []
const engineeringId2 = pidsArray2.length >= 2 ? pidsArray2[1] : ''
const projectId = pidsArray2.length >= 3 ? pidsArray2[2] : ''

View File

@@ -746,26 +746,28 @@ const mqttMessage = ref<any>({})
const status: any = ref()
function parseStringToObject(str: string) {
const content = str.replace(/^{|}$/g, '')
const pairs = content.split(',')
const result: any = {}
pairs.forEach(pair => {
const [key, value] = pair.split(':')
// 尝试将数字转换为Number类型
result[key.trim()] = isNaN(Number(value)) ? value.trim() : Number(value)
})
// 正则匹配:key:value 格式,支持 value 里带 : / 等字符
const regex = /([^,:]+):([^,]+)(?=,|$)/g
let match
while ((match = regex.exec(content)) !== null) {
const key = match[1].trim()
const value = match[2].trim()
// 数字自动转 Number
result[key] = isNaN(Number(value)) ? value : Number(value)
}
return result
}
mqttRef.value.on('message', (topic: any, message: any) => {
// console.log('mqtt接收到消息', JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message)))))
let str = JSON.parse(JSON.stringify(JSON.parse(new TextDecoder().decode(message))))
let regex = /fileName:(.*?),allStep/
let regex1 = /allStep:(.*?),nowStep/
let regex2 = /nowStep:(.*?),userId/
let regex3 = /userId:(.*?)}/
mqttMessage.value = parseStringToObject(str)
if (adminInfo.id != mqttMessage.value.userId) return
// console.log("🚀 ~ str.match(regex3)[1]:", str.match(regex3)[1])
status.value = parseInt(Number((mqttMessage.value.nowStep / mqttMessage.value.allStep) * 100))
fileRef.value.setStatus(mqttMessage.value)

View File

@@ -3,6 +3,7 @@
<div :class="downLoading ? 'all_disabled' : ''">
<el-dialog v-model.trim="dialogVisible" title="文件信息" width="50%" @closed="handleClose">
<div v-loading="loading">
<div
class="download_progress"
v-if="mqttFileName.includes(fileNameInfoMation) && status != 0 && status != 100"
@@ -57,7 +58,7 @@ import {
getFileServiceFileOrDir,
downLoadDeviceFile,
downLoadDeviceFilePath
} from '@/api/cs-device-boot/fileService.ts'
} from '@/api/cs-device-boot/fileService'
import { ElMessage } from 'element-plus'
import { useAdminInfo } from '@/stores/adminInfo'
import { downLoadFile } from '@/api/cs-system-boot/manage.ts'

View File

@@ -170,7 +170,8 @@ queryByCode('Device_Type').then(res => {
// 版本维护
const maintenance = () => {
push({
path: '/versionMaintenance'
// path: '/versionMaintenance'
path: '/govern/manage/basic/version'
})
}