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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<template>
<div id="main" class="h-all">
<el-container class="h-all">
<el-header height="auto">
<div class="header-button-box">
<el-button size='mini' icon="el-icon-upload2" type="primary" @click="importToExcelInit"
v-if="importNetworkPhysicsCommand.visible">{{$t('common.importBtn')}}
</el-button>
<el-button size='mini' icon="el-icon-download" type="primary" @click="exportToExcelInit">{{$t('common.exportBtn')}}
</el-button>
<el-button size='mini' icon="el-icon-circle-plus-outline" type="primary" @click="createNetworkPhysicsLinkInit"
v-if="createAndCopyCommand.visible">{{$t('common.createBtn')}}
</el-button>
<el-button size = 'mini' icon="el-icon-document" type="primary" @click="copyNetworkPhysicsLinkInit"
v-if="createAndCopyCommand.visible">{{$t('common.copyBtn')}}</el-button>
<el-button size='mini' icon="el-icon-edit" type="primary" @click="updateNetworkPhysicsLinkInit"
v-if="updateNetworkPhysicsCommand.visible">{{$t('common.updateBtn')}}
</el-button>
<el-button size='mini' icon="el-icon-delete" type="primary" @click="deleteNetworkPhysicsLinkInit"
v-if="deleteNetworkPhysicsCommand.visible">
{{$t('common.deleteBtn')}}
</el-button>
</div>
<!-- 条件查询工具栏 -->
<div class="header-search">
<div class="search-input-box">
<label>{{$t('NetworkPhysicsLinkConfigurationManagement.NodeNameQuery')}}</label>
<el-input size = 'mini' :placeholder="$t('common.placeholder')" v-model="querySelectNode" clearable></el-input>
</div>
<div class="search-input-box">
<label>{{$t('NetworkPhysicsLinkConfigurationManagement.AccessBusinessQuery')}}</label>
<el-input size = 'mini' :placeholder="$t('common.placeholder')" v-model="querySelectBusiness" clearable></el-input>
</div>
<div class="search-input-box">
<label>{{$t('NetworkPhysicsLinkConfigurationManagement.DeviceNameQuery')}}</label>
<el-select v-model="querySelectDevice" size="mini" :placeholder="$t('NetworkPhysicsLinkConfigurationManagement.SelectDevice')" :clearable="true">
<el-option
v-for="item in QueryDeviceList"
:key="item.deviceKey"
:label="item.deviceName"
:value="item.deviceKey">
</el-option>
</el-select>
</div>
<div class="search-input-box">
<el-button icon="el-icon-search" type="primary" size = 'mini' @click="queryNetworkPhysicsLinkByCondition" v-loading.fullscreen.lock="fullscreenLoading">{{$t('common.queryBtn')}}</el-button>
</div>
</div>
</el-header>
<!-- table数据表格 -->
<el-main class="adapt-height-box">
<el-table
:empty-text="$t('common.noData')"
tooltip-effect="dark"
stripe
header-row-class-name="table-header"
cell-class-name="table-cell"
class="adapt-height"
height="auto"
border
ref="singleTable"
:data="NetworkPhysicsLinkList"
highlight-current-row
@current-change="handleCurrentChange"
@selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="28">
</el-table-column>
<el-table-column
prop="nodeName"
:label="$t('NetworkPhysicsLinkConfigurationManagement.NodeName')"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="description"
:label="$t('NetworkPhysicsLinkConfigurationManagement.Description')"
:show-overflow-tooltip="true">
</el-table-column>
<el-table-column
prop="deviceKey"
:label="$t('NetworkPhysicsLinkConfigurationManagement.DeviceKey')"
:show-overflow-tooltip="true"
:formatter="formatDeviceKey">
</el-table-column>
<el-table-column
prop="port"
:label="$t('NetworkPhysicsLinkConfigurationManagement.Port')"
:show-overflow-tooltip="true">
</el-table-column>
</el-table>
</el-main>
</el-container>
<CommandExecuteContext v-bind:commands="commandContext"></CommandExecuteContext>
</div>
</template>
<script>
import CommandExecuteContext from '@/commands/CommandExecuteContext'
import NetworkPhysicsCommands from "@/commands/NetworkPhysicsCommands"
import DeviceService from '@/domain/services/DeviceService'
import NetworkPhysicsService from '@/domain/services/NetworkPhysicsService'
import HelperUtil from '@/utils/HelperUtil'
import loading from "../../utils/Loading";
export default {
name: "NetworkPhysicsLinkConfigurationManagement",
data: function () {
return{
//命令
commandContext: {},
//为了创建复制初始化传参
createAndCopyInitList: [],
createAndCopyTitle: '',
//删除相关
deleteList: [],
//为修改传参数
updateInitList: [],
fullscreenLoading: false,
//条件查询
querySelectNode:"",//条件查询节点名称
querySelectBusiness:"",//条件查询接入业务
querySelectDevice:"",//条件查询设备名称
formLabelWidth: '120px',
form:{
nodeName:"",
description:"",
deviceKey:"",
port:"",
},
//双向绑定展示数据
NetworkPhysicsLinkList: [],
//双向绑定展示数据
QueryDeviceList:[],
// value: '',
//保存当前行数据
currentRow: null,
//保存多选行数据
multipleSelection: [],
//查询条件
selectList: [],
deviceList: [],
}
},
mounted: function () {
this.getAllNetworkPhysicsLinkInit()
},
components: {
CommandExecuteContext,
},
watch: {
commandContext(newVal, oldVal) {
if (JSON.stringify(newVal) === '{}') {
this.querySelectNode = ''
this.querySelectBusiness = ''
this.querySelectDevice = ''
this.getAllNetworkPhysicsLink(this);
this.$refs.singleTable.clearSelection();
}
deep: true
},
},
created: function () {
this.getAllNetworkPhysicsLinkInit()
this.getAllDeviceInit()
},
computed: {
openTab() {
return this.$store.state.openTab;
},
activeIndex: {
get() {
return this.$store.state.activeIndex;
},
set(val) {
this.$store.commit('set_active_index', val);
}
},
//命令
createAndCopyCommand() {
return NetworkPhysicsCommands.createNetworkPhysicsCommand(this.createAndCopyTitle, this.createAndCopyInitList, this.commandContext)
},
deleteNetworkPhysicsCommand() {
return NetworkPhysicsCommands.deleteNetworkPhysicsCommand(this.deleteList, this.commandContext)
},
updateNetworkPhysicsCommand() {
return NetworkPhysicsCommands.updateNetworkPhysicsCommand(this.updateInitList, this.commandContext)
},
importNetworkPhysicsCommand() {
return NetworkPhysicsCommands.importNetworkPhysicsCommand(this.commandContext)
}
},
methods: {
/**
* @Description :单选一行,将所选行进行保存
* @author ::zyh
*/
handleCurrentChange(val) {
this.currentRow = val;
},
/**
* @Description :表格多选框改变时,将所选行进行保存
* @author ::zyh
*/
handleSelectionChange(val) {
this.multipleSelection = val
},
/**
* @Description :获取全部网元信息
* @author ::zyh
*/
getAllDeviceInit: function () {
let loadingInstance=loading.openLoading();
let _this = this;
DeviceService.getAllDeviceCollection().then(result => {
//成功
this.QueryDeviceList = Object.values(result)
loadingInstance.close();
}).catch(err => {
//失败
loadingInstance.close();
this.InfoTip.errorTip(_this,err);
})
},
/**
* @Description :获取所有网络物理连接初始化
* @author :zyh
*/
getAllNetworkPhysicsLinkInit: function () {
let _this = this;
NetworkPhysicsService.getAllNetPhyLinkCollection().then(result => {
_this.NetworkPhysicsLinkList = Object.values(result);
console.log(NetworkPhysicsLinkList)
}).catch(err => {
//失败
_this.$message.error('Error ' + result.body.faultCode + ':' + result.body.faultCause);
});
},
/**
* @Description :获取所有网络物理连接信息
* @author :zyh
*/
getAllNetworkPhysicsLink: function(vue){
let _this = vue;
NetworkPhysicsService.getAllNetPhyLinkCollection().then(result => {
_this.NetworkPhysicsLinkList = Object.values(result);
}).catch(err => {
//失败
_this.$message.error('Error ' + result.body.faultCode + ':' + result.body.faultCause);
});
},
/**
* @Description :创建网络物理连接初始化
* @author :zyh
*/
createNetworkPhysicsLinkInit: function () {
this.createAndCopyTitle = this.$t('NetworkPhysicsLinkConfigurationManagement.dialogNetworkPhysicsCreate');
this.createAndCopyInitList = {
"nodeName": "",
"description": "",
"deviceKey": "",
"port": "",
};
this.createAndCopyCommand.execute();
},
/**
* @Description :复制网络物理连接初始化
* @author :zyh
*/
copyNetworkPhysicsLinkInit: function (){
if(this.multipleSelection.length == 0){
//请选择一条信息进行复制
this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.COPY_SELECT_CODE))
return;
}else if(this.multipleSelection.length > 1){
//请只选择一条信息进行复制
this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.COPY_ONLY_ONE_CODE))
return;
}else{
this.createAndCopyTitle = this.$t('NetworkPhysicsLinkConfigurationManagement.dialogNetworkPhysicsCopy');
this.createAndCopyInitList = this.multipleSelection[0]
this.createAndCopyCommand.execute();
}
},
/**
* @Description :修改网络物理连接初始化
* @author :zyh
*/
updateNetworkPhysicsLinkInit: function () {
if (this.multipleSelection.length == 0) {
this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.UPDATE_SELECT_CODE))
return;
} else if (this.multipleSelection.length > 1) {
this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.UPDATE_SELECT_CODE))
return;
} else {
this.updateInitList = {
"nodeName": this.multipleSelection[0].nodeName,
"description": this.multipleSelection[0].description,
"deviceKey": this.multipleSelection[0].deviceKey,
"port": this.multipleSelection[0].port,
};
this.updateNetworkPhysicsCommand.execute();
}
},
/**
* @Description :删除网络物理连接初始化(支持批量)
* @author :zyh
*/
deleteNetworkPhysicsLinkInit: function () {
if (this.multipleSelection.length == 0) {
this.InfoTip.warningTip(this, HelperUtil.getCheckStatusCodeObjectByCode(this.successCode.DELETE_SELECT_CODE))
return;
} else {
this.deleteList = []
for (var i = 0; i < this.multipleSelection.length; i++) {
this.deleteList.push(this.multipleSelection[i]['nodeName']);
}
this.deleteNetworkPhysicsCommand.execute();
}
},
/**
* @Description :条件查询网络物理连接
* @author :zyh
*/
queryNetworkPhysicsLinkByCondition: function () {
let _this = this;
_this.selectList = this.handleQueryCondition();
let loadingInstance = _this.Loading.openLoading();
NetworkPhysicsService.conditionQueryNetPhyLink(_this.selectList).then(result => {
_this.NetworkPhysicsLinkList = Object.values(result);
_this.Loading.closeLoading(loadingInstance);
_this.InfoTip.successTip(_this, HelperUtil.getStatusCodeObjectByCode(_this.successCode.QUERY_CODE));
}).catch(err => {
_this.Loading.closeLoading(loadingInstance);
_this.InfoTip.errorTip(_this, err);
})
},
importToExcelInit: function () {
console.log('导入文件:');
this.importNetworkPhysicsCommand.execute()
},
/**
* @Description :导出网络物理连接文件
* @author :zyh
*/
exportToExcelInit: function () {
let _this = this;
_this.selectList = this.handleQueryCondition();
let loadingInstance = loading.openLoading();
NetworkPhysicsService.downloadNetPhyLink(_this.selectList).then(result => {
loadingInstance.close();
}).catch(err => {
loadingInstance.close();
this.InfoTip.errorTip(this, err);
});
},
handleQueryCondition: function () {
let selectList = new Array();
if (this.querySelectNode != '' && this.querySelectNode != null) {
selectList.push({
quaryAttribute: '_key',
compareSymbol: "like",
compareValue: this.querySelectNode,
})
}
if (this.querySelectBusiness != '' && this.querySelectBusiness != null) {
selectList.push({
quaryAttribute: 'description',
compareSymbol: "like",
compareValue: this.querySelectBusiness,
})
}
if (this.querySelectDevice != '' && this.querySelectDevice!= null) {
selectList.push({
quaryAttribute: 'deviceKey',
compareSymbol: "like",
compareValue: this.querySelectDevice,
})
}
return selectList;
},
/**
* @Description :过滤deviceKey,转为显示deviceName
* @author :zyh
*/
formatDeviceKey: function (row, column) {
for (var i = 0; i < this.QueryDeviceList.length; i++) {
if (this.QueryDeviceList[i]['deviceKey'] == row.deviceKey) {
return this.QueryDeviceList[i]['deviceName']
break
}
}
},
},
}
</script>
<style scoped>
</style>