houzhongjian
2024-07-23 8501060c4f921d1e744c477e4dc08eb47b52693c
提交 | 用户 | 时间
850106 1 <template>
H 2   <el-card shadow="never" class="aui-card--fill">
3     <div>
4       <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
5         <el-form-item>
6           <el-input v-model="dataForm.cdbm" placeholder="测点编码" clearable></el-input>
7         </el-form-item>
8         <el-form-item>
9           <el-input v-model="dataForm.cdmc" placeholder="测点名称" clearable></el-input>
10         </el-form-item>
11         <el-form-item>
12           <el-input v-model="dataForm.tagNo" placeholder="TAG" clearable></el-input>
13         </el-form-item>
14         <el-form-item>
15           <el-button @click="searchDataList()">查询</el-button>
16           <el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
17           <el-button type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
18         </el-form-item>
19         <el-form-item>
20           <el-upload
21             class="upload-demo"
22             :action="importUrl"
23             :on-success="onSuccess"
24             multiple
25             :limit="20"
26             :show-file-list="false"
27             :file-list="fileList">
28             <el-button type="success">导入</el-button>
29           </el-upload>
30         </el-form-item>
31       </el-form>
32       <el-table
33         :data="dataList"
34         border
35         v-loading="dataListLoading"
36         @selection-change="selectionChangeHandle"
37         style="width: 100%;">
38         <el-table-column
39           type="selection"
40           header-align="center"
41           align="center"
42           width="50">
43         </el-table-column>
44         <el-table-column
45           type="index"
46           align="center"
47           width="50"
48           label="序号">
49         </el-table-column>
50         <!--<el-table-column
51           prop="mkmc"
52           header-align="center"
53           align="center"
54           width="200"
55           label="煤矿">
56         </el-table-column>-->
57         <el-table-column
58           prop="cdbm"
59           header-align="center"
60           align="center"
61           width="150"
62           label="测点编码">
63         </el-table-column>
64         <el-table-column
65           prop="cdmc"
66           header-align="center"
67           align="left"
68           min-width="280"
69           label="测点名称">
70         </el-table-column>
71         <el-table-column
72           prop="cdxxms"
73           header-align="center"
74           align="left"
75           min-width="280"
76           label="测点信息描述">
77         </el-table-column>
78         <el-table-column
79           prop="pointtypedescp"
80           header-align="center"
81           align="center"
82           width="100"
83           label="采集类型">
84         </el-table-column>
85         <el-table-column
86           prop="tagNo"
87           header-align="center"
88           align="left"
89           min-width="240"
90           label="TAG">
91         </el-table-column>
92         <el-table-column
93           prop="cdlxName"
94           header-align="center"
95           align="center"
96           width="100"
97           label="测点类型">
98         </el-table-column>
99         <el-table-column
100           prop="dxbjName"
101           header-align="center"
102           align="center"
103           width="100"
104           label="读写标记">
105         </el-table-column>
106         <el-table-column
107           prop="lcxx"
108           header-align="center"
109           align="center"
110           width="100"
111           label="量程下限">
112         </el-table-column>
113         <el-table-column
114           prop="lcsx"
115           header-align="center"
116           align="center"
117           width="100"
118           label="量程上限">
119         </el-table-column>
120         <el-table-column
121           prop="mrz"
122           header-align="center"
123           align="center"
124           width="100"
125           label="默认值">
126         </el-table-column>
127         <el-table-column
128           prop="sjcd"
129           header-align="center"
130           align="center"
131           width="100"
132           label="数据长度">
133         </el-table-column>
134         <el-table-column
135           prop="jcqcd"
136           header-align="center"
137           align="center"
138           width="100"
139           label="寄存器长度">
140         </el-table-column>
141         <el-table-column
142           prop="dxd"
143           header-align="center"
144           align="center"
145           width="100"
146           label="大小端">
147         </el-table-column>
148         <el-table-column
149           prop="ym"
150           header-align="center"
151           align="center"
152           width="100"
153           label="掩码">
154         </el-table-column>
155         <el-table-column
156           prop="ydName"
157           header-align="center"
158           align="center"
159           width="100"
160           label="移动">
161         </el-table-column>
162         <el-table-column
163           prop="xs"
164           header-align="center"
165           align="center"
166           width="100"
167           label="系数">
168         </el-table-column>
169         <el-table-column
170           prop="py"
171           header-align="center"
172           align="center"
173           width="50"
174           label="偏移">
175         </el-table-column>
176         <el-table-column
177           prop="jz"
178           header-align="center"
179           align="center"
180           width="100"
181           label="基准">
182         </el-table-column>
183         <el-table-column
184           prop="dy"
185           header-align="center"
186           align="center"
187           width="100"
188           label="断言">
189         </el-table-column>
190         <el-table-column
191           prop="ywfhName"
192           header-align="center"
193           align="center"
194           width="100"
195           label="有无符号">
196         </el-table-column>
197         <el-table-column
198           prop="xsws"
199           header-align="center"
200           align="center"
201           width="100"
202           label="小数位数">
203         </el-table-column>
204         <el-table-column
205           prop="cljglx"
206           header-align="center"
207           align="center"
208           width="120"
209           label="测量结果类型">
210         </el-table-column>
211         <el-table-column
212           prop="ljlName"
213           header-align="center"
214           align="center"
215           width="100"
216           label="累积量">
217         </el-table-column>
218         <el-table-column
219           prop="jldw"
220           header-align="center"
221           align="center"
222           width="100"
223           label="计量单位">
224         </el-table-column>
225         <el-table-column
226           prop="ybl"
227           header-align="center"
228           align="center"
229           width="100"
230           label="源变量">
231         </el-table-column>
232         <el-table-column
233           prop="kzqId"
234           header-align="center"
235           align="center"
236           width="100"
237           label="控制器ID">
238         </el-table-column>
239         <el-table-column
240           prop="bjxx"
241           header-align="center"
242           align="center"
243           width="100"
244           label="报警下限">
245         </el-table-column>
246         <el-table-column
247           prop="bjsx"
248           header-align="center"
249           align="center"
250           width="100"
251           label="报警上限">
252         </el-table-column>
253         <el-table-column
254           prop="ljcdName"
255           header-align="center"
256           align="center"
257           width="100"
258           label="逻辑测点">
259         </el-table-column>
260         <el-table-column
261           prop="enable"
262           header-align="center"
263           align="center"
264           width="100"
265           label="是否启用">
266           <template slot-scope="scope">
267             <el-tag v-if="scope.row.enable === 1" size="small" type="success">{{ $t('enableStatus1') }}</el-tag>
268             <el-tag v-else size="small" type="danger">{{ $t('enableStatus0') }}</el-tag>
269           </template>
270         </el-table-column>
271         <el-table-column
272           prop="scsj"
273           header-align="center"
274           align="center"
275           width="160"
276           label="生成时间">
277         </el-table-column>
278         <el-table-column
279           fixed="right"
280           header-align="center"
281           align="center"
282           width="160"
283           label="操作">
284           <template slot-scope="scope">
285             <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
286             <el-button type="text" size="small" @click="viewHandle(scope.row.id)">详情</el-button>
287             <el-button type="text" size="small" @click="chartHandle(scope.row)">采集值</el-button>
288           </template>
289         </el-table-column>
290       </el-table>
291       <el-pagination
292         @size-change="sizeChangeHandle"
293         @current-change="currentChangeHandle"
294         :current-page="pageIndex"
295         :page-sizes="[10, 20, 50, 100]"
296         :page-size="pageSize"
297         :total="totalPage"
298         layout="total, sizes, prev, pager, next, jumper">
299       </el-pagination>
300       <!-- 弹窗, 新增 / 修改 -->
301       <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
302       <!-- 弹窗, 详情 -->
303       <detail-view v-if="detailViewVisible" ref="detailView"></detail-view>
304       <!-- 弹窗, 历史数据 -->
305       <chart-view v-if="chartViewVisible" ref="chartView"></chart-view>
306     </div>
307   </el-card>
308 </template>
309 <script>
310 import AddOrUpdate from './data-point-add-or-update'
311 import DetailView from './data-point-view'
312 import ChartView from './data-point-chart'
313
314 export default {
315   data () {
316     return {
317       dataForm: {
318         cdbm: '',
319         cdmc: '',
320         tagNo: ''
321       },
322       dataList: [],
323       pageIndex: 1,
324       pageSize: 10,
325       totalPage: 0,
326       dataListLoading: false,
327       dataListSelections: [],
328       addOrUpdateVisible: false,
329       detailViewVisible: false,
330       chartViewVisible: false,
331       importUrl: '/proxyApi/data/data/point/import',
332       fileList: [],
333     }
334   },
335   components: {
336     AddOrUpdate,
337     DetailView,
338     ChartView
339   },
340   mounted () {
341     this.getDataList()
342   },
343   methods: {
344     searchDataList () {
345       this.pageIndex = 1
346       this.getDataList()
347     },
348     // 获取数据列表
349     getDataList () {
350       this.dataListLoading = true
351       this.$http({
352         url: '/data/point/list',
353         method: 'get',
354         params: this.$http.adornParams({
355           'page': this.pageIndex,
356           'limit': this.pageSize,
357           'cdbm': this.dataForm.cdbm,
358           'cdmc': this.dataForm.cdmc,
359           'tagNo': this.dataForm.tagNo
360         })
361       }).then(({data}) => {
362         console.log(data)
363         if (data) {
364           this.dataList = data
365           this.totalPage = data.length
366         } else {
367           this.dataList = []
368           this.totalPage = 0
369         }
370         this.dataListLoading = false
371       })
372     },
373     // 每页数
374     sizeChangeHandle (val) {
375       this.pageSize = val
376       this.pageIndex = 1
377       this.getDataList()
378     },
379     // 当前页
380     currentChangeHandle (val) {
381       this.pageIndex = val
382       this.getDataList()
383     },
384     // 多选
385     selectionChangeHandle (val) {
386       this.dataListSelections = val
387     },
388     // 新增 / 修改
389     addOrUpdateHandle (id) {
390       this.addOrUpdateVisible = true
391       this.$nextTick(() => {
392         this.$refs.addOrUpdate.init(id)
393       })
394     },
395     // 删除
396     deleteHandle (id) {
397       var ids = id ? [id] : this.dataListSelections.map(item => {
398         return item.id
399       })
400       this.$confirm(`确定删除选中的${ids.length}项数据?`, '提示', {
401         confirmButtonText: '确定',
402         cancelButtonText: '取消',
403         type: 'warning'
404       }).then(() => {
405         this.$http['post'](`/data/data/point/delete`, ids).then(({ data: res }) => {
406           if (res.code !== 0) {
407             return this.$message.error(res.msg)
408           }
409           this.$message({
410             message: this.$t('prompt.success'),
411             type: 'success',
412             duration: 500,
413             onClose: () => {
414               this.getDataList()
415             }
416           })
417         }).catch(() => {})
418       }).catch(() => {})
419     },
420     viewHandle (id) {
421       this.detailViewVisible = true
422       this.$nextTick(() => {
423         this.$refs.detailView.init(id)
424       })
425     },
426     chartHandle (row) {
427       this.chartViewVisible = true
428       this.$nextTick(() => {
429         this.$refs.chartView.init(row)
430       })
431     },
432     onSuccess () {}
433   }
434 }
435 </script>