调整台账录入页面

This commit is contained in:
guanj
2026-04-15 13:44:28 +08:00
parent cfcbfc45d6
commit 632a0104fb
3 changed files with 109 additions and 102 deletions

View File

@@ -144,3 +144,11 @@ export function queryPushResult() {
method: 'post' method: 'post'
}) })
} }
//监测设备接入
export function onlineRegister(data: any) {
return createAxios({
url: '/access-boot/device/onlineRegister',
method: 'post',
params: data
})
}

View File

@@ -13,8 +13,13 @@
<pane style="background: #fff"> <pane style="background: #fff">
<div class="device-manage-right"> <div class="device-manage-right">
<el-form :inline="true" class="demo-form-inline" style="height: 42px"> <el-form :inline="true" class="demo-form-inline" style="height: 42px">
<el-form-item style="position: relative; z-index: 2" v-if="connectionMethod != 'MQTT'"> <el-form-item style="position: relative; z-index: 2">
<el-button icon="el-icon-Plus" type="primary" @click="add" v-if="nodeLevel != 4"> <el-button
icon="el-icon-Plus"
type="primary"
@click="add"
v-if="!(nodeLevel == 3 && connectionMethod == 'MQTT') && nodeLevel != 4"
>
{{ {{
nodeLevel == 0 nodeLevel == 0
? '新增工程' ? '新增工程'
@@ -57,11 +62,11 @@
修改提交 修改提交
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item style="position: relative; z-index: 2" v-else> <!-- <el-form-item style="position: relative; z-index: 2" v-else>
<span style="font-size: 16px; font-weight: bold; color: var(--el-color-primary)"> <span style="font-size: 16px; font-weight: bold; color: var(--el-color-primary)">
治理设备/便携式设备不支持操作 治理设备/便携式设备不支持操作
</span> </span>
</el-form-item> </el-form-item> -->
<el-form-item style="right: 300px; position: absolute; overflow: hidden"> <el-form-item style="right: 300px; position: absolute; overflow: hidden">
<LocationInformation <LocationInformation
@@ -356,7 +361,7 @@
:label="busItem.name ? busItem.name : '新建设备' + bIndex" :label="busItem.name ? busItem.name : '新建设备' + bIndex"
:name="bIndex + ''" :name="bIndex + ''"
> >
<div class="flex mt10" v-if="busItem.devAccessMethod == 'CLD'"> <div class="flex mt10">
<el-form-item <el-form-item
class="form-item" class="form-item"
label="设备名称:" label="设备名称:"
@@ -402,7 +407,7 @@
" "
> >
<el-option <el-option
v-for="item in formDevTypeOptions" v-for="item in [...formDevTypeOptions, ...devTypeOptions]"
:key="item.value" :key="item.value"
:label="item.label || item.name" :label="item.label || item.name"
:value="item.value || item.id" :value="item.value || item.id"
@@ -433,7 +438,7 @@
" "
> >
<el-option <el-option
v-for="option in devCLD" v-for="option in [...devCLD, ...devModelOptions]"
:key="option.id" :key="option.id"
:label="option.name" :label="option.name"
:value="option.id" :value="option.id"
@@ -464,6 +469,7 @@
" "
> >
<el-option label="CLD" value="CLD"></el-option> <el-option label="CLD" value="CLD"></el-option>
<el-option label="MQTT" value="MQTT"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -482,18 +488,7 @@
:disabled="!(pageStatus == 2 && nodeLevel == 2)" :disabled="!(pageStatus == 2 && nodeLevel == 2)"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item
class="form-item"
label="网络设备ID:"
:rules="[{ required: true, message: '请输入网络设备ID', trigger: 'blur' }]"
>
<el-input clearable
v-model="busItem.ndid"
disabled
placeholder="请输入网络设备ID"
></el-input>
</el-form-item> -->
<el-form-item <el-form-item
class="form-item" class="form-item"
label="合同号:" label="合同号:"
@@ -513,6 +508,7 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="busItem.devAccessMethod == 'CLD'"
class="form-item" class="form-item"
label="所属前置机:" label="所属前置机:"
:prop="'deviceInfoList[' + bIndex + '].nodeId'" :prop="'deviceInfoList[' + bIndex + '].nodeId'"
@@ -536,6 +532,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="busItem.devAccessMethod == 'CLD'"
class="form-item" class="form-item"
label="进程号:" label="进程号:"
:prop="'deviceInfoList[' + bIndex + '].nodeProcess'" :prop="'deviceInfoList[' + bIndex + '].nodeProcess'"
@@ -548,6 +545,7 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="busItem.devAccessMethod == 'CLD'"
class="form-item" class="form-item"
label="日志等级:" label="日志等级:"
:prop="'deviceInfoList[' + bIndex + '].devLogLevel'" :prop="'deviceInfoList[' + bIndex + '].devLogLevel'"
@@ -583,7 +581,7 @@
clearable clearable
filterable filterable
v-model="busItem.usageStatus" v-model="busItem.usageStatus"
placeholder="请选择日志等级" placeholder="请选择是否启用"
style="width: 100%" style="width: 100%"
:disabled=" :disabled="
!( !(
@@ -597,6 +595,20 @@
<el-option label="停用" :value="0"></el-option> <el-option label="停用" :value="0"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item
label="接入:"
v-if="connectionMethod == 'MQTT' && busItem?.id"
>
<el-button
icon="el-icon-Sort"
type="primary"
size="small"
@click="access(busItem)"
:loading="accessLoading"
>
{{ accessLoading ? '接入中' : '接入' }}
</el-button>
</el-form-item>
<el-form-item <el-form-item
class="form-item" class="form-item"
label="排序:" label="排序:"
@@ -617,68 +629,6 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
</div> </div>
<div class="flex mt10" v-else>
<el-form-item class="form-item" label="设备名称:">
<el-input
clearable
v-model="busItem.name"
placeholder="请输入设备名称"
:disabled="true"
></el-input>
</el-form-item>
<el-form-item id="id200" class="form-item" label="设备类型:">
<el-select
clearable
filterable
v-model="busItem.devType"
placeholder="请选择设备类型"
style="width: 100%"
:disabled="true"
>
<el-option
v-for="item in devTypeOptions"
:key="item.value"
:label="item.label || item.name"
:value="item.value || item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item id="id200" class="form-item" label="设备型号:">
<el-select
clearable
filterable
v-model="busItem.devModel"
placeholder="请选择设备型号"
style="width: 100%"
:disabled="true"
>
<el-option
v-for="option in devModelOptions"
:key="option.id"
:label="option.name"
:value="option.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item id="id200" class="form-item" label="设备接入方式:">
<el-select
clearable
filterable
v-model="busItem.devAccessMethod"
placeholder="请选择设备接入方式"
style="width: 100%"
:disabled="true"
>
<el-option label="CLD" value="CLD"></el-option>
</el-select>
</el-form-item>
<el-form-item class="form-item" label="设备mac地址:">
<MacAddressInput
v-model="busItem.mac"
:disabled="!(pageStatus == 2 && nodeLevel == 2)"
/>
</el-form-item>
</div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
@@ -1469,7 +1419,7 @@
</div> </div>
</div> </div>
<div v-else style="text-align: center; padding: 20px"> <div v-else style="text-align: center; padding: 20px">
<el-icon :size="40" class="is-loading" style="color: #409eff"> <el-icon :size="40" class="instruction" style="color: #409eff">
<Loading /> <Loading />
</el-icon> </el-icon>
<p style="margin-top: 15px; font-size: 16px">指令下发中,请稍候...</p> <p style="margin-top: 15px; font-size: 16px">指令下发中,请稍候...</p>
@@ -1503,7 +1453,8 @@ import {
updateEquipment, updateEquipment,
updateLine, updateLine,
pushLog, pushLog,
queryPushResult queryPushResult,
onlineRegister
} from '@/api/cs-device-boot/cloudDeviceEntry' } from '@/api/cs-device-boot/cloudDeviceEntry'
import { getTopoTemplate } from '@/api/cs-device-boot/topologyTemplate' import { getTopoTemplate } from '@/api/cs-device-boot/topologyTemplate'
import { getFileUrl } from '@/api/system-boot/file' import { getFileUrl } from '@/api/system-boot/file'
@@ -1550,8 +1501,8 @@ const linePosition: any = dictData.getBasicData('Line_Position')
const currentGdName: any = ref('') const currentGdName: any = ref('')
const affiliatiedFrontArr: any = ref([]) const affiliatiedFrontArr: any = ref([])
const voltageLevelArr = dictData.getBasicData('Dev_Voltage_Stand') const voltageLevelArr = dictData.getBasicData('Dev_Voltage_Stand')
const devCLD = ref<{ id: string; name: string }[] | null>(null) const devCLD: any = ref([])
const devTypeOptions = ref<{ id: string; name: string }[] | null>(null) const devTypeOptions: any = []
const devTypeOptions2: any = ref([]) const devTypeOptions2: any = ref([])
const treeClickCount = ref(0) const treeClickCount = ref(0)
const areaTree: any = tree const areaTree: any = tree
@@ -2039,7 +1990,7 @@ const add = () => {
cntractNo: '', cntractNo: '',
sort: 0, sort: 0,
nodeProcess: '', nodeProcess: '',
usageStatus: 0 usageStatus: 1
}) })
busBarIndex.value = (formData.value.deviceInfoList.length - 1).toString() busBarIndex.value = (formData.value.deviceInfoList.length - 1).toString()
// 清理监测点数据 // 清理监测点数据
@@ -2428,7 +2379,7 @@ const next = async () => {
cntractNo: '', cntractNo: '',
sort: 0, sort: 0,
nodeProcess: '', nodeProcess: '',
usageStatus: 0 usageStatus: 1
}) })
busBarIndex.value = (formData.value.deviceInfoList.length - 1).toString() busBarIndex.value = (formData.value.deviceInfoList.length - 1).toString()
nextfalg.value = false nextfalg.value = false
@@ -2870,7 +2821,7 @@ const resetAllForms = () => {
device.mac = '' device.mac = ''
device.nodeId = '' device.nodeId = ''
device.cntractNo = '' device.cntractNo = ''
device.usageStatus = 0 device.usageStatus = 1
device.sort = 0 device.sort = 0
}) })
@@ -3191,7 +3142,7 @@ const handleBusBarTabsEdit = (targetName: any, action: any) => {
cntractNo: '', cntractNo: '',
sort: 0, sort: 0,
nodeProcess: '', nodeProcess: '',
usageStatus: 0 usageStatus: 1
}) })
busBarIndex.value = (formData.value.deviceInfoList.length - 1).toString() busBarIndex.value = (formData.value.deviceInfoList.length - 1).toString()
} else if (action === 'remove') { } else if (action === 'remove') {
@@ -3400,6 +3351,24 @@ const area = async () => {
userList.value = res.data.records userList.value = res.data.records
}) })
} }
const accessLoading = ref(false)
// 接入
const access = (item: any) => {
accessLoading.value = true
onlineRegister({
projectId: formData.value.projectInfoList[0].id,
nDid: item.ndid
})
.then((res: any) => {
if (res.code == 'A0000') {
ElMessage.success(res)
accessLoading.value = false
}
})
.catch(() => {
accessLoading.value = false
})
}
onMounted(() => { onMounted(() => {
nodeData.value.level = 0 nodeData.value.level = 0
@@ -3420,7 +3389,7 @@ area()
<style scoped></style> <style scoped></style>
<style lang="scss" scoped> <style lang="scss" scoped>
.is-loading { .instruction {
animation: rotating 2s linear infinite; animation: rotating 2s linear infinite;
} }

View File

@@ -141,7 +141,7 @@
v-show=" v-show="
dataSet.includes('_items') || dataSet.includes('_items') ||
dataSet.indexOf('_history') != -1 || dataSet.indexOf('_history') != -1 ||
dataSet.indexOf('_moduleData') != -1|| dataSet.indexOf('_moduleData') != -1 ||
dataSet.indexOf('_devRunTrend') != -1 dataSet.indexOf('_devRunTrend') != -1
" "
> >
@@ -166,7 +166,11 @@
</el-select> --> </el-select> -->
<el-radio-group <el-radio-group
v-model.trim="formInline.dataLevel" v-model.trim="formInline.dataLevel"
v-if="!dataSet.includes('_devRunTrend') &&!dataSet.includes('_moduleData') && TrendList?.lineType == 1" v-if="
!dataSet.includes('_devRunTrend') &&
!dataSet.includes('_moduleData') &&
TrendList?.lineType == 1
"
:disabled="TrendList?.lineType != 1" :disabled="TrendList?.lineType != 1"
@change="handleClick" @change="handleClick"
> >
@@ -227,7 +231,7 @@
<el-button <el-button
type="primary" type="primary"
:disabled="tableLoading" :disabled="tableLoading"
v-if="realTimeFlag" v-if="showButton"
:icon="DataLine" :icon="DataLine"
@click="handleTrend" @click="handleTrend"
> >
@@ -235,13 +239,22 @@
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
v-if="realTimeFlag" v-if="showButton"
:icon="TrendCharts" :icon="TrendCharts"
@click="handleHarmonicSpectrum" @click="handleHarmonicSpectrum"
:disabled="tableLoading" :disabled="tableLoading"
> >
实时趋势 实时趋势
</el-button> </el-button>
<el-button
type="primary"
v-if="showButton"
:icon="Download"
@click="downloadTxt"
:disabled="tableLoading"
>
下载数据
</el-button>
</template> </template>
</TableHeader> </TableHeader>
<div <div
@@ -580,7 +593,7 @@ import { useRouter } from 'vue-router'
import TableHeader from '@/components/table/header/index.vue' import TableHeader from '@/components/table/header/index.vue'
import { useAdminInfo } from '@/stores/adminInfo' import { useAdminInfo } from '@/stores/adminInfo'
import { import {
Histogram, Download,
TrendCharts, TrendCharts,
DataLine, DataLine,
DataAnalysis, DataAnalysis,
@@ -592,6 +605,7 @@ import {
} from '@element-plus/icons-vue' } from '@element-plus/icons-vue'
import analysisList from './analysisList/index.vue' import analysisList from './analysisList/index.vue'
import mqtt from 'mqtt' import mqtt from 'mqtt'
import { json } from 'node:stream/consumers'
defineOptions({ defineOptions({
name: 'govern/device/control' name: 'govern/device/control'
}) })
@@ -671,6 +685,7 @@ const volConTypeList = dictData.getBasicData('Dev_Connect')
// } // }
//谐波频谱 //谐波频谱
const realTrendRef = ref() const realTrendRef = ref()
const txtContent = ref('')
const operatingTrendRef = ref() const operatingTrendRef = ref()
const changeTrendType = (val: any) => { const changeTrendType = (val: any) => {
trendDataTime.value = '' trendDataTime.value = ''
@@ -681,7 +696,7 @@ const changeTrendType = (val: any) => {
const activeTrendName: any = ref(0) const activeTrendName: any = ref(0)
const trendTimer: any = ref() const trendTimer: any = ref()
const trendDataTime: any = ref() const trendDataTime: any = ref()
const showButton = ref(false)
//谐波频谱方法 //谐波频谱方法
const handleTrend = async () => { const handleTrend = async () => {
realTimeFlag.value = false realTimeFlag.value = false
@@ -755,7 +770,7 @@ const handleHarmonicSpectrum = async () => {
if (res.code == 'A0000') { if (res.code == 'A0000') {
ElMessage.success('设备应答成功') ElMessage.success('设备应答成功')
// mqttMessage.value = {} // mqttMessage.value = {}
showButton.value = true
realDataTimer.value = window.setInterval(() => { realDataTimer.value = window.setInterval(() => {
if (!dataSet.value.includes('_realtimedata')) return if (!dataSet.value.includes('_realtimedata')) return
@@ -784,6 +799,7 @@ const handleReturn = async () => {
await getBasicRealData(lineId.value).then((res: any) => { await getBasicRealData(lineId.value).then((res: any) => {
if (res.code == 'A0000') { if (res.code == 'A0000') {
ElMessage.success('设备应答成功') ElMessage.success('设备应答成功')
showButton.value = true
// mqttMessage.value = {} // mqttMessage.value = {}
realDataTimer.value = window.setInterval(() => { realDataTimer.value = window.setInterval(() => {
if (!dataSet.value.includes('_realtimedata')) return if (!dataSet.value.includes('_realtimedata')) return
@@ -1000,7 +1016,7 @@ const getRealDataMqttMsg = async () => {
if (res.code == 'A0000') { if (res.code == 'A0000') {
ElMessage.success('设备应答成功') ElMessage.success('设备应答成功')
mqttMessage.value = {} mqttMessage.value = {}
showButton.value = true
realDataTimer.value = window.setInterval(async () => { realDataTimer.value = window.setInterval(async () => {
if (!dataSet.value.includes('_realtimedata')) return if (!dataSet.value.includes('_realtimedata')) return
await getBasicRealData(lineId.value).then((res: any) => { await getBasicRealData(lineId.value).then((res: any) => {
@@ -1129,6 +1145,7 @@ const getRealDataMqttMsg = async () => {
} }
if (obj.hasOwnProperty('pA') && obj.hasOwnProperty('pB')) { if (obj.hasOwnProperty('pA') && obj.hasOwnProperty('pB')) {
mqttMessage.value = obj mqttMessage.value = obj
txtContent.value = JSON.stringify(obj)
//更新实时数据主页面值 //更新实时数据主页面值
realTimeFlag.value && realTimeFlag.value &&
@@ -1178,6 +1195,7 @@ const realDataTimer: any = ref()
const mqttMessage = ref<any>({}) const mqttMessage = ref<any>({})
const handleClick = async (tab?: any) => { const handleClick = async (tab?: any) => {
tableLoading.value = true tableLoading.value = true
showButton.value = false
if (realDataTimer.value) { if (realDataTimer.value) {
window.clearInterval(realDataTimer.value) window.clearInterval(realDataTimer.value)
} }
@@ -1346,11 +1364,8 @@ const handleClick = async (tab?: any) => {
await setTimeout(() => { await setTimeout(() => {
getRawData(obj) getRawData(obj)
.then((res: any) => { .then((res: any) => {
tableLoading.value = false tableLoading.value = false
setTimeout(() => { setTimeout(() => {
operatingTrendRef.value?.setData(res.data) operatingTrendRef.value?.setData(res.data)
}, 500) }, 500)
setTimeout(() => { setTimeout(() => {
@@ -1484,6 +1499,21 @@ const queryList: any = ref([])
const echoName = (value: any, arr: any[]) => { const echoName = (value: any, arr: any[]) => {
return value ? arr.find(item => item.value == value)?.label : '/' return value ? arr.find(item => item.value == value)?.label : '/'
} }
// 下载txt
const downloadTxt = () => {
const content = txtContent.value // 文件内容
const blob = new Blob([content], { type: 'text/plain' }) // 创建 Blob 对象
const url = URL.createObjectURL(blob) // 生成下载链接
// 创建 <a> 标签并触发下载
const link = document.createElement('a')
link.href = url
link.download = '实时数据.txt' // 文件名
link.click()
// 释放 URL 对象
URL.revokeObjectURL(url)
}
onMounted(() => {}) onMounted(() => {})
onBeforeUnmount(() => { onBeforeUnmount(() => {