Files
emsfront/src/views/ems/site/sblb/PointTable.vue

303 lines
8.5 KiB
Vue
Raw Normal View History

2025-09-13 22:41:41 +08:00
<!--电位展示图表-->
<template>
<div>
<el-dialog
2025-12-05 09:46:31 +08:00
v-loading="loading"
:close-on-click-modal="false"
:visible.sync="show"
append-to-body
class="ems-dialog"
destroy-on-close
lock-scroll
show-close
:title="dataType === 'point' ? '点位清单' : '报警点位'"
width="950px"
>
2025-11-05 18:00:05 +08:00
<el-form :inline="true" label-width="100px">
<el-form-item label="点位名称">
<el-input
2025-12-05 09:46:31 +08:00
v-model="form.dataPointName"
clearable
placeholder="请输入点位名称"
style="width: 150px"
></el-input>
</el-form-item>
<el-form-item label="点位">
<el-input
2025-12-05 09:46:31 +08:00
v-model="form.dataPoint"
clearable
placeholder="请输入点位"
style="width: 150px"
></el-input>
</el-form-item>
2025-12-05 09:46:31 +08:00
<!-- <el-form-item label="modbus ip">-->
<!-- <el-input-->
<!-- v-model="form.ipAddress"-->
<!-- clearable-->
<!-- placeholder="请输入ip"-->
<!-- style="width: 150px"-->
<!-- ></el-input>-->
<!-- </el-form-item>-->
2025-11-26 17:50:06 +08:00
<br>
<el-form-item label="最小值">
<el-input
2025-12-05 09:46:31 +08:00
v-model="form.lower"
clearable
placeholder="请输入最小值"
style="width: 150px"
></el-input>
</el-form-item>
<el-form-item label="最大值">
<el-input
2025-12-05 09:46:31 +08:00
v-model="form.upper"
clearable
placeholder="请输入最大值"
style="width: 150px"
></el-input>
</el-form-item>
2025-12-05 09:46:31 +08:00
<!-- <el-form-item label="modbus 端口">-->
<!-- <el-input-->
<!-- v-model="form.ipPort"-->
<!-- clearable-->
<!-- placeholder="请输入端口"-->
<!-- style="width: 150px"-->
<!-- ></el-input>-->
<!-- </el-form-item>-->
<el-form-item style="margin-left: 20px">
<el-button type="primary" @click="search">搜索</el-button>
</el-form-item>
</el-form>
2025-09-25 17:30:16 +08:00
<el-table
2025-12-05 09:46:31 +08:00
:data="tableData"
class="common-table"
max-height="400px"
stripe
style="width: 100%"
:default-sort="defaultSort"
@sort-change="handleSortChange"
>
2025-12-05 09:46:31 +08:00
<el-table-column label="数据点位" prop="dataPoint"></el-table-column>
2025-11-05 18:00:05 +08:00
<el-table-column
2025-12-05 09:46:31 +08:00
label="数据点位名称"
prop="pointName"
2025-11-25 17:56:12 +08:00
></el-table-column>
2025-12-05 09:46:31 +08:00
<!-- <el-table-column label="modbus地址">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{-->
<!-- `${scope.row.ipAddress || ""} ${scope.row.ipPort || ""}`-->
<!-- }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
2025-11-26 17:50:06 +08:00
<el-table-column label="寄存器地址" prop="寄存器地址"></el-table-column>
<el-table-column
2025-12-05 09:46:31 +08:00
label="最新值"
prop="pointValue"
align="right"
sortable="custom"
>
<template slot-scope="scope">
2025-11-25 17:56:12 +08:00
<span class="pointer" @click="showChart(scope.row)">{{
2025-12-05 09:46:31 +08:00
scope.row.pointValue
}}</span>
</template>
</el-table-column>
<el-table-column label="单位" prop="dataUnit"></el-table-column>
2025-11-25 17:56:12 +08:00
<el-table-column
2025-12-05 09:46:31 +08:00
label="更新时间"
min-width="160px"
prop="updateTime"
sortable="custom"
2025-11-25 17:56:12 +08:00
>
</el-table-column>
</el-table>
<el-pagination
2025-12-05 09:46:31 +08:00
v-show="tableData.length > 0"
:current-page="pageNum"
:page-size="pageSize"
:page-sizes="[10, 20, 30, 40]"
:pager-count="5"
:total="totalSize"
background
layout="total, sizes, prev, pager, next, jumper"
small
style="margin-top: 15px; text-align: center"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
</el-dialog>
2025-12-05 09:46:31 +08:00
<point-chart ref="pointChart" :site-id="siteId"/>
</div>
2025-09-13 22:41:41 +08:00
</template>
<script>
2025-12-05 09:46:31 +08:00
import {getDevicePointList} from "@/api/ems/site";
import pointChart from "@/views/ems/dzjk/sbjk/PointChart.vue";
2025-09-13 22:41:41 +08:00
export default {
2025-12-05 09:46:31 +08:00
components: {pointChart},
2025-09-25 17:30:16 +08:00
watch: {
2025-09-13 22:41:41 +08:00
show(val) {
2025-09-25 17:30:16 +08:00
if (!val) {
this.tableData = [];
this.deviceId = "";
2025-11-25 17:56:12 +08:00
this.parentId = "";
this.siteId = "";
this.pageSize = 10;
this.pageNum = 1;
this.totalSize = 0;
2025-11-26 17:50:06 +08:00
this.dataType = '';
2025-09-25 17:30:16 +08:00
this.form = {
sortMethod: "desc", //升序不传或者asc、降序desc
2025-11-25 17:56:12 +08:00
sortData: this.defaultSort.prop,
dataPointName: "", //点位名称
dataPoint: "", //点位名称
lower: "", //
upper: "", //
2025-11-26 17:50:06 +08:00
// ipAddress: "",
// ipPort: "",
};
this.loading = false;
2025-09-13 22:41:41 +08:00
}
},
},
2025-11-25 17:56:12 +08:00
computed: {
isDtdc() {
return this.deviceCategory === "BATTERY";
},
},
2025-09-25 17:30:16 +08:00
data() {
return {
// 默认排序
2025-12-05 09:46:31 +08:00
defaultSort: {prop: "updateTime", order: "descending"},
2025-09-25 17:30:16 +08:00
show: false,
loading: false,
2025-12-05 09:46:31 +08:00
dataType: '',//展示的数据类型 point点位/alarmPoint报警点位
2025-09-25 17:30:16 +08:00
form: {
sortData: "updateTime", //最新值升序不传或者asc、降序desc
sortMethod: "desc", //升序不传或者asc、降序desc
dataPointName: "", //点位名称
dataPoint: "", //点位名称
lower: "", //
upper: "", //
2025-11-26 17:50:06 +08:00
// ipAddress: "",
// ipPort: "",
2025-09-25 17:30:16 +08:00
},
deviceCategory: "",
deviceId: "",
2025-11-25 17:56:12 +08:00
parentId: "",
siteId: "",
2025-09-25 17:30:16 +08:00
tableData: [],
pageSize: 10, //分页栏当前每个数据总数
pageNum: 1, //分页栏当前页数
totalSize: 0, //table表格数据总数
};
2025-09-13 22:41:41 +08:00
},
2025-09-25 17:30:16 +08:00
methods: {
2025-12-05 09:46:31 +08:00
showChart({pointName}) {
2025-11-25 17:56:12 +08:00
if (pointName) {
2025-12-05 09:46:31 +08:00
const {deviceCategory, deviceId} = this;
2025-11-25 17:56:12 +08:00
if (this.isDtdc)
this.$refs.pointChart.showChart({
pointName,
deviceCategory,
deviceId: this.parentId,
child: [deviceId],
});
else
this.$refs.pointChart.showChart({
pointName,
deviceCategory,
deviceId,
});
}
},
handleSortChange(column) {
2025-11-25 17:56:12 +08:00
this.form.sortData = column.prop;
this.form.sortMethod = column.order === "descending" ? "desc" : "asc";
console.log("切换排序方式", column, this.form);
2025-11-26 17:50:06 +08:00
this.getData()
2025-09-25 17:30:16 +08:00
},
search() {
this.pageNum = 1;
2025-11-26 17:50:06 +08:00
this.getData()
},
// 分页
handleSizeChange(val) {
this.pageSize = val;
this.$nextTick(() => {
this.getData()
});
},
handleCurrentChange(val) {
this.pageNum = val;
this.$nextTick(() => {
this.getData()
});
2025-09-22 10:16:21 +08:00
},
2025-12-05 09:46:31 +08:00
showTable({deviceCategory, siteId, deviceId, parentId = ""}, dataType) {
2025-11-26 17:50:06 +08:00
this.dataType = dataType;
this.deviceCategory = deviceCategory;
this.siteId = siteId;
this.deviceId = deviceId;
2025-11-25 17:56:12 +08:00
this.parentId = deviceCategory === "BATTERY" ? parentId : ""; //只有单体电池需要这个值
this.show = true;
2025-11-26 17:50:06 +08:00
this.getData()
2025-09-13 22:41:41 +08:00
},
2025-11-26 17:50:06 +08:00
getData() {
2025-09-25 17:30:16 +08:00
const {
siteId,
deviceId,
deviceCategory,
parentId,
2025-09-25 17:30:16 +08:00
pageNum,
pageSize,
form: {
sortData,
sortMethod,
dataPointName,
dataPoint,
lower,
upper,
2025-11-26 17:50:06 +08:00
// ipAddress,
// ipPort,
},
} = this;
2025-11-26 17:50:06 +08:00
const params = {
2025-09-25 17:30:16 +08:00
siteId,
deviceId,
deviceCategory,
2025-10-16 16:34:32 +08:00
parentId,
2025-09-25 17:30:16 +08:00
pageNum,
pageSize,
sortData,
sortMethod,
dataPointName,
dataPoint,
lower,
upper,
2025-12-05 09:46:31 +08:00
// ipAddress: '',
// ipPort: '',
2025-11-26 17:50:06 +08:00
}
2025-12-05 09:46:31 +08:00
params.isAlarm = this.dataType === 'point' ? 0 : 1
this.loading = true;
getDevicePointList(params)
.then((response) => {
this.tableData = response?.rows || [];
this.totalSize = response?.total || 0;
})
.finally(() => {
this.loading = false;
});
2025-09-13 22:41:41 +08:00
},
},
};
2025-09-13 22:41:41 +08:00
</script>
2025-09-18 10:07:41 +08:00
<style lang="scss" scoped>
2025-09-13 22:41:41 +08:00
::v-deep {
2025-09-25 17:30:16 +08:00
.card-title .el-radio {
2025-09-13 22:41:41 +08:00
line-height: 40px;
}
}
</style>