faceTable.vue
4.95 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
<template>
<div>
<el-table :data="tableData" style="width: 98%;margin:0 auto;" v-loading.body="loading">
<el-table-column label="序号" type="index" width="120"></el-table-column>
<el-table-column label="姓名" property="name" type="name" width="180"></el-table-column>
<el-table-column label="性别" property="sex" :formatter="setSex" width="180"></el-table-column>
<el-table-column label="出生日期" property="birthday" :formatter="setBirthday"> </el-table-column>
<el-table-column label="身份证号" property="card_id"></el-table-column>
<el-table-column label="籍贯" property="provence" :formatter="setCity">
</el-table-column>
<el-table-column label="操作" width="300px" align="center">
<template slot-scope="scope">
<div class="tab-btn-box">
<span class="table-btn" size="" @click="handleSee(scope.$index, scope.row)">查看详情</span>
<span class="table-btn" size="" @click="handleEdit(scope.$index, scope.row)">编辑人像</span>
<span class="table-btn dengers" size="" @click="handleDelete(scope.$index, scope.row)">删除</span>
</div>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination class="pages" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="currentPage"
:page-size="limit" layout="total,prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
<div>
<faceDetail :facedata="curData" :detaildialong="detaildialong" @closedialong="closedetail"></faceDetail>
</div>
</div>
</template>
<script>
import faceDetail from './faceDetail'
export default {
data() {
return {
tableData: [],
currentPage: 1,
limit: 20,
total: 0,
offset: 0,
loading: true,
provenceName: "",
cityName: "",
detaildialong: false,
curData: '',
cData: '',
};
},
props: {
dbname: {
//库名称
type: String
},
facename: {
//姓名
type: String
},
facesex: {
//性别
type: String
},
facecardid: {
//身份证号
},
communityunid: {
//地区id
}
},
methods: {
closedetail() {
this.detaildialong = false;
},
handleSee(index, row) {
this.detaildialong = true;
this.curData = row;
},
handleEdit(index, row) {
this.$emit("edit", index, row);
},
handleDelete(index, row) {
var Vthis = this;
var Athis = "";
var a = this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
Athis = this;
Vthis.axios
.delete(FACEWEB + "/faces/" + row.unid, {
is_active: false
})
.then(function (response) {
Vthis.initTable();
Athis.$message({
type: "success",
message: "删除成功!"
});
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除"
});
});
},
setCity(row, column, cellValue) {
return this.showCity(row.province, row.city)
},
setSex(row, column, cellValue) {
var sex = "";
if (cellValue == "1") sex = "男";
if (cellValue == "2") sex = "女";
return sex;
},
setBirthday(row, column, cellValue) {
var data = "";
if (cellValue) data = cellValue.split(" ")[0];
return data;
},
handleSizeChange(val) {
alert(val);
},
handleCurrentChange(val) {
this.offset = (val - 1) * this.limit;
this.initTable();
},
initTable() {
var Vthis = this;
this.axios
.get(FACEWEB + "/faces/crucial_faces", {
params: {
offset: Vthis.offset,
limit: this.limit,
is_crucial: true,
is_active: true,
sex: Vthis.facesex,
name__like: Vthis.facename,
card_id__like: Vthis.facecardid,
crucial_type: Vthis.dbname,
resident_unids: this.communityunid,
}
}).then(function (response) {
Vthis.tableData = response.data.list_data;
Vthis.total = response.data.total_num;
Vthis.loading = false;
});
}
},
components: {
faceDetail
},
computed: {},
created() {
this.initTable();
}
};
</script>
<style lang="stylus" scoped>
.mb20 {
margin-bottom: 50px;
}
.pages {
float: right;
margin: 20px 15px 30px 0;
}
</style>