algo_template.vue
5.17 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
<template>
<div class="innnerBox">
<el-col :span="22">
<el-form ref="form" label-width="80px" inline>
<el-form-item label="模板名称">
<span class="selectBox">
<el-input v-model="algoname" placeholder="模板名称" class="algo-header-left"></el-input>
</span>
</el-form-item>
<el-form-item label="业务类型">
<span class="selectBox">
<el-select v-model="algoSet" placeholder="业务类型" class="algo-header-left">
<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>
</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">
<el-table-column type="index" width="55">
</el-table-column>
<el-table-column prop="tid" align="center" label="模板编号">
</el-table-column>
<el-table-column prop="tplname" align="center" label="模板名称">
</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.$index, tableData)">删除</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" @refresh="getData"></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: '',
addalgoSet:'video',
tableData: [],
algoname:'',
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() {
let LtableData = localStorage.getItem("tplData");
if(LtableData) {
this.tableData = JSON.parse(LtableData)
} else {
this.tableData = [];
// localStorage.setItem("tplData", JSON.stringify( this.tableData));
}
},
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){
setTimeout(()=>{
this.$refs.addtpl.editInit(data);
},0)
},
deltem(index, rows){
rows.splice(index, 1);
localStorage.setItem("tplData", JSON.stringify( this.tableData))
}
},
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>