addTpl.vue
12.9 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
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
<template>
<div class="add-template">
<el-dialog title="新建算法模板" :visible.sync="dialogVisable" class="detail-modal" width="65%">
<div class="tpl-tbody">
<ul class="input-warp">
<li hidden>
<span>业务类型</span>
<span>
<el-select
v-model="tplType"
placeholder="业务类型"
class="algo-header-left"
@change="typeChangeHandle"
>
<el-option value="jiaotong" label="交通算法"></el-option>
<el-option value="zongzhi" label="城市综合治理算法"></el-option>
<el-option value="shequ" label="社区管理算法"></el-option>
<el-option value="renlian" label="人脸识别算法"></el-option>
<el-option value="yuyi" label="语义分析算法"></el-option>
<el-option value="wenben" label="文本识别算法"></el-option>
</el-select>
</span>
</li>
<li>
<span>模板名称</span>
<span>
<el-input v-model="tplName" placeholder="请输入模板名称"></el-input>
</span>
</li>
</ul>
<!-- <div class="tpl-group-warp">
<h5>算法库</h5>
<ul class="tpl-group">
<li v-for="(item, index) in algoBase" :key="index">
<div class="algo-item scrollbar" @click="algoClickHandle">
<span v-for="(algoItem, algoIndex) in item.list" :key="algoIndex" :title="algoItem.algid">{{ algoItem.algid }}</span>
</div>
<p>
<i>{{ item.name }}</i>
<b></b>
</p>
</li>
</ul>
</div>-->
<div class="tpl-group-warp">
<ul class>
<li class="selitem">
<el-select v-model="bp1" placeholder="视频检测算法" filterable @change="showsfmodal('bp1')">
<el-option value="spsf" label="视频检测算法">视频检测算法</el-option>
<el-option value="sbsf" label="图像识别算法">图像识别算法</el-option>
<el-option value="xwsf" label="行为分析算法">行为分析算法</el-option>
<el-option value="yysf" label="应用算分">应用算分</el-option>
</el-select>
</li>
<li>
<i class="el-icon-d-arrow-right"></i>
</li>
<li class="selitem">
<el-select v-model="bp2" placeholder="图像识别算法" filterable @change="showsfmodal('bp2')">
<el-option value="spsf" label="视频检测算法">视频检测算法</el-option>
<el-option value="sbsf" label="图像识别算法">图像识别算法</el-option>
<el-option value="xwsf" label="行为分析算法">行为分析算法</el-option>
<el-option value="yysf" label="应用算分">应用算分</el-option>
</el-select>
</li>
<li>
<i class="el-icon-d-arrow-right"></i>
</li>
<li class="selitem">
<el-select v-model="bp3" placeholder="行为分析算法" filterable @change="showsfmodal('bp3')">
<el-option value="spsf" label="视频检测算法">视频检测算法</el-option>
<el-option value="sbsf" label="图像识别算法">图像识别算法</el-option>
<el-option value="xwsf" label="行为分析算法">行为分析算法</el-option>
<el-option value="yysf" label="应用算分">应用算分</el-option>
</el-select>
</li>
<li>
<i class="el-icon-d-arrow-right"></i>
</li>
<li class="selitem">
<el-select v-model="bp4" placeholder="应用算法" filterable @change="showsfmodal('bp4')">
<el-option value="spsf" label="视频检测算法">视频检测算法</el-option>
<el-option value="sbsf" label="图像识别算法">图像识别算法</el-option>
<el-option value="xwsf" label="行为分析算法">行为分析算法</el-option>
<el-option value="yysf" label="应用算分">应用算分</el-option>
</el-select>
</li>
</ul>
</div>
<div class="sfcontentbox">
<div class="item">
<div v-for="(item,index) in sfmodal1" :key="index" class="sfflitem">{{item}}</div>
</div>
<div class="item">
<div v-for="(item,index) in sfmodal2" :key="index" class="sfflitem">{{item}}</div>
</div>
<div class="item">
<div v-for="(item,index) in sfmodal3" :key="index" class="sfflitem">{{item}}</div>
</div>
<div class="item">
<div v-for="(item,index) in sfmodal4" :key="index" class="sfflitem">{{item}}</div>
</div>
</div>
<!-- /tpl-group-warp -->
</div>
<!-- /tpl-tbody -->
<span slot="footer" class="dialog-footer">
<el-button @click="hideModal">关 闭</el-button>
<el-button type="primary" @click="saveTpl">保 存</el-button>
</span>
<el-dialog width="40%" :title="sftitle" :visible.sync="innerVisible" append-to-body>
<div class="sfxzbox">
<div class="title">镜像算法</div>
<div class="jxbox">
<div>
<div v-for="(zimte,zindex) in zmfl" :key="zindex" class="flbox">
<div class="lesm">{{zimte}}</div>
<el-checkbox-group v-model="checkList">
<el-col :span="8" v-for="(item,index) in sfzl" :key="index">
<el-checkbox
:value="item.sfname"
:label="item.sfname"
v-if="item.sfly =='vionimage' && item.szm == zimte"
></el-checkbox>
</el-col>
</el-checkbox-group>
</div>
</div>
</div>
<div class="title">插件算法</div>
<div class="cjbox">
<el-checkbox-group v-model="checkList">
<el-col :span="4" v-for="(item,index) in sfzl" :key="index">
<el-checkbox
:value="item.sfname"
:label="item.sfname"
v-if="item.sfly !='vionimage'"
></el-checkbox>
</el-col>
</el-checkbox-group>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="hideSFModal">关 闭</el-button>
<el-button type="primary" @click="saveSF">确 定</el-button>
</span>
</el-dialog>
</el-dialog>
</div>
</template>
<script>
import {zongzhi,jiaotong,shequ,renlian,yuyi,wenben} from './algotype'
export default {
data() {
return {
dialogVisable: false,
hasDialog: true,
innerVisible: false,
sftitle: "",
tplType: "",
bp1: "",
bp2: "",
bp3: "",
bp4: "",
sfmodal1: [],
sfmodal2: [],
sfmodal3: [],
sfmodal4: [],
algoFileType: "traffic",
tplName: "",
curmodel: [],
checkList: [],
sfzl: [],
spjcsf:[],
txsbsf:[],
// zmfl:["A","B","C","D","E","F","G","H","I","J","k","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
zmfl:["B","C","D","F","G","H","J","L","M","P","R","S","W","X","Y","Z"]
};
},
methods: {
tplInit: function(tpl_type) {
this.dialogVisable = true;
let flag = this.tplType === tpl_type;
this.tplType = tpl_type;
this.algoFileType = "traffic";
},
editInit(data){
this.dialogVisable = true;
this.bp1=data.bp1;
this.bp2 = data.bp2;
this.bp3 = data.bp3;
this.bp4 =data.bp4;
this.sfmodal1 = data.sfmodal1;
this.sfmodal2 = data.sfmodal2;
this.sfmodal3 = data.sfmodal3;
this.sfmodal4 = data.sfmodal4;
console.log(data)
},
typeChangeHandle() {},
showsfmodal(val) {
let obj = {
spsf: "视频检测算法",
sbsf: "识别算法",
xwsf: "行为算法",
yysf: "应用算法"
};
this.curmodel = val;
this.innerVisible = true;
this.checkList = [];
if (val == "bp1") {
this.sftitle = obj[this.bp1];
this.cursf = this.bp1;
}
if (val == "bp2") {
this.sftitle = obj[this.bp2];
this.cursf = this.bp2;
}
if (val == "bp3") {
this.sftitle = obj[this.bp3];
this.cursf = this.bp3;
}
if (val == "bp4") {
this.sftitle = obj[this.bp4];
this.cursf = this.bp4;
}
if (this.cursf == "spsf") {
this.sfzl = this.spjcsf;
this.zmfl = ["B","C","D","F","G","H","J","L","M","P","R","S","W","X","Y","Z"]
}
if (this.cursf == "sbsf") {
this.sfzl = this.txsbsf;
this.zmfl = ["B","C","H","R","W","Z"]
}
if (this.cursf == "xwsf") {
this.sfzl = [];
}
if (this.cursf == "yysf") {
this.sfzl = [];
}
},
hideModal() {
this.dialogVisable = false;
},
hideSFModal() {
this.innerVisible = false;
},
saveTpl() {
if (this.tplName != "") {
this.dialogVisable = false;
let data = {
tplname: this.tplName,
create_dt: this.$moment().format("YYYY-MM-DD HH:mm:ss"),
tid: new Date().getTime(),
sfmodal1: this.sfmodal1,
sfmodal2: this.sfmodal2,
sfmodal3: this.sfmodal3,
sfmodal4: this.sfmodal4,
bp1:this.bp1,
bp2:this.bp2,
bp3: this.bp3,
bp4: this.bp4
};
debugger;
let tplData = localStorage.getItem("tplData");
if (tplData) {
tplData = JSON.parse(tplData);
tplData.push(data);
localStorage.setItem("tplData", JSON.stringify(tplData));
} else {
var e = [];
e.push(data);
localStorage.setItem("tplData", JSON.stringify(e));
}
setTimeout(() => {
this.$emit("refresh");
}, 300);
} else {
this.$message({
message: "模板名称不能为空!",
type: "error"
});
}
},
saveSF() {
this.innerVisible = false;
if (this.curmodel == "bp1") this.sfmodal1 = this.checkList;
if (this.curmodel == "bp2") this.sfmodal2 = this.checkList;
if (this.curmodel == "bp3") this.sfmodal3 = this.checkList;
if (this.curmodel == "bp4") this.sfmodal4 = this.checkList;
}
},
created(){
var jt = JSON.parse(JSON.stringify(jiaotong));
var zz = JSON.parse(JSON.stringify(zongzhi));
var sq = JSON.parse(JSON.stringify(shequ));
var rl = JSON.parse(JSON.stringify(renlian));
var wb = JSON.parse(JSON.stringify(wenben));
var yy = JSON.parse(JSON.stringify(yuyi));
var t = [];
var tData = localStorage.getItem("plugData")?localStorage.getItem("plugData"):"[]";
var p = JSON.parse(tData)
t = t.concat(jt,zz,sq,rl,wb,yy,p);
t.map(ele => {
if(ele.sflb == "视频检测算法") {
this.spjcsf.push(ele);
}
if(ele.sflb == "图像识别算法") {
this.txsbsf.push(ele);
}
})
}
};
</script>
<style lang="stylus" scoped>
.detail-modal {
width: 100%;
}
.tpl-tbody {
position: relative;
overflow: hidden;
}
.input-warp {
overflow: hidden;
}
.input-warp li {
float: left;
width: 33%;
height: 36px;
line-height: 36px;
overflow: hidden;
}
.input-warp li span {
float: left;
padding-right: 2%;
}
.input-warp li span:last-child {
padding-right: 0;
}
.tpl-group-warp {
position: relative;
width: 100%;
overflow: hidden;
}
.tpl-group-warp ul {
display: flex;
margin-top: 10px;
}
.tpl-group-warp ul li {
list-style: none;
width: 93px;
text-align: center;
line-height: 30px;
}
.tpl-group-warp ul .selitem {
width: 200px;
list-style: none;
}
.sfcontentbox {
display: flex;
margin-top: 10px;
.item {
width: 197px;
height: 300px;
margin-right: 100px;
border: 1px solid #c0c0c0;
border-radius: 10px;
overflow auto;
}
}
.sfxzbox {
height 400px;
overflow auto
.title {
width: 90px;
font-size: 16px;
border-bottom: 2px solid #acabab;
padding: 0 0 5px 5px;
margin-bottom: 10px;
}
}
.jxbox {
margin-bottom: 30px;
}
.cjbox {
margin-top: 10px;
}
.sfflitem {
width: 130px;
margin: 10px auto;
padding: 5px 10px;
text-align: center;
border: 1px solid #ccc;
}
.flbox{
overflow hidden
}
.lesm{
height 30px
line-height 30px
background #f0f0f0
padding-left 1px
}
</style>