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

192 lines
5.0 KiB
Vue
Raw Normal View History

2025-09-13 22:41:41 +08:00
<!--电位展示图表-->
<template>
<el-dialog
v-loading="loading"
:close-on-click-modal="false"
2025-09-18 10:07:41 +08:00
:visible.sync="show"
append-to-body
class="ems-dialog"
2025-09-13 22:41:41 +08:00
destroy-on-close
lock-scroll
2025-09-18 10:07:41 +08:00
show-close
2025-09-25 17:30:16 +08:00
title="点位清单"
2025-09-17 17:53:21 +08:00
width="800px"
2025-09-13 22:41:41 +08:00
>
2025-09-22 10:16:21 +08:00
2025-09-26 14:47:45 +08:00
<el-form :inline="true" label-width="85px">
2025-09-25 17:30:16 +08:00
<el-form-item label="点位名称">
<el-input v-model="form.dataPointName" clearable placeholder="请输入点位名称" style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="点位">
<el-input v-model="form.dataPoint" clearable placeholder="请输入点位" style="width: 150px"></el-input>
</el-form-item>
<br>
<el-form-item label="最小值">
<el-input v-model="form.lower" clearable placeholder="请输入最小值" style="width: 150px"></el-input>
</el-form-item>
<el-form-item label="最大值">
<el-input v-model="form.upper" 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-13 22:41:41 +08:00
<el-table
:data="tableData"
2025-09-18 10:07:41 +08:00
class="common-table"
2025-09-17 17:53:21 +08:00
max-height="400px"
2025-09-18 10:07:41 +08:00
stripe
2025-09-25 17:30:16 +08:00
style="width: 100%;"
:default-sort = "{prop: 'updateTime', order: 'descending'}"
@sort-change="changeSort">
2025-09-13 22:41:41 +08:00
<el-table-column
2025-09-18 10:07:41 +08:00
label="数据点位"
prop="dataPoint">
2025-09-13 22:41:41 +08:00
</el-table-column>
<el-table-column
2025-09-18 10:07:41 +08:00
label="数据点位名称"
2025-09-28 14:59:02 +08:00
prop="pointName">
2025-09-13 22:41:41 +08:00
</el-table-column>
2025-09-17 17:53:21 +08:00
<el-table-column
2025-09-18 10:07:41 +08:00
label="最新值"
prop="pointValue">
2025-09-17 17:53:21 +08:00
</el-table-column>
<el-table-column
2025-09-18 10:07:41 +08:00
label="更新时间"
2025-09-25 17:30:16 +08:00
prop="updateTime"
sortable="custom"
>
2025-09-17 17:53:21 +08:00
</el-table-column>
2025-09-13 22:41:41 +08:00
</el-table>
<el-pagination
v-show="tableData.length>0"
:current-page="pageNum"
:page-size="pageSize"
:page-sizes="[10, 20, 30, 40]"
2025-09-18 10:07:41 +08:00
:pager-count="5"
2025-09-13 22:41:41 +08:00
:total="totalSize"
2025-09-18 10:07:41 +08:00
background
layout="total, sizes, prev, pager, next, jumper"
small
2025-09-13 22:41:41 +08:00
style="margin-top:15px;text-align: center"
2025-09-18 10:07:41 +08:00
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
2025-09-13 22:41:41 +08:00
>
</el-pagination>
</el-dialog>
</template>
<script>
import {getDevicePointList} from "@/api/ems/site";
export default {
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 = ''
this.deviceName = ''
this.siteId = ''
this.pageSize = 10
this.pageNum = 1
this.totalSize = 0
this.form = {
sortMethod: 'desc',//升序不传或者asc、降序desc
dataPointName: '',//点位名称
dataPoint: '',//点位名称
lower: '',//
upper: '',//
}
this.loading = false
2025-09-13 22:41:41 +08:00
}
},
},
2025-09-25 17:30:16 +08:00
data() {
return {
show: false,
loading: false,
form: {
sortMethod: 'desc',//升序不传或者asc、降序desc
dataPointName: '',//点位名称
dataPoint: '',//点位名称
lower: '',//
upper: '',//
},
deviceCategory: '',
deviceName: '',
deviceId: '',
siteId: '',
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: {
changeSort(c) {
console.log('切换排序方式', c)
if(c.prop === "updateTime" && c.order){
this.form.sortMethod = c.order === 'descending' ? 'desc' : 'asc'
this.getData()
}
},
search() {
this.pageNum = 1
2025-09-22 10:16:21 +08:00
this.getData()
},
2025-09-25 17:30:16 +08:00
showTable({deviceCategory, siteId, deviceId, deviceName}) {
this.deviceCategory = deviceCategory
this.siteId = siteId
this.deviceId = deviceId
this.deviceName = deviceName
this.show = true
2025-09-13 22:41:41 +08:00
this.getData()
},
2025-09-25 17:30:16 +08:00
getData() {
this.loading = true
const {
siteId,
deviceId,
deviceCategory,
pageNum,
pageSize,
form: {sortMethod, dataPointName, dataPoint, lower, upper}
} = this
getDevicePointList({
siteId,
deviceId,
deviceCategory,
pageNum,
pageSize,
sortMethod, dataPointName, dataPoint, lower, upper
}).then(response => {
this.tableData = response?.rows || [];
2025-09-13 22:41:41 +08:00
this.totalSize = response?.total || 0
2025-09-25 17:30:16 +08:00
}).finally(() => {
this.loading = false
})
2025-09-13 22:41:41 +08:00
},
// 分页
handleSizeChange(val) {
this.pageSize = val;
2025-09-25 17:30:16 +08:00
this.$nextTick(() => {
2025-09-13 22:41:41 +08:00
this.getData()
})
},
handleCurrentChange(val) {
this.pageNum = val
2025-09-25 17:30:16 +08:00
this.$nextTick(() => {
2025-09-13 22:41:41 +08:00
this.getData()
})
},
}
}
</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>