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

163 lines
4.1 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
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
<div style="margin-bottom: 20px">
<el-input v-model="pointName" placeholder="请输入点位" clearable style="width: 200px"></el-input>
<!-- <el-autocomplete-->
<!-- v-model="pointName"-->
<!-- placeholder="请输入点位"-->
<!-- clearable-->
<!-- :fetch-suggestions="querySearchAsync"-->
<!-- @select="handleSelect"-->
<!-- ></el-autocomplete>-->
<el-button type="primary" style="margin-left: 20px" @click="pointNameSearch">搜索</el-button>
</div>
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-13 22:41:41 +08:00
style="width: 100%;">
<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="数据点位名称"
prop="dataPointName">
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="更新时间"
prop="updateTime">
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";
2025-09-22 10:16:21 +08:00
import {pointFuzzyQuery} from "@/api/ems/search";
2025-09-13 22:41:41 +08:00
export default {
watch:{
show(val) {
if(!val){
this.tableData=[]
this.deviceId=''
2025-09-22 10:16:21 +08:00
this.deviceName=''
2025-09-13 22:41:41 +08:00
this.siteId=''
this.pageSize=10
this.pageNum=1
this.totalSize=0
2025-09-22 10:16:21 +08:00
this.pointName=''
2025-09-13 22:41:41 +08:00
this.loading =false
}
},
},
data(){
return{
show:false,
loading:false,
2025-09-22 10:16:21 +08:00
pointName:'',//点位名称
2025-09-13 22:41:41 +08:00
deviceCategory:'',
2025-09-22 10:16:21 +08:00
deviceName:'',
deviceId:'',
2025-09-13 22:41:41 +08:00
siteId:'',
tableData:[],
pageSize:10,//分页栏当前每个数据总数
pageNum:1,//分页栏当前页数
totalSize:0,//table表格数据总数
}
},
methods:{
2025-09-22 10:16:21 +08:00
pointNameSearch(){
this.pageNum=1
this.getData()
},
showTable({deviceCategory,siteId,deviceId,deviceName}){
2025-09-13 22:41:41 +08:00
this.deviceCategory =deviceCategory
this.siteId=siteId
2025-09-18 10:07:41 +08:00
this.deviceId=deviceId
2025-09-22 10:16:21 +08:00
this.deviceName=deviceName
2025-09-13 22:41:41 +08:00
this.show=true
this.getData()
},
getData(){
this.loading=true
2025-09-22 10:16:21 +08:00
const {siteId,deviceId,deviceCategory,pageNum,pageSize,pointName} =this
getDevicePointList({siteId,deviceId,deviceCategory,pageNum,pageSize,dataPointName:pointName}).then(response => {
2025-09-13 22:41:41 +08:00
this.tableData=response?.rows || [];
this.totalSize = response?.total || 0
}).finally(() => {this.loading=false})
},
// 分页
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
//点位
handleSelect(data){
this.pointName = data.value
},
querySearchAsync(query,cb){
console.log('查询数据',query)
pointFuzzyQuery({
siteIds:[this.siteId],
categoryName:this.deviceName,
pointName:query,
}).then(response => {
const data = response?.data || []
cb(data.map(item => {
return {name: item, value: item}
}))
})
},
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 {
.card-title .el-radio{
line-height: 40px;
}
}
</style>