algo_tem[late_back.vue
4.82 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
<template>
<div class="innnerBox">
<el-col :span="22">
<el-form ref="form" label-width="80px" inline>
<el-form-item label="模板类型">
<span class="selectBox">
<el-select v-model="algoSet" placeholder="请选择算法类型" @change="refreshAlgo" class="algo-header-left">
<el-option value="picture" label="图片模板"></el-option>
<el-option value="video" label="视频模板"></el-option>
</el-select>
</span>
</el-form-item>
</el-form>
</el-col>
<el-col :span="2">
<el-button class="" type="primary" @click="createTpl">添加</el-button>
<el-button class="mt10" @click="refreshAlgo">刷新</el-button>
</el-col>
<div class="table-box mt10" >
<el-table :data="tableData" tooltip-effect="dark" ref="multipleTable" height="700" style="width: 100%" @selection-change="handleSelectionChange" v-loading="loading">
<el-table-column type="index" width="55">
</el-table-column>
<el-table-column prop="unid" align="center" label="模板编号">
</el-table-column>
<el-table-column prop="name" align="center" label="模板编号">
</el-table-column>
<el-table-column align="center" label="模板类型">
<template slot-scope="scope">
<div>
{{filterAlgoName(scope.row.cate) ? filterAlgoName(scope.row.cate) : '无'}}
</div>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间">
<template slot-scope="scope">
<div>
{{scope.row.create_dt ? scope.row.create_dt : '无'}}
</div>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<div>
<span class="det-btn" @click="tpdetail(scope.row)">详情</span>
<span class="del-btn" @click="deltem(scope.row)">删除</span>
</div>
</template>
</el-table-column>
</el-table>
<div>
<el-pagination style="float: right;" class="mt10" @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="search.currentPage" :page-sizes="[20,100, 200, 300, 400]" :page-size="search.size"
layout="total, sizes, prev, pager, next, jumper" :total="search.total">
</el-pagination>
</div>
</div>
<div>
<addTemplate ref="addtpl"></addTemplate>
</div>
<div>
<tplDetails :tplData="tplData" ref="tpldetail"></tplDetails>
</div>
</div>
</template>
<script>
import tplDetails from "./temDetail";
import addTemplate from "./addTpl";
export default {
data() {
return {
algoSet: 'picture',
addalgoSet:'video',
tableData: [],
isShow: false,
details: [],
fileList:[],
tplData:[],
search:{
size:20,
limit:20,
offset:0,
currentPage:0,
total:0
}
}
},
components: {
tplDetails,
addTemplate,
},
methods: {
handlePreview(){},
submitUpload() {
this.$refs.upload.submit();
},
addalgomanage(){
this.isShow = true;
},
handleSelectionChange(){
this.refreshAlgo();
},
refreshAlgo() {
this.getData();
this.search.offset = 0;
this.search.currentPage = 1;
},
getData() {
this.loading = true
this.$api.device.combs(
{
offset: 0,
limit: 20,
algo_set: this.algoSet
}).then(m => {
this.tableData = m.list_data;
this.search.total = m.total_num
this.loading = false
})
},
handleSizeChange(val){
this.search.limit = val
this.getData()
},
handleCurrentChange(val){
this.search.currentPage = val;
this.search.offset = (val-1)*this.search.size
this.getData()
},
filterAlgoName: function (str) {
var zhType = '';
switch (str) {
case 'traffic':
zhType ='交通';
break;
case 'Safety':
zhType ='安防';
break;
case 'FlowCount':
zhType ='客流';
break;
default:
break;
}
return zhType;
},
createTpl: function () {
this.$refs.addtpl.tplInit(this.templateType);
},
tpdetail(data){
this.tplData = data
setTimeout(()=>{
this.$refs.tpldetail.init();
},0)
},
},
created() {
this.getData()
},
}
</script>
<style lang="stylus" scoped>
.search-item{
overflow hidden
}
.det-btn{
padding 0 10px
color #409EFF
cursor pointer
}
.del-btn{
padding 0 10px
color #F56C6C
cursor pointer
}
</style>