cuikaidong
2025-06-12 64931370717723655d4ecec4802dcdc54ec015f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<template>
  <a-modal
    :confirm-loading='confirmLoading1'
    :visible='visible1'
    :width='1000'
    title='选择地址'
    @cancel='handleCancel'
    @ok='handleOk'
  >
    <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, type:'radio'}"
            bordered
            class='j-table-force-nowrap'
            rowKey='id'
            size='small'
            @change='handleTableChange'
          >
          </a-table>
        </div>
      </a-card>
    </a-spin>
 
  </a-modal>
</template>
 
<script>
import ParameterGroupModel from './SolidParameterModel'
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: 'ParameterAddress',
  mixins: [JeecgListMixin],
  components: {
    ParameterGroupModel,
    JDictSelectTag,
    JInput,
    JEllipsis
  },
  data() {
    return {
      visible1: false,
      confirmLoading1: false,
      confirmLoading: false,
      visible: false,
      disableSubmit: true,
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '参数名称',
          align: 'center',
          dataIndex: 'name'
        },
        {
          title: '描述',
          align: 'center',
          dataIndex: 'describe'
        },
        {
          title: '参数类型',
          align: 'center',
          dataIndex: 'dataType'
        }
      ],
      load: false,
      url: {
        list: '/equipment/queryParameter'
      }
    }
  },
  props: ['serverId', 'tree'],
  watch: {
    serverId: {
      handler() {
        this.loadData()
      }
    }
  },
  methods: {
    // 查询终端列表
    loadData() {
      getAction(this.url.list, { id: this.serverId }).then((res) => {
        if (res.success) {
          this.dataSource = res.result
        }
        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()
    },
    handleCancel() {
      this.visible1 = false
    },
    handleOk() {
      const that = this
      // 保存数据
      this.selectionRows = this.dataSource.filter((item) => this.selectedRowKeys[0] == item.id)
      that.$emit('ok', this.selectionRows[0])
      this.visible1 = false
    }
  }
}
</script>
<style>
</style>