index.vue
9.45 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
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
<template>
<div class="video-container clerk-wrapper">
<el-row class="manage-head-wrapper">
<el-col :xs="22" :sm="22">
<div class="manage-select-box">
<el-select v-model="queryForm.mallId" filterable :placeholder="$t('pholder.select')" @change="mallChange">
<el-option v-for="item in mallListForTerm" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</div>
<!-- 设备名称 -->
<!-- <div class="manage-select-box">
<el-input v-model="queryForm.deviceName" class="search-inp" placeholder="请输入设备名称" clearable />
</div> -->
<!-- 序列号 -->
<div class="manage-select-box">
<el-input v-model="queryForm.deviceSerial" class="search-inp" :placeholder="$t('pholder.deviceSerial')" clearable />
</div>
<el-button type="primary" class="search-btn" plain @click="searchFun">{{$t('button.search')}}</el-button>
</el-col>
<el-col :xs="2" :sm="2">
<el-button type="primary" class="manage-add-btn" @click="addDevice" icon="el-icon-circle-plus-outline">{{$t('button.groupAdd')}}</el-button>
</el-col>
</el-row>
<el-row class="manage-content">
<el-col :span="24">
<el-table
ref="row_table"
class="gate-table"
:data="tableData"
:max-height="tableHeight"
style="width: 100%"
@expand-change="expandHandle"
header-row-class-name="manage-tab-head"
>
<el-table-column type="expand" prop="children">
<template slot-scope="scope">
<el-table
:data="scope.row.children"
:show-header="false"
:empty-text="noDataText"
class="expand-table"
v-loading='loading'
>
<el-table-column align="center" width="148">
<template slot-scope="scope">
<div class="child-order-column">
<div class="child-order__icon-inner">{{ scope.row.childOrder }}</div>
</div>
</template>
</el-table-column>
<el-table-column prop="channelName" align="center">
<template slot-scope="scope">
<span v-if="scope.row.name">{{scope.row.name}}({{scope.row.channelName}})</span>
<span v-else>{{scope.row.channelName}}</span>
</template>
</el-table-column>
<el-table-column :label="$t('table.operate')" align="center">
<template slot-scope="scope">
<el-button @click="editChannelRow(scope.row)" type="text" size="small" class="tab-btn">{{$t('button.edit')}}</el-button>
<el-button @click="playVideo(scope.row)" type="text" size="small" class="tab-btn">{{$t('button.play')}}</el-button>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column prop="order" :label="$t('table.order')" align="center" width="100"></el-table-column>
<el-table-column prop="name" :label="$t('table.deviceName')" align="center">
<template slot-scope="scope">
<span>{{scope.row.name}}</span><span v-if="scope.row.deviceName">({{scope.row.deviceName}})</span>
</template>
</el-table-column>
<el-table-column prop="platform" :label="$t('table.videoSource')" align="center">
<template slot-scope="scope">
<span>{{scope.row.platform==1 ? '拾联': '萤石云'}}</span>
</template>
</el-table-column>
<el-table-column prop="deviceSerial" :label="$t('table.deviceSerial')" align="center"></el-table-column>
<el-table-column :label="$t('table.operate')" align="center">
<template slot-scope="scope">
<el-button @click="editRow(scope.row)" type="text" size="small" class="tab-btn">{{$t('button.edit')}}</el-button>
<!-- <el-button @click="delRow(scope.row)" type="text" size="small" class="tab-btn">{{$t('button.delete')}}</el-button> -->
</template>
</el-table-column>
</el-table>
<el-pagination
class="manage-pagination-box"
background
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
@size-change="sizeChange"
@current-change="cerrentChange"
layout="sizes, prev, pager, next, slot"
:total="total"
>
<span
class="slot-ele-total"
>{{$t('table.pageHead')}} {{ total }} {{$t('table.pageTail')}}</span>
</el-pagination>
</el-col>
</el-row>
<add-device-dialog ref="adddeviceModel"></add-device-dialog>
<edit-channel-dialog ref="editChannelModel"></edit-channel-dialog>
<video-dialog ref="videoModel"></video-dialog>
</div>
</template>
<script>
import addDeviceDialog from './add.vue'
import editChannelDialog from './editChannel.vue'
import videoDialog from './videoDialog.vue'
export default{
data(){
return {
mallListForTerm:[],
tableData: [],
total: 0,
pageSize: 10,
currentPage: 1,
queryForm:{
accountId: this.$cookie.get('accountId')
},
noDataText:'',
loading:false,
}
},
components: {
"add-device-dialog": addDeviceDialog,
'edit-channel-dialog':editChannelDialog,
'video-dialog':videoDialog
},
mounted(){
this.getMallListForTerm()
},
computed: {
tableHeight() {
const windowInnerHeight = window.innerHeight;
return windowInnerHeight - windowInnerHeight * 0.24;
}
},
methods:{
getMallListForTerm() {
this.mallListForTerm = [];
this.queryForm.mallId = "";
this.$api.base.mall(
{
accountId: this.$cookie.get('accountId'),
status_arr: "1,3"
},
null,
true
)
.then(data => {
let result = data.data;
if (result.data.length) {
if (this.getSessionLocal("mallId")) {
this.queryForm.mallId = Number(this.getSessionLocal("mallId"));
} else {
this.queryForm.mallId = result.data[0].id;
this.setSessionLocal("mallId", this.queryForm.mallId);
}
this.mallListForTerm = result.data;
}
this.getTableData();
})
.catch(error => {});
},
mallChange() {
this.setSessionLocal("mallId", this.queryForm.mallId);
this.getTableData();
},
getTableData() {
this.dataMsg = this.$t("echartsTitle.loading");
let tabelParams = {
pageNum: this.currentPage,
pageSize: this.pageSize,
...this.queryForm
};
Object.keys(tabelParams).map(key => (!tabelParams[key] ? delete tabelParams[key] : ''));
this.$api.videoShopTourReport
.getDeviceList(tabelParams, null, true)
.then(data => {
this.tableData = [];
var result = data.data;
result.data.list.forEach((item, index) => {
// item.isExpand = false;
item.order = (this.currentPage - 1) * this.pageSize + index + 1;
item.children = [];
});
this.tableData = result.data.list;
this.total = result.data.total;
})
},
sizeChange(val) {
this.pageSize = val;
this.getTableData();
},
cerrentChange(val) {
if (this.currentPage != val) {
this.currentPage = val;
this.getTableData();
}
},
expandHandle(row, expandedRows,deviceId){
this.loading = true;
let RowId = deviceId?deviceId:row.id
this.$refs.row_table.store.states.expandRows = expandedRows.length ? [row]: [];
let isExpand = false;
if (this.$refs.row_table.store.states.expandRows.length > 0) {
if (this.$refs.row_table.store.states.expandRows[0].id == RowId) {
isExpand = true;
}
}
// this.noDataText = "无数据";
if (!isExpand) return;
row.children = [];
this.$api.videoShopTourReport.getPatrolDeviceChannelList({ deviceId: RowId,pageSize: 999999,page:1})
.then(res => {
this.loading = false;
let result = res.data;
if (result.data.list.length == 0){
this.noDataText = this.$t("echartsTitle.noData");
}
result.data.list.forEach((item, index) => {
item.childOrder = ++index;
});
row.children = result.data.list;
})
},
addDevice(){
this.$refs.adddeviceModel.dialogInit(this.queryForm.mallId,'add');
},
editRow(row){
this.$refs.adddeviceModel.dialogInit(this.queryForm.mallId,'edit',row);
},
editChannelRow(row){
this.$refs.editChannelModel.dialogInit(row);
},
searchFun(){
this.currentPage = 1;
this.getTableData();
},
playVideo(row){
this.$refs.videoModel.dialogInit(row,1);
}
}
}
</script>
<style scoped="scoped" lang="less">
.manage-container{
width: 100%;
}
.manage-select-box{
/deep/.el-select{
width: 180px;
}
}
</style>