<template>
|
<a-spin :spinning='load'>
|
<a-card :bordered='false'>
|
<!-- 查询区域 -->
|
<div class='table-page-search-wrapper'>
|
<a-form layout='inline' @keyup.enter.native='searchQuery'>
|
<a-row :gutter='24'>
|
<a-col :md='6' :sm='8'>
|
<a-form-item label='参数编号'>
|
<a-input v-model='queryParam.parameterCode' placeholder='请输入参数编号'></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :md='6' :sm='8'>
|
<a-form-item label='参数名称'>
|
<a-input v-model='queryParam.parameterName' placeholder='请输入参数名称'></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :md='6' :sm='8'>
|
<span class='table-page-search-submitButtons' style='float: left;overflow: hidden;'>
|
<a-button icon='search' type='primary' @click='searchQuery'>查询</a-button>
|
<a-button icon='reload' style='margin-left: 8px' type='primary' @click='searchReset'>重置</a-button>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
<div>
|
<a-table
|
ref='table'
|
:columns='columns'
|
:customRow='clickThenSelect'
|
:dataSource='dataSource'
|
:loading='loading'
|
:scroll='{y:450}'
|
:pagination='ipagination'
|
bordered
|
class='j-table-force-nowrap'
|
rowKey='id'
|
@change='handleTableChange'
|
>
|
</a-table>
|
</div>
|
</a-card>
|
</a-spin>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
import JInput from '@/components/jeecg/JInput'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
import { getAction } from '@/api/manage'
|
|
export default {
|
name: 'EmptyParameter',
|
mixins: [JeecgListMixin],
|
components: {
|
JDictSelectTag,
|
JInput,
|
JEllipsis
|
},
|
data() {
|
return {
|
columns: [
|
{
|
title: '参数编号',
|
align: 'center',
|
dataIndex: 'parameterCode',
|
width: 100
|
},
|
{
|
title: '参数名称',
|
align: 'center',
|
dataIndex: 'parameterName',
|
width: 200
|
},
|
{
|
title: '描述',
|
align: 'center',
|
dataIndex: 'parameterDescribe',
|
width: 300
|
},
|
{
|
title: '值',
|
align: 'center',
|
dataIndex: 'value',
|
width: 300
|
},
|
{
|
title: '质量',
|
align: 'center',
|
dataIndex: 'quality',
|
width: 80
|
},
|
{
|
title: '时间戳',
|
align: 'center',
|
dataIndex: 'timeStamp',
|
width: 250
|
}
|
],
|
load: false,
|
url: {
|
list: '/empty/parameter/list',
|
delete: '/empty/parameter/delete',
|
parameterId: '/equipment/queryById'
|
}
|
}
|
},
|
props: ['parameterGroupId', 'tree', 'parameters'],
|
created() {
|
this.$bus.$on('empty-iot-topic', value => {
|
const that = this
|
let receivedMessage = JSON.parse(value.toString())
|
// 根据设备id查询设备编号
|
if (this.dataSource != null) {
|
if (receivedMessage.ID === this.dataSource[0].eqptCode) {
|
this.dataSource.forEach(d => {
|
receivedMessage.TagInfo.forEach(r => {
|
if (r.ID == d.parameterCode) {
|
that.$set(d, 'value', r.Value + "")
|
that.$set(d, 'quality', r.Quality)
|
that.$set(d, 'timeStamp', r.TimeStamp)
|
}
|
})
|
})
|
}
|
}
|
|
})
|
},
|
watch: {
|
parameterGroupId: {
|
handler() {
|
this.loadData()
|
}
|
}
|
},
|
methods: {
|
// 查询终端列表
|
loadData(arg) {
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1
|
}
|
this.onClearSelected()
|
var params = this.getQueryParams()//查询条件
|
params.equipmentId = this.parameterGroupId
|
this.loading = true
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
this.dataSource = res.result.records
|
this.ipagination.total = res.result.total
|
if (res.result.records.length > 0) {
|
this.selectedRowKeys[0] = this.dataSource[0].id
|
}
|
}
|
if (res.code === 510) {
|
this.$message.warning(res.message)
|
}
|
this.loading = false
|
})
|
|
},
|
clickThenSelect(record) {
|
return {
|
on: {
|
click: () => {
|
this.onSelectChange(record.id.split(','), [record])
|
}
|
}
|
}
|
},
|
onSelectChange(selectedRowKeys) {
|
this.selectedRowKeys = selectedRowKeys
|
},
|
modalFormOk(val) {
|
// 调用父组件方法
|
this.$emit('tree')
|
// 新增/修改 成功时,重载列表
|
this.loadData()
|
this.selectedRowKeys = [val.id]
|
},
|
searchQuery() {
|
this.loadData()
|
this.onClearSelected()
|
},
|
searchReset() {
|
this.queryParam = {}
|
this.loadData()
|
this.onClearSelected()
|
},
|
handleEdit(record) {
|
this.$refs.modalForm.edit(record)
|
this.$refs.modalForm.title = '编辑'
|
this.$refs.modalForm.disableSubmit = false
|
},
|
emptyHandleEdit(record) {
|
this.$refs.emptyModalForm.edit(record)
|
this.$refs.emptyModalForm.title = '编辑'
|
this.$refs.emptyModalForm.disableSubmit = false
|
},
|
emptyHandleAdd() {
|
this.$refs.modalAddress.add()
|
this.$refs.modalAddress.visible1 = true
|
// this.$refs.modalAddress.loadData()
|
},
|
handleAdd() {
|
this.$refs.modalForm.add()
|
this.$refs.modalForm.title = '新增'
|
}
|
}
|
}
|
</script>
|
<style>
|
</style>
|