<template>
|
<a-spin :spinning='load'>
|
<a-card :bordered='false'>
|
<div>
|
<a-table
|
ref='table'
|
:columns='columns'
|
:customRow='clickThenSelect'
|
:dataSource='dataSource'
|
:loading='loading'
|
:pagination='ipagination'
|
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
|
bordered
|
class='j-table-force-nowrap'
|
rowKey='id'
|
size='middle'
|
@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: 'SolidParameter',
|
mixins: [JeecgListMixin],
|
components: {
|
JDictSelectTag,
|
JInput,
|
JEllipsis
|
},
|
data() {
|
return {
|
columns: [
|
{
|
title: '参数编号',
|
align: 'center',
|
dataIndex: 'parameterCode'
|
},
|
{
|
title: '参数名称',
|
align: 'center',
|
dataIndex: 'parameterName'
|
},
|
{
|
title: '描述',
|
align: 'center',
|
dataIndex: 'parameterDescribe'
|
},
|
{
|
title: '参数类型',
|
align: 'center',
|
dataIndex: 'parameterType'
|
},
|
{
|
title: '地址',
|
align: 'center',
|
dataIndex: 'address'
|
},
|
{
|
title: '读写类型',
|
align: 'center',
|
dataIndex: 'readWriteType'
|
}
|
],
|
load: false,
|
url: {
|
list: '/real/parameter/list',
|
delete: '/real/parameter/delete'
|
}
|
}
|
},
|
props: ['parameterGroupId', 'tree', 'parameters'],
|
watch: {
|
parameterGroupId: {
|
handler() {
|
this.loadData()
|
}
|
}
|
},
|
methods: {
|
// 查询终端列表
|
loadData(arg) {
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1
|
}
|
this.onClearSelected()
|
var params = this.getQueryParams()//查询条件
|
params.parameterGroupId = 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 (this.dataSource.length > 0 && this.parameters.length > 0) {
|
for (let i = 0; i < this.parameters.length; i++) {
|
if (this.parameters[i].id === this.parameterGroupId) {
|
for (let j = 0; j < this.parameters[i].parametersList.length; j++) {
|
this.selectedRowKeys[j] = this.parameters[i].parametersList[j].id
|
this.selectedRowKeys[j] = this.parameters[i].parametersList[j].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, selectionRows) {
|
this.selectedRowKeys = selectedRowKeys
|
// 调用父组件方法存储参数
|
this.$emit('ok', 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) {
|
this.$refs.modalForm.edit(record)
|
this.$refs.modalForm.title = '编辑'
|
this.$refs.modalForm.disableSubmit = false
|
}
|
}
|
}
|
</script>
|
<style>
|
</style>
|