main
wangqiujuan0808 2024-06-29 14:34:15 +08:00
parent 2390dd9eb7
commit 0a7d8fffd2
4 changed files with 141 additions and 130 deletions

2
package-lock.json generated
View File

@ -5209,7 +5209,7 @@
}, },
"node_modules/postcss-pxtorem": { "node_modules/postcss-pxtorem": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/postcss-pxtorem/-/postcss-pxtorem-6.1.0.tgz", "resolved": "https://registry.npmmirror.com/postcss-pxtorem/-/postcss-pxtorem-6.1.0.tgz",
"integrity": "sha512-ROODSNci9ADal3zUcPHOF/K83TiCgNSPXQFSbwyPHNV8ioHIE4SaC+FPOufd8jsr5jV2uIz29v1Uqy1c4ov42g==", "integrity": "sha512-ROODSNci9ADal3zUcPHOF/K83TiCgNSPXQFSbwyPHNV8ioHIE4SaC+FPOufd8jsr5jV2uIz29v1Uqy1c4ov42g==",
"dev": true, "dev": true,
"peerDependencies": { "peerDependencies": {

View File

@ -164,37 +164,18 @@ const infoApi = {
getCom(params) { getCom(params) {
return postPBRequest("/info", null, 51001, params.name); return postPBRequest("/info", null, 51001, params.name);
}, },
// // //
// getSc(params) { //
// return getRequest('/sb/list', params) getDriverData(params) {
// }, return postPBRequest("/data", null, 55000);
// // },
// getQuDong(params) { //
// return getRequest('/sb/support', params) getDeviceData(params) {
// }, return postPBRequest("/data", params, 55001);
// // },
// saveTx(params) { //
// return postJsonRequest("/sb", params); getPointData(params) {
// }, return postPBRequest("/data", params, 55002);
// // }
// updateTx(params) {
// return putRequest('/sb', params);
// },
// //
// stopSc(params) {
// return putRequest("/sc", params);
// },
// //
// delSc(params) {
// return deleteRequest("/sb", params);
// },
// //
// getRules(params) {
// return getRequest('/rule', params);
// },
// //
// postRules(params) {
// return postJsonRequest('/rule', params)
// },
}; };
export default infoApi; export default infoApi;

View File

@ -1,43 +1,39 @@
<template> <template>
<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)"> <div v-for="(item, i) in qdDatas" :class="i === indexi ? 'active' : ''" :key="i" @click="changeQd(i, item)">
<img src="../assets/qd.png" alt=""> <img src="../assets/qd.png" alt="">
{{ item.name }} {{ item.driver_name }}
</div> </div>
</fieldset> </fieldset>
<div class="right"> <div class="right">
<div class="right-set"> <div class="right-set">
<el-tree <el-tree ref="taskTree" :data="data" node-key="device_name" :props="defaultProps" :highlight-current="true" accordion
:data="data" @node-click="handleNodeClick">
:props="defaultProps" </el-tree>
:highlight-current="true"
accordion
@node-click="handleNodeClick">
</el-tree>
</div> </div>
<div class="right-table"> <div class="right-table">
<el-table :data="tableData" border :row-class-name="tableRowClassName" <el-table :data="tableData" border :row-class-name="tableRowClassName"
:header-cell-style="{ background: '#F6F7FC' }" size="large"> :header-cell-style="{ background: '#F6F7FC' }" size="large">
<el-table-column type="index" label="序号" width="60" align="center" /> <el-table-column type="index" label="序号" width="80" align="center" />
<el-table-column prop="name" label="名称" width="150" align="center" show-overflow-tooltip /> <el-table-column prop="point_name" label="名称" width="150" align="center" show-overflow-tooltip />
<el-table-column prop="description" label="描述" align="center" show-overflow-tooltip /> <el-table-column prop="point_description" label="描述" align="center" show-overflow-tooltip />
<el-table-column prop="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="description" label="值" align="center" show-overflow-tooltip /> <el-table-column prop="point_value" label="值" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="description" label="单位" align="center" show-overflow-tooltip /> <el-table-column prop="point_Unit" label="单位" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="description" label="类型" align="center" show-overflow-tooltip /> <el-table-column prop="point_type" label="类型" width="100" align="center" show-overflow-tooltip />
<el-table-column prop="description" label="时间戳" 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" show-overflow-tooltip> <el-table-column label="操作" align="center" show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
<el-button type="success" size="large"> <el-button type="success" size="large">
历史 历史
</el-button> </el-button>
<el-button type="warning" size="large"> <el-button type="warning" size="large" v-if="scope.row.point_permissions ==2">
写值 写值
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -48,57 +44,84 @@
</template> </template>
<script> <script>
import { onMounted, reactive, ref, toRefs } from "vue"; import { onMounted, reactive, ref, toRefs, nextTick } from "vue";
import infoApi from "@/api/infoApi.js"; import infoApi from "@/api/infoApi.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
export default { export default {
name: "data", name: "data",
setup() { setup() {
const ruleFormRef = ref(null); const taskTree = ref(null);
const state = reactive({ const state = reactive({
indexi: 0, indexi: 0,
qdDatas: [{ qdDatas: [],
id: 1, data: [],
name: '驱动一', tableData: [],
},{ defaultProps: {
id: 2, label: 'device_name',
name: '驱动二', children: 'children'
},{ }
id: 3,
name: '驱动三',
},{
id: 4,
name: '驱动四',
},{
id: 5,
name: '驱动五',
}],
data: [{
id: 11,
label: '设备一',
}, {
id: 12,
label: '设备二',
}, {
id: 13,
label: '设备三',
}],
tableData: []
}); });
onMounted(() => { onMounted(() => {
getDriverData();
}); });
const changeQd = (i) => {
state.indexi = i; const getDriverData = async () => {
const res = await infoApi.getDriverData();
if (res.code == 0) {
state.qdDatas = res.data || [];
if (state.qdDatas.length > 0) {
changeQd(0, state.qdDatas[0]);
}
}
} }
const changeQd = (i, item) => {
state.indexi = i;
getDeviceData(item.driver_name);
}
const getDeviceData = async (driver_name) => {
const param = {
driver_name: driver_name
}
const res = await infoApi.getDeviceData(param);
if (res.code == 0) {
state.data = res.data || [];
if (state.data.length > 0) {
handleNodeClick(state.data[0]);
nextTick(() => {
taskTree.value.setCurrentKey(state.data[0].device_name);
})
}
}
}
const handleNodeClick = (item) => {
getPointData(item);
}
const getPointData = async (item) => {
const param = {
driver_name: item.driver_name,
device_name: item.device_name
}
const res = await infoApi.getPointData(param);
if(res.code == 0) {
state.tableData = res.data;
}
}
return { return {
...toRefs(state), ...toRefs(state),
changeQd changeQd,
handleNodeClick,
taskTree
}; };
}, },
}; };
@ -108,41 +131,48 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
font-size: 14px; font-size: 14px;
.left {
width: 15%; .left {
border: 1px solid #006b3b; width: 15%;
font-size: 16px; border: 1px solid #006b3b;
img { font-size: 16px;
width: 24px;
img {
width: 24px;
}
>div {
background: #e2f4e5;
margin-top: 10px;
text-align: center;
line-height: 40px;
cursor: pointer;
}
.active {
background: #00AAA3;
color: #fff;
}
} }
>div {
background: #e2f4e5; .right {
margin-top: 10px; width: 84%;
text-align: center; border: 1px solid #006b3b;
line-height: 40px; display: flex;
cursor:pointer; justify-content: space-around;
.right-set {
width: 10%;
padding: 20px;
}
.right-table {
width: 88%;
// .el-tree-node {
// border: 1px solid #ddd !important;
// margin-top: 10px !important;
// }
}
} }
.active {
background: #00AAA3;
color: #fff;
}
}
.right {
width: 84%;
border: 1px solid #006b3b;
display: flex;
justify-content: space-around;
.right-set {
width: 10%;
padding: 20px;
}
.right-table {
width: 88%;
// .el-tree-node {
// border: 1px solid #ddd !important;
// margin-top: 10px !important;
// }
}
}
} }
</style> </style>

View File

@ -37,8 +37,8 @@ export default ({ mode }) => defineConfig({
'/api': { '/api': {
// target: 'http://cdcm_test_api.shikicc.com:58909', // target: 'http://cdcm_test_api.shikicc.com:58909',
// target: 'http://frp.shikicc.com:58951', // target: 'http://frp.shikicc.com:58951',
// target: 'http://10.10.14.123', target: 'https://cdcm_api2.shikicc.com',
target: 'https://cdcm_api.shikicc.com', // target: 'https://cdcm_api.shikicc.com',
changeOrigin: true, changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '/api') rewrite: path => path.replace(/^\/api/, '/api')
} }