瓶中沙 2024-08-14 11:55:38 +08:00
parent 78bb06db81
commit 9cf1ca4878
2 changed files with 134 additions and 83 deletions

View File

@ -165,17 +165,17 @@ const infoApi = {
return postPBRequest("/info", null, 51001, params.name); return postPBRequest("/info", null, 51001, params.name);
}, },
// //
// //
getDriverData(params) { getDriverData(params) {
return postPBRequest("/data", null, 55000); return postPBRequest("/data", null, 56200);
}, },
// //
getDeviceData(params) { getDeviceData(params) {
return postPBRequest("/data", params, 55001); return postPBRequest("/data", params, 56100);
}, },
// //
getPointData(params) { getPointData(params) {
return postPBRequest("/data", params, 55002); return postPBRequest("/data", params, 56000);
} }
}; };
export default infoApi; export default infoApi;

View File

@ -2,47 +2,73 @@
<el-card class="content-div"> <el-card class="content-div">
<div class="all-content"> <div class="all-content">
<fieldset class="left box2"> <fieldset class="left box2">
<legend class="box-ht">驱动列表</legend> <legend class="box-ht">通讯列表</legend>
<div v-for="(item, i) in qdDatas" :class="i === indexi ? 'active' : ''" :key="i" @click="changeQd(i, item)"> <div v-for="(item, i) in driverData" :class="i === indexi ? 'active' : ''" class="qd-one" :key="i" @click="changeQd(i, item)">
<img src="../assets/qd.png" alt=""> <img src="../assets/qd.png" alt="">
{{ item.driver_name }} {{ item.driver_name }}
</div> </div>
</fieldset> </fieldset>
<div class="right"> <div class="right">
<div class="right-set"> <div class="des">
<el-tree <span class="box-title">通讯信息</span>
:data="data" <span class="box-info">
:props="defaultProps" <el-tag>通讯名称:{{ curDriver.driver_name }}</el-tag>
:highlight-current="true" <el-tag>通讯总计数:{{ curDriver.driver_name }}</el-tag>
accordion <el-tag>通讯描述:{{ curDriver.driver_description }}</el-tag>
node-key="id" <el-tag>通讯状态:{{ curDriver.driver_status }}</el-tag>
:current-node-key="currentNodekey" <el-tag>通讯成功计数:{{ curDriver.driver_name }}</el-tag>
@node-click="handleNodeClick"> <el-tag>通讯失败计数:{{ curDriver.driver_name }}</el-tag>
</el-tree> <el-tag>通讯最后一次成功时间:{{ curDriver.driver_name }}</el-tag>
<el-tag>通讯最后一次失败时间:{{ curDriver.driver_name }}</el-tag>
<el-tag>通讯最后一次失败原因:{{ curDriver.driver_name }}</el-tag>
</span>
</div> </div>
<div class="right-table"> <div class="right-con">
<el-table :data="tableData" border :row-class-name="tableRowClassName" <div class="right-set">
:header-cell-style="{ background: '#F6F7FC' }" size="large"> <div>设备列表</div>
<el-table-column type="index" label="序号" width="80" align="center" /> <el-tree
<el-table-column prop="point_name" label="名称" width="150" align="center" show-overflow-tooltip /> :data="driceData"
<el-table-column prop="point_description" label="描述" align="center" show-overflow-tooltip /> :props="defaultProps"
<el-table-column prop="point_quality" label="质量" width="100" align="center" show-overflow-tooltip /> :highlight-current="true"
<el-table-column prop="point_value" label="值" width="100" align="center" show-overflow-tooltip /> accordion
<el-table-column prop="point_Unit" label="单位" width="100" align="center" show-overflow-tooltip /> node-key="device_name"
<el-table-column prop="point_type" label="类型" width="100" align="center" show-overflow-tooltip /> ref="taskTree"
<el-table-column prop="point_timestamp" label="时间戳" width="200" align="center" show-overflow-tooltip /> :current-node-key="device_name"
<el-table-column label="操作" align="center" show-overflow-tooltip> @node-click="handleNodeClick">
<template #default="scope"> </el-tree>
<el-button type="success" size="large"> </div>
历史 <div class="right-table">
</el-button> <div class="des">
<el-button type="warning" size="large" v-if="scope.row.point_permissions ==2"> <span class="box-title">设备信息</span>
写值 <div class="box-info">
</el-button> <el-tag>设备名称: </el-tag>
<el-tag>设备描述: </el-tag>
<el-button type="danger">禁用</el-button>
</div>
</div>
<el-table :data="tableData" height="400" border :row-class-name="tableRowClassName"
:header-cell-style="{ background: '#F6F7FC' }" size="large">
<el-table-column type="index" label="序号" width="80" align="center" />
<el-table-column prop="point_name" label="名称" width="150" align="center" show-overflow-tooltip />
<el-table-column prop="point_description" label="描述" align="center" show-overflow-tooltip />
<el-table-column prop="point_quality" label="质量" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="point_value" label="值" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="point_unit" label="单位" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="point_type" label="类型" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="point_timestamp" label="时间戳" width="200" align="center" show-overflow-tooltip />
<el-table-column label="操作" align="center" width="200" show-overflow-tooltip>
<template #default="scope">
<el-button type="success" size="large">
历史
</el-button>
<el-button type="warning" size="large" v-if="scope.row.point_permissions ==2">
详情
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -60,36 +86,15 @@ export default {
const state = reactive({ const state = reactive({
indexi: 0, indexi: 0,
qdDatas: [{ driverData: [],
id: 1, driceData: [ ],
name: '驱动一',
},{
id: 2,
name: '驱动二',
},{
id: 3,
name: '驱动三',
},{
id: 4,
name: '驱动四',
},{
id: 5,
name: '驱动五',
}],
data: [{
id: 11,
label: '设备一',
}, {
id: 12,
label: '设备二',
}, {
id: 13,
label: '设备三',
}],
currentNodekey: 11, currentNodekey: 11,
tableData: [], tableData: [],
defaultProps: {
children: "children",
label: "device_name"
},
curDriver: {}
}); });
onMounted(() => { onMounted(() => {
@ -99,9 +104,10 @@ export default {
const getDriverData = async () => { const getDriverData = async () => {
const res = await infoApi.getDriverData(); const res = await infoApi.getDriverData();
if (res.code == 0) { if (res.code == 0) {
state.qdDatas = res.data || []; state.driverData = res.data || [];
if (state.qdDatas.length > 0) { if (state.driverData.length > 0) {
changeQd(0, state.qdDatas[0]); changeQd(0, state.driverData[0]);
state.curDriver = state.driverData[0];
} }
} }
@ -109,6 +115,7 @@ export default {
} }
const changeQd = (i, item) => { const changeQd = (i, item) => {
state.indexi = i; state.indexi = i;
state.curDriver = item;
getDeviceData(item.driver_name); getDeviceData(item.driver_name);
} }
@ -118,11 +125,13 @@ export default {
} }
const res = await infoApi.getDeviceData(param); const res = await infoApi.getDeviceData(param);
if (res.code == 0) { if (res.code == 0) {
state.data = res.data || []; state.driceData = res.data || [];
if (state.data.length > 0) { console.log(123, state.driceData)
handleNodeClick(state.data[0]); if (state.driceData.length > 0) {
handleNodeClick(state.driceData[0]);
nextTick(() => { nextTick(() => {
taskTree.value.setCurrentKey(state.data[0].device_name); console.log(123 , state.driceData[0].device_name)
taskTree.value.setCurrentKey(state.driceData[0].device_name);
}) })
} }
} }
@ -142,6 +151,7 @@ export default {
const res = await infoApi.getPointData(param); const res = await infoApi.getPointData(param);
if(res.code == 0) { if(res.code == 0) {
state.tableData = res.data; state.tableData = res.data;
} }
} }
@ -149,9 +159,9 @@ export default {
return { return {
...toRefs(state), ...toRefs(state),
taskTree,
changeQd, changeQd,
handleNodeClick, handleNodeClick
taskTree
}; };
}, },
}; };
@ -166,17 +176,39 @@ export default {
width: 15%; width: 15%;
border: 1px solid #006b3b; border: 1px solid #006b3b;
font-size: 16px; font-size: 16px;
width: 24px; .qd-one {
display: flex;
justify-content: space-around;
align-items: center;
width: 100%;
height: 45px;
img {
width: 24px;
}
}
} }
.right { .right {
width: 84%; width: 84%;
border: 1px solid #006b3b; border: 1px solid #006b3b;
justify-content: space-around; justify-content: space-around;
.box-title {
height:100% !important;
width: 30px;
background: #00AAA3;
color:#fff;
// border-right: 1px solid #006b3b;
display: flex;
justify-content: center;
align-items: center;
}
.right-con {
display: flex;
justify-content: space-between;
}
.right-set { .right-set {
width: 10%; width: 12%;
padding: 20px; padding: 5px;
} }
.right-table { .right-table {
@ -192,11 +224,12 @@ export default {
color: #fff; color: #fff;
} }
} }
.right { .right {
width: 84%; width: 84%;
border: 1px solid #006b3b; border: 1px solid #006b3b;
display: flex;
justify-content: space-around;
.right-set { .right-set {
width: 10%; width: 10%;
padding: 20px; padding: 20px;
@ -210,4 +243,22 @@ export default {
// } // }
} }
} }
.box-info {
width:100%;
// border: 1px solid red;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
::v-deep .el-tag {
margin: 10px;
}
}
.des {
border-bottom: 1px solid #006b3b;
display: flex;
align-items: center;
width:100%;
}
</style> </style>