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
156
157
158
159
160
161
162
<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>