Browse Source

人脸更新

master
xuhuajiao 2 days ago
parent
commit
8adbc259b7
  1. 39
      src/views/system/user/index.vue

39
src/views/system/user/index.vue

@ -127,15 +127,15 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="right-user-img"> <div class="right-user-img">
<!-- <img src="http://172.17.162.10:15000/api/minio/getImg?bucket=4&fileName=b89ea010-56fd-492c-a6d7-f4cb317116cb" alt="人员照片"> -->
<!-- <img src="http://172.17.162.10:15000/api/minio/getImg?bucket=4&fileName=43321071-5f90-4c9a-9337-26dcd0ab7d02.bmp" alt="人员照片"> -->
<img :src="imageUrl || require('@/assets/images/user.jpg')" alt="人员照片"> <img :src="imageUrl || require('@/assets/images/user.jpg')" alt="人员照片">
<div style="display: flex; flex-direction: column; align-items: center; "> <div style="display: flex; flex-direction: column; align-items: center; ">
<el-button v-if="!hasBindFaceDb" size="small" type="primary" :loading="autoGetLoading" style="margin: 10px 0 !important;" @click="autoGetFaceUsers">
<el-button v-if="!hasBindFaceDb" size="small" type="primary" :loading="autoGetLoading" style="margin: 10px 0 0 0 !important;" @click="autoGetFaceUsers">
<i class="iconfont icon-zidonggengxin" style="font-size: 14px !important;" /> <i class="iconfont icon-zidonggengxin" style="font-size: 14px !important;" />
{{ crud.status.edit === 1 && form.facetBarcode !== null ? '重新获取' : '手动获取' }} {{ crud.status.edit === 1 && form.facetBarcode !== null ? '重新获取' : '手动获取' }}
</el-button> </el-button>
<!-- 新增清除按钮 --> <!-- 新增清除按钮 -->
<el-button v-if="form.facetBarcode" size="small" style="margin: 0 !important; background-color: rgb(246, 81, 99); border-color: rgb(246, 81, 99); color: rgb(255, 255, 255);" @click="clearFaceInfo">
<el-button v-if="form.facetBarcode" size="small" style="margin: 10px 0 0 0 !important; background-color: rgb(246, 81, 99); border-color: rgb(246, 81, 99); color: rgb(255, 255, 255);" @click="clearFaceInfo">
<i class="iconfont icon-shanchu" style="font-size:14px" /> <i class="iconfont icon-shanchu" style="font-size:14px" />
{{ hasBindFaceDb ? '解绑人脸' : '清除人脸' }} {{ hasBindFaceDb ? '解绑人脸' : '清除人脸' }}
</el-button> </el-button>
@ -170,11 +170,7 @@
:class="{active: tempSelectFace?.guid === item.guid}" :class="{active: tempSelectFace?.guid === item.guid}"
@click="tempSelectFace = item" @click="tempSelectFace = item"
> >
<img
:src="baseApi + '/api/minio/getImg?bucket=2&fileName=' + item.guid"
alt="人脸照片"
class="face-img"
>
<img :src="getMinioImgUrl(item.guid)" alt="人脸照片" class="face-img">
<div class="face-info"> <div class="face-info">
<div class="face-name">{{ item.name }}</div> <div class="face-name">{{ item.name }}</div>
<div class="face-barcode">{{ item.barcode }}</div> <div class="face-barcode">{{ item.barcode }}</div>
@ -279,6 +275,7 @@ export default {
} }
} }
return { return {
linkSrc: window.g.ApiUrl,
headers: { headers: {
Authorization: getToken() Authorization: getToken()
}, },
@ -357,7 +354,7 @@ export default {
toSyncUser() { toSyncUser() {
this.syncLoading = true this.syncLoading = true
FetchSyncUser().then((res) => { FetchSyncUser().then((res) => {
console.log('res', res)
console.log('同步用户数据res', res)
if (res.code !== null) { if (res.code !== null) {
this.$message({ message: '同步用户数据成功', type: 'success', offset: 8 }) this.$message({ message: '同步用户数据成功', type: 'success', offset: 8 })
this.crud.toQuery() this.crud.toQuery()
@ -374,7 +371,7 @@ export default {
toSyncFace() { toSyncFace() {
this.syncFaceLoading = true this.syncFaceLoading = true
FetchSyncUserFace().then((res) => { FetchSyncUserFace().then((res) => {
console.log('res', res)
console.log('自动绑定人脸数据res', res)
if (res) { if (res) {
this.$message({ message: res.message, type: 'success', offset: 8 }) this.$message({ message: res.message, type: 'success', offset: 8 })
this.crud.toQuery() this.crud.toQuery()
@ -399,15 +396,14 @@ export default {
}, },
// //
handleDeptChange(val) { handleDeptChange(val) {
console.log('val', val)
this.selectedDeptInfo = val this.selectedDeptInfo = val
this.form.departmentid = val ? val.deptsId : null this.form.departmentid = val ? val.deptsId : null
}, },
// deptsId // deptsId
findDeptObjById(deptsId) { findDeptObjById(deptsId) {
if (!deptsId) return null if (!deptsId) return null
console.log('deptsId', deptsId)
console.log(' this.deptGroupOptions', this.deptGroupOptions)
// console.log('deptsId', deptsId)
// console.log(' this.deptGroupOptions', this.deptGroupOptions)
const group = this.deptGroupOptions.find(g => g.options.some(o => o.deptsId === deptsId)) const group = this.deptGroupOptions.find(g => g.options.some(o => o.deptsId === deptsId))
console.log('group', group) console.log('group', group)
for (const group of this.deptGroupOptions) { for (const group of this.deptGroupOptions) {
@ -488,8 +484,7 @@ export default {
this.hasBindFaceDb = !!form.facePhoto && !!form.facetBarcode this.hasBindFaceDb = !!form.facePhoto && !!form.facetBarcode
if (form.facePhoto) { if (form.facePhoto) {
const linkSrc = window.g.ApiUrl
this.imageUrl = linkSrc + '/api/minio/getImg?bucket=4&fileName=' + form.facePhoto + '.bmp'
this.imageUrl = this.getMinioImgUrl(form.facePhoto)
} else { } else {
this.imageUrl = null this.imageUrl = null
} }
@ -511,7 +506,7 @@ export default {
} }
userRoles = [...this.roleDatas] userRoles = [...this.roleDatas]
console.log('角色回显处理完成:', this.roleDatas)
// console.log('', this.roleDatas)
}).catch(() => { }).catch(() => {
this.roleDatas = [] this.roleDatas = []
userRoles = [] userRoles = []
@ -525,8 +520,8 @@ export default {
this.$message({ message: '角色不能为空', type: 'warning', offset: 8 }) this.$message({ message: '角色不能为空', type: 'warning', offset: 8 })
return false return false
} }
console.log('this.selectedDeptInfo', this.selectedDeptInfo)
console.log('crud.form.departmentid', crud.form.departmentid)
// console.log('this.selectedDeptInfo', this.selectedDeptInfo)
// console.log('crud.form.departmentid', crud.form.departmentid)
// //
if (this.selectedDeptInfo) { if (this.selectedDeptInfo) {
crud.form.departmentid = this.selectedDeptInfo.internalId crud.form.departmentid = this.selectedDeptInfo.internalId
@ -860,9 +855,8 @@ export default {
this.form.lastname = userInfo.name this.form.lastname = userInfo.name
} }
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API // const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
const linkSrc = window.g.ApiUrl
if (userInfo.guid) { if (userInfo.guid) {
this.imageUrl = linkSrc + '/api/minio/getImg?bucket=4&fileName=' + userInfo.guid + '.bmp'
this.imageUrl = this.getMinioImgUrl(userInfo.guid)
// this.imageUrl = 'http://172.17.162.10:15000/api/minio/getImg?bucket=4&fileName=b89ea010-56fd-492c-a6d7-f4cb317116cb.bmp' // this.imageUrl = 'http://172.17.162.10:15000/api/minio/getImg?bucket=4&fileName=b89ea010-56fd-492c-a6d7-f4cb317116cb.bmp'
} else { } else {
this.imageUrl = null this.imageUrl = null
@ -893,6 +887,11 @@ export default {
this.form.facePhoto = null this.form.facePhoto = null
this.imageUrl = null this.imageUrl = null
} }
},
// minio
getMinioImgUrl(fileName) {
if (!fileName) return ''
return `${this.linkSrc}/api/minio/getImg?bucket=4&fileName=${fileName}.bmp`
} }
} }
} }

Loading…
Cancel
Save