detail.vue
5.42 KB
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
<template>
<el-dialog
class="manage-dialog dev-detail-dialog"
:visible.sync="detailVisible"
:close-on-click-modal="false"
@close="detailDialogClose">
<!-- <div class=""> -->
<!-- <ul class="detail-content">
<li class="detail-content-item">
<span class="item-label">序列号:</span>
<span class="item-content">{{ detailForm.serialnum }}</span>
</li>
<li class="detail-content-item">
<span class="item-label">IP:</span>
<span class="item-content">{{ detailForm.localIp }}</span>
</li>
</ul> -->
<div slot="title" class="detail-title-wrapper">
<span>{{$t('dialog.deviceDetail')}}</span>
<span class="detail-title">{{ detailForm.serialnum }}</span>
<span class="detail-title">{{ detailForm.localIp }}</span>
</div>
<el-table class="dev-detail-table" :data="detailTabData">
<el-table-column align="center" width="100" :label="$t('table.order')">
<template slot-scope="scope">
<div class="child-order-column">
<div class="child-order__icon-inner">
{{ scope.row.tableOrder }}
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="serialnum" :label="$t('dialog.number')" align="center"></el-table-column>
<el-table-column prop="gateName" :label="$t('table.monitorSiteName')" align="center"></el-table-column>
<el-table-column prop="belongsName" :label="$t('table.ownShop')" align="center"></el-table-column>
</el-table>
<!-- </div> -->
<div slot="footer" class="dialog-footer">
<el-button @click="detailVisible = false" class="dialog-btn">{{$t('dialog.close')}}</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
data() {
return {
detailVisible: false,
detailForm: {
serialnum: '',
localIp: ''
},
detailTabData: [],
}
},
methods: {
dialogInit(data) {
this.getChannel(data.id);
this.detailVisible = true;
},
getChannel(deviceId) {
this.detailTabData = [];
this.$api.base.channel({
deviceId: deviceId,
// _t: Date.parse(new Date()) / 1000
})
.then((data) => {
let result = data.data;
result.data.forEach((item, index) => {
item.tableOrder = ++index;
item.gateName = item.gate ? item.gate.name : '--';
if (item.gateId) {
item.belongsName = '';
this.getChannelInfo(item.id, index - 1);
// this.getChannelGate(item.mallId, item.gateId);
} else {
item.belongsName = '--';
}
})
this.detailTabData = result.data;
// this.getChannel(result.data.id);
})
.catch(err => { })
},
getChannelInfo(channelId, tabIndex) {
this.$api.base.singleChannel(channelId, {
// _t: Date.parse(new Date()) / 1000
})
.then((data) => {
let result = data.data;
if (result.data.gate) {
if (result.data.zones.length > 0) {
this.detailTabData[tabIndex].belongsName = result.data.zones.map(item => {
return item.name;
}).join(',');
} else if (result.data.floors.length > 0) {
this.detailTabData[tabIndex].belongsName = result.data.floors.map(item => {
return item.name;
}).join(',');
} else {
this.detailTabData[tabIndex].belongsName = '--';
}
}
})
.catch(err => { })
},
// getChannelGate(mall_id, gate_id) {
// // let gateNameStr = '';
// this.$api.base.gate({
// mallId: mall_id,
// id: gate_id,
// // _t: Date.parse(new Date()) / 1000
// })
// .then((res) => {
// let result = res.data;
// result.data.forEach(key => {
// this.detailTabData.forEach(item => {
// if (key.id == item.gateId) {
// this.getBelongs()
// if (item.gateName) {
// if (item.gateName !== key.name) {
// item.gateName = item.gateName + ' ' + key.name;
// }
// } else {
// item.gateName += key.name;
// }
// }
// })
// })
// })
// // return gateNameStr;
// },
detailDialogClose() {
this.detailForm = {};
this.detailTabData = [];
},
},
}
</script>
<style scoped>
.detail-title-wrapper {
color: #fff;
font-size: 18px;
}
.detail-title+.detail-title {
padding-left: 20px;
}
.child-order-column {
position: relative;
z-index: 1;
display: inline-flex;
justify-content: center;
align-items: center;
width: 16px;
height: 16px;
font-size: 10px;
box-sizing: border-box;
background: #fff;
transition: .15s ease-out;
border-radius: 50%;
border: 1px solid;
border-color: inherit;
}
.child-order__icon-inner {
display: inline-block;
user-select: none;
text-align: center;
font-weight: normal;
line-height: 1;
color: #888;
}
.manage-input-box .el-input {
width: 150px;
}
.manage-input-box .el-select {
width: 110px;
}
</style>