|
@@ -0,0 +1,95 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div style="margin-bottom:15px;">
|
|
|
+ <el-input v-model="searchKey" placeholder="输入人脸ID或人员ID搜索" style="width:250px;margin-right:10px;" />
|
|
|
+ <el-button type="primary" @click="search">搜索</el-button>
|
|
|
+ <el-button type="success" @click="openAddDialog">新增人脸</el-button>
|
|
|
+ <el-button type="warning" @click="collect">采集人脸</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-table :data="filteredList">
|
|
|
+ <el-table-column prop="faceId" label="人脸ID" min-width="120" />
|
|
|
+ <el-table-column prop="employeeNo" label="人员ID" min-width="120" />
|
|
|
+ <el-table-column label="照片" min-width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-image :src="scope.row.img" style="width:60px;height:60px" fit="cover"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="200">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button size="mini" @click="openEditDialog(scope.row)">编辑</el-button>
|
|
|
+ <el-button size="mini" type="danger" @click="deleteFace(scope.row.faceId)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div style="margin-top:10px;">人脸总数:{{ faceList.length }}</div>
|
|
|
+
|
|
|
+ <el-dialog :visible.sync="dialogVisible" :title="isEdit?'编辑人脸':'新增人脸'">
|
|
|
+ <el-form :model="form" label-width="80px">
|
|
|
+ <el-form-item label="人脸ID"><el-input v-model="form.faceId" /></el-form-item>
|
|
|
+ <el-form-item label="人员ID"><el-input v-model="form.employeeNo" /></el-form-item>
|
|
|
+ <el-form-item label="照片">
|
|
|
+ <el-upload action="#" :auto-upload="false" :on-change="handleUpload">
|
|
|
+ <el-button size="small" type="primary">上传图片</el-button>
|
|
|
+ </el-upload>
|
|
|
+ <el-image v-if="form.img" :src="form.img" style="width:80px;height:80px;margin-top:5px"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer">
|
|
|
+ <el-button @click="dialogVisible=false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="saveFace">保存</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "Face",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ searchKey:"",
|
|
|
+ dialogVisible:false,
|
|
|
+ isEdit:false,
|
|
|
+ form:{},
|
|
|
+ faceList:[
|
|
|
+ { faceId:"IMG001", employeeNo:"1001", img:"https://via.placeholder.com/60" },
|
|
|
+ { faceId:"IMG002", employeeNo:"1002", img:"https://via.placeholder.com/60" }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ filteredList(){
|
|
|
+ if(!this.searchKey) return this.faceList
|
|
|
+ return this.faceList.filter(f=>
|
|
|
+ f.faceId.includes(this.searchKey) || f.employeeNo.includes(this.searchKey)
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ search(){ this.$message.success("搜索完成(模拟)") },
|
|
|
+ openAddDialog(){ this.isEdit=false; this.form={}; this.dialogVisible=true },
|
|
|
+ openEditDialog(row){ this.isEdit=true; this.form={...row}; this.dialogVisible=true },
|
|
|
+ saveFace(){
|
|
|
+ if(this.isEdit){
|
|
|
+ let idx=this.faceList.findIndex(f=>f.faceId===this.form.faceId)
|
|
|
+ this.faceList.splice(idx,1,this.form)
|
|
|
+ } else {
|
|
|
+ this.faceList.push({...this.form})
|
|
|
+ }
|
|
|
+ this.dialogVisible=false
|
|
|
+ this.$message.success("保存成功(模拟)")
|
|
|
+ },
|
|
|
+ deleteFace(id){
|
|
|
+ this.faceList=this.faceList.filter(f=>f.faceId!==id)
|
|
|
+ this.$message.error("已删除 人脸ID="+id)
|
|
|
+ },
|
|
|
+ collect(){
|
|
|
+ this.$message.success("人脸采集成功(模拟)")
|
|
|
+ },
|
|
|
+ handleUpload(file){
|
|
|
+ this.form.img=URL.createObjectURL(file.raw)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|