index.vue
8.86 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
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
<template>
<div class="box">
<div>
<el-table
:data="taskInfo.mtasks[0].scenes"
border
stripe
style="width: 80%;float:left"
>
<el-table-column label="序号" type="index" width="80">
</el-table-column>
<el-table-column
prop="name"
align="center"
label="预置位编号"
width="180"
>
</el-table-column>
<el-table-column align="center" label="预设位置配置" width="180">
<template>
<div class="yzw-setbox">
<span class="icon el-icon-folder-add"></span>
<span class="icon el-icon-delete"></span>
</div>
</template>
</el-table-column>
<el-table-column prop="address" align="center" label="参数设置">
<template slot-scope="scope">
<div class="table-set">
<span @click="setParam(scope.row)">参数设置</span>
<span @click="setArea(scope.row)">区域设置</span>
<span @click="setDemarcate(scope.row)">标定设置</span>
<span @click="setTimer(scope.row)">时间设置</span>
</div>
</template>
</el-table-column>
</el-table>
<div class="setting-box">
<div class="set-header ">基础操作</div>
<div class="set-item" @click="setsounces">
场景添加 <span class="set-icon el-icon-circle-plus"></span>
</div>
<div class="set-item">
轮询播放
<span class="set-icon">
<el-switch :width="25" v-model="switchstate"> </el-switch>
</span>
</div>
<div class="set-item" @click="handleparam('upload')">
配置导入 <span class="set-icon el-icon-download"></span>
</div>
<div class="set-item" @click="handleparam('export')">
配置导出 <span class="set-icon el-icon-upload"></span>
</div>
<div class="set-item" @click="showview()">
效果展示 <span class="set-icon el-icon-s-help"></span>
</div>
</div>
<handleparam ref="handleparam"></handleparam>
</div>
<div class="yt-box">
<ytconfig ref="yt"></ytconfig>
</div>
<div>
<parameter ref="parameter"></parameter>
</div>
<div>
<areas ref="areas"></areas>
</div>
<div>
<demarcate ref="demarcate"></demarcate>
</div>
<div>
<el-dialog
title="时间设置"
:visible.sync="timerDialog"
width="18%"
top="15%"
:before-close="handleTimerClose"
>
<div class="settimertype">
<span class="title">时间长度:</span>
<div class="timer-sel">
<el-select v-model="timersel" placeholder="请选择">
<el-option label="下拉选择" :value="0"> </el-option>
<el-option label="自定义" :value="1"> </el-option>
</el-select>
</div>
</div>
<div class="sel-box" v-show="timersel == 0">
<span class="title">长度选择:</span>
<div class="timer-sel">
<el-select v-model="timer" placeholder="请选择">
<el-option
v-for="item in timeroptions"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
</div>
</div>
<div class="sel-box" v-show="timersel == 1">
<span class="title">时间长度:</span>
<div class="timer-sel">
<el-input v-model="timer" style="padding-right:23px"></el-input>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="handleTimerClose">取 消</el-button>
<el-button type="primary" @click="submitTimer">确 定</el-button>
</span>
</el-dialog>
</div>
</div>
</template>
<script>
import areas from "./area";
import demarcate from "./demarcate";
import parameter from "./parameter";
import ytconfig from "./ytconfig";
import handleparam from "./handleparam";
export default {
data() {
return {
timer: 0,
timersel: 0,
timerDialog: false,
timeroptions: [30, 40, 50, 60, 100],
timerscenes: null,
taskInfo: {
mtasks: [
{
scenes: []
}
]
},
switchstate: true
};
},
props: ["taskid", "subtaskid", "playurl"],
components: {
areas,
demarcate,
parameter,
ytconfig,
handleparam
},
methods: {
setParam() {
this.$refs.parameter.init(this.taskInfo);
},
setArea(roidata) {
this.$refs.areas.showModal(roidata, this.taskInfo);
},
setDemarcate() {
this.$refs.demarcate.showModal(this.taskInfo);
},
handleparam(type) {
this.$refs.handleparam.show(type);
},
setsounces() {
this.$refs.yt.openyt();
},
getTaskParams() {
this.$api.task.getTaskParams(this.taskid, this.subtaskid).then(data => {
this.taskInfo = data;
});
},
setTimer(data) {
this.timerscenes = data;
this.$store.commit("setocxstate", 0);
this.timerDialog = true;
},
handleTimerClose() {
this.timerDialog = false;
this.$store.commit("setocxstate", 1);
},
submitTimer(item) {
this.taskInfo.mtasks[0].time_interval = this.timer;
let data = {
subtask_id: this.subtaskid,
mtasks: this.taskInfo.mtasks
};
this.$api.task.editRoi(this.taskid, this.subtaskid, data).then(res => {
if (res.ecode == 200) {
this.timerDialog = false;
this.$message({
message: res.enote,
type: "success"
});
this.$store.commit("setocxstate", 1);
}
});
},
showview() {
this.$router.push({
name: "show",
params: {
taskid: this.taskid,
subtaskid: this.subtaskid,
playurl: this.playurl
}
});
},
submit: function(xml, type) {
let postObj = {
subtask_id: this.subtaskid,
mtasks: [
{
mtask_unid: this.taskInfo.mtasks[0].mtask_unid,
// type: 0,
// priority: 0,
scenes: [
{
scene_unid: this.taskInfo.mtasks[0].scenes[0].scene_unid,
play_urls: {
rtsp: this.vchanUrl
}
// algo_args: {}
}
]
}
]
};
if (type == "roi") {
postObj.mtasks[0].scenes[0].rois = [
{
roi: xml
}
];
} else if (type == "config") {
postObj.mtasks[0].scenes[0].config = {
xml: xml
};
} else if (type == "calibration") {
console.log(xml);
postObj.mtasks[0].scenes[0].calibration = {
calibration: xml
};
}
this.$api.task
.editRoi(this.taskid, this.subtaskid, postObj, {
headers: {
authorization: localStorage.getItem("atoken")
}
})
.then(m => {
if (m.ecode == "200") {
this.$message({
message: "设置成功!",
type: "success"
});
switch (type) {
case "roi":
this.taskInfo.mtasks[0].scenes[0].rois = [
{
roi: xml
}
];
break;
case "calibration":
this.taskInfo.mtasks[0].scenes[0].calibration = {
calibration: xml
};
break;
default:
break;
}
}
});
}
},
watch: {
subtaskid(val) {
this.$api.task.getTaskParams(this.taskid, val).then(res => {
this.taskInfo = res;
console.log(res.data);
});
}
}
};
</script>
<style lang="stylus" scoped>
.box{
position relative
}
.yzw-setbox{
.icon {
font-size 16px
padding 0 10px
cursor pointer
}
.icon:first-child{
color #6783E3
}
.icon:last-child{
color red
}
}
.setting-box{
width 18%;
float right
}
.table-set span{
padding 0 10px
cursor pointer
color #666666
border-right 1px solid #E5E5E5
}
.table-set span:last-child{
border-right 0
}
.table-set span:hover{
color #3BB7FF
}
.set-header{
height 3vh
line-height 3vh
text-align center
background #ACC1FF
}
.set-item{
height 3vh
line-height 3vh
padding:0 10px
color #555555
margin-top 1vh
cursor pointer
.set-icon{
display inline-block
float right
line-height 3vh
font-size 20px
color #CCCCCC
}
.set-icon:hover{
color #3BB7FF
}
}
.upload-box {
margin-right 20px
}
.yt-box{
}
.settimertype,.sel-box{
display flex
margin-bottom 10px
.title {
line-height 30px;
padding-right 10px
}
}
</style>