<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.eqptCode' placeholder='请输入终端编号'></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :md='6' :sm='8'>
|
<a-form-item label='设备名称'>
|
<a-input v-model='queryParam.eqptName' placeholder='请输入终端名称'></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :span='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'
|
:dataSource='dataSource'
|
:loading='loading'
|
:pagination='ipagination'
|
bordered
|
class='j-table-force-nowrap'
|
rowKey='id'
|
size='middle'
|
>
|
</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: 'Equipment',
|
mixins: [JeecgListMixin],
|
components: {
|
JDictSelectTag,
|
JInput,
|
JEllipsis
|
},
|
data() {
|
return {
|
columns: [
|
{
|
title: '',
|
dataIndex: '',
|
key: 'rowIndex',
|
align: 'center',
|
customRender: function(t, r, index) {
|
return parseInt(index) + 1
|
}
|
},
|
{
|
title: '设备编号',
|
align: 'center',
|
dataIndex: 'eqptCode'
|
},
|
{
|
title: '设备名称',
|
align: 'center',
|
dataIndex: 'eqptName'
|
},
|
{
|
title: '设备型号',
|
align: 'center',
|
dataIndex: 'eqptModel',
|
customRender: function(t) {
|
if (t == undefined) {
|
return '/'
|
} else {
|
return t
|
}
|
}
|
},
|
{
|
title: '设备类型',
|
align: 'center',
|
dataIndex: 'eqptType',
|
customRender: function(t) {
|
if (t == undefined) {
|
return '/'
|
} else {
|
return t
|
}
|
}
|
},
|
{
|
title: '设备分类',
|
align: 'center',
|
dataIndex: 'equipmentType',
|
customRender: function(t) {
|
if (t == 0) {
|
return '虚设备'
|
} else if (t == 1) {
|
return '实设备'
|
}
|
return ''
|
}
|
},
|
{
|
title: '备注',
|
align: 'center',
|
dataIndex: 'remark',
|
customRender: function(text) {
|
return !text ? '' : (text.length > 10 ? text.substr(0, 10) : text)
|
}
|
}
|
],
|
load: false,
|
url: {
|
list: '/equipment/list',
|
put: '/serve/deploy/collect/put',
|
deploy: '/serve/deploy/deploy/document',
|
delete: '/equipment/delete'
|
}
|
}
|
},
|
props: ['parameterGroupId', 'tree'],
|
watch: {
|
parameterGroupId: {
|
handler(newVal, oldVal) {
|
this.loadData()
|
// this.projectClassify = newVal
|
}
|
}
|
},
|
methods: {
|
// 查询终端列表
|
loadData(arg) {
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1
|
}
|
this.onClearSelected()
|
var params = this.getQueryParams()//查询条件
|
params.serverId = 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
|
this.dataSource.forEach(item => {
|
let collectVersion = ''
|
if (item.latestCollectVersion == null || item.latestCollectVersion == '') {
|
collectVersion = '空'
|
} else {
|
collectVersion = item.latestCollectVersion
|
}
|
collectVersion += '/'
|
if (item.newCollectVersion == null || item.guardState == 0) {
|
collectVersion += '空'
|
} else {
|
collectVersion += item.newCollectVersion
|
}
|
// 采集软件
|
item.collectVersion = collectVersion
|
// 配置文件
|
let deployVersion = ''
|
if (item.latestDeployVersion == null || item.latestDeployVersion == '') {
|
deployVersion = '空'
|
} else {
|
deployVersion = item.latestDeployVersion
|
}
|
deployVersion += '/'
|
if (item.newDeployVersion == null || item.guardState == 0) {
|
deployVersion += '空'
|
} else {
|
deployVersion += item.newDeployVersion
|
}
|
item.deployVersion = deployVersion
|
})
|
}
|
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, selectionRows) {
|
// this.selectedMainId=selectedRowKeys[0]
|
this.selectedRowKeys = selectedRowKeys
|
// this.selectionRows = selectionRows;
|
},
|
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) {
|
if (record.equipmentType == 0) {
|
this.$refs.emptyModalForm.edit(record)
|
this.$refs.emptyModalForm.title = '编辑'
|
this.$refs.emptyModalForm.disableSubmit = false
|
} else {
|
this.$refs.modalForm.edit(record)
|
this.$refs.modalForm.title = '编辑'
|
this.$refs.modalForm.disableSubmit = false
|
}
|
},
|
handleDetail(record) {
|
if (record.equipmentType == 0) {
|
this.$refs.emptyModalForm.edit(record)
|
this.$refs.emptyModalForm.title = '详情'
|
this.$refs.emptyModalForm.disableSubmit = true
|
} else {
|
this.$refs.modalForm.edit(record)
|
this.$refs.modalForm.title = '详情'
|
this.$refs.modalForm.disableSubmit = true
|
}
|
},
|
emptyHandleAdd() {
|
this.$refs.emptyModalForm.add()
|
this.$refs.emptyModalForm.title = '新增'
|
}
|
}
|
}
|
</script>
|
<style>
|
</style>
|