|
|
|
@ -51,8 +51,8 @@ |
|
|
|
<el-form-item label="姓名" prop="personName"> |
|
|
|
<el-input v-model="form.personName" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="身份证号" prop="idcard"> |
|
|
|
<el-input v-model="form.idcard" placeholder="请输入" /> |
|
|
|
<el-form-item label="身份证号" prop="idCard"> |
|
|
|
<el-input v-model="form.idCard" placeholder="请输入" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="联系方式" prop="phone"> |
|
|
|
<el-input v-model="form.phone" placeholder="请输入" /> |
|
|
|
@ -89,25 +89,42 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
<el-table ref="table" v-loading="crud.loading" highlight-current-row style="width: 100%;" height="calc(100vh - 330px)" :data="crud.data" @selection-change="crud.selectionChangeHandler"> |
|
|
|
<el-table ref="table" v-loading="crud.loading" highlight-current-row style="width: 100%;" height="calc(100vh - 330px)" :data="crud.data" @selection-change="crud.selectionChangeHandler" @row-click="clickRowHandler"> |
|
|
|
<el-table-column type="selection" align="center" width="55" /> |
|
|
|
<el-table-column type="index" label="序号" width="55" /> |
|
|
|
<el-table-column prop="personName" label="姓名" /> |
|
|
|
<el-table-column prop="code" label="性别" /> |
|
|
|
<el-table-column prop="personSex" label="性别" width="60"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span>{{ scope.row.personSex === 1 ? '男' : '女' }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="barcode" label="读者证号" /> |
|
|
|
<el-table-column prop="idcard" label="身份证号" /> |
|
|
|
<el-table-column prop="libcode" label="馆代码" /> |
|
|
|
<el-table-column prop="columnOrders" label="已存照片" align="center" /> |
|
|
|
<el-table-column prop="columnOrders" label="用户类型" align="center" /> |
|
|
|
<el-table-column prop="idCard" label="身份证号" /> |
|
|
|
<el-table-column prop="libcode" label="馆代码" width="100" /> |
|
|
|
<el-table-column prop="personPhotoUrl" label="已存照片" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<!-- <img v-if="scope.row.personPhotoUrl === '' || scope.row.personPhotoUrl === null" src="~@/assets/images/cover-bg.png" alt="" style="display:block; height: 60px;"> |
|
|
|
<img v-else :src="baseApi + '/api/fileRelevant/getFaceImg?imgId=' + scope.row.personPhotoUrl" alt="" style="display:block; height: 60px;"> --> |
|
|
|
<span v-if="scope.row.personPhotoUrl === '' || scope.row.personPhotoUrl === null">否</span> |
|
|
|
<span v-else>是</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="personType" label="用户类型" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-tag v-if="scope.row.personType === 0">普通用户</el-tag> |
|
|
|
<el-tag v-if="scope.row.personType === 1" type="success">VIP用户</el-tag> |
|
|
|
<el-tag v-if="scope.row.personType === 2" type="info">黑名单用户</el-tag> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" align="center" prop="columnStatus" width="240"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button size="mini" style="padding: 5px;" @click="addBlackOrVipUser(scope.row,0)"> |
|
|
|
<el-button :class="scope.row.personType === 2 ? 'remove-black-btn' : ''" size="mini" style="padding: 5px;" @click="addBlackOrVipUser(scope.row,0)"> |
|
|
|
<i class="iconfont icon-heimingdan" /> |
|
|
|
加入黑名单 |
|
|
|
{{ scope.row.personType === 2 ? '移出黑名单' : '加入黑名单' }} |
|
|
|
</el-button> |
|
|
|
<el-button size="mini" style="padding: 5px;" @click="addBlackOrVipUser(scope.row,1)"> |
|
|
|
<el-button :class="scope.row.personType === 1 ? 'remove-vip-btn' : ''" size="mini" style="padding: 5px;" @click="addBlackOrVipUser(scope.row,1)"> |
|
|
|
<i class="iconfont icon-yooxi" /> |
|
|
|
加入VIP |
|
|
|
{{ scope.row.personType === 1 ? '移出VIP' : '加入VIP' }} |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
@ -117,12 +134,12 @@ |
|
|
|
|
|
|
|
<FaceSearch ref="faceSearchRefs" /> |
|
|
|
<SelfRegister ref="selfRegisterRefs" /> |
|
|
|
<BatchImport ref="batchImportRefs" /> |
|
|
|
<BatchImport ref="batchImportRefs" @refresh="updatePerson" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import crudFace from '@/api/faceRecognition/index' |
|
|
|
import crudFace, { FetchPersonInfoById, FetchChangePersonInfo } from '@/api/faceRecognition/index' |
|
|
|
import CRUD, { presenter, header, form, crud } from '@crud/crud' |
|
|
|
import rrOperation from '@crud/RR.operation' |
|
|
|
import crudOperation from '@crud/CRUD.operation' |
|
|
|
@ -135,12 +152,12 @@ import BatchImport from './module/batchImport' |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
import { upload } from '@/utils/upload' |
|
|
|
|
|
|
|
const defaultForm = { personId: null, libcode: null, barcode: null, personName: null, personPhotoUrl: null, idcard: null, phone: null, personSex: 1, personType: 0, personPhotoBase64: null } |
|
|
|
const defaultForm = { personId: null, libcode: null, barcode: null, personName: null, personPhotoUrl: null, idCard: null, phone: null, personSex: 1, personType: 0, personPhotoBase64: null } |
|
|
|
export default { |
|
|
|
name: 'PersonInfoManage', |
|
|
|
components: { pagination, crudOperation, rrOperation, FaceSearch, SelfRegister, BatchImport }, |
|
|
|
cruds() { |
|
|
|
return CRUD({ title: '人员信息', url: 'api/person/initPersonInfo', crudMethod: { ...crudFace }, optShow: { |
|
|
|
return CRUD({ title: '人员信息', idField: 'personId', url: 'api/person/initPersonInfo', crudMethod: { ...crudFace }, optShow: { |
|
|
|
add: true, |
|
|
|
edit: true, |
|
|
|
del: false, |
|
|
|
@ -193,6 +210,9 @@ export default { |
|
|
|
mounted() { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
updatePerson() { |
|
|
|
this.crud.refresh() |
|
|
|
}, |
|
|
|
[CRUD.HOOK.beforeRefresh]() { |
|
|
|
this.crud.query.libcode = this.user.fonds.fondsNo |
|
|
|
}, |
|
|
|
@ -207,6 +227,33 @@ export default { |
|
|
|
}, |
|
|
|
// 编辑前 |
|
|
|
[CRUD.HOOK.beforeToEdit](crud, form) { |
|
|
|
this.imageUrl = null |
|
|
|
const params = { |
|
|
|
'id': form.personId |
|
|
|
} |
|
|
|
FetchPersonInfoById(params).then(res => { |
|
|
|
if (res) { |
|
|
|
// crud.form = { ...crud.form, ...res } |
|
|
|
|
|
|
|
Object.keys(crud.form).forEach(key => { |
|
|
|
this.$set(crud.form, key, null) |
|
|
|
}) |
|
|
|
|
|
|
|
Object.keys(res).forEach(key => { |
|
|
|
this.$set(crud.form, key, res[key]) |
|
|
|
}) |
|
|
|
if (this.form.personPhotoUrl) { |
|
|
|
this.imageUrl = this.baseApi + '/api/fileRelevant/getFaceImg?imgId=' + this.form.personPhotoUrl |
|
|
|
} else { |
|
|
|
this.imageUrl = require('@/assets/images/user.jpg') |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.$message({ message: '获取数据失败', type: 'error', offset: 8 }) |
|
|
|
} |
|
|
|
}).catch((err) => { |
|
|
|
this.$message({ message: '获取数据失败', type: 'error', offset: 8 }) |
|
|
|
console.error(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 提交前做的操作 |
|
|
|
[CRUD.HOOK.afterValidateCU](crud) { |
|
|
|
@ -256,35 +303,47 @@ export default { |
|
|
|
this.crud.delAllLoading = true |
|
|
|
const ids = [] |
|
|
|
datas.forEach(val => { |
|
|
|
ids.push(val.fondsId) |
|
|
|
ids.push(val.personId) |
|
|
|
}) |
|
|
|
crudFace.del(ids).then(() => { |
|
|
|
this.$message({ message: '删除成功', type: 'success', offset: 8 }) |
|
|
|
this.crud.delAllLoading = false |
|
|
|
this.crud.refresh() |
|
|
|
}).catch(err => { |
|
|
|
this.crud.delAllLoading = false |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
// crudColumn.del(ids).then(() => { |
|
|
|
// this.$message({ message: '删除成功', type: 'success', offset: 8 }) |
|
|
|
// this.crud.delAllLoading = false |
|
|
|
// this.crud.refresh() |
|
|
|
// }).catch(err => { |
|
|
|
// this.crud.delAllLoading = false |
|
|
|
// console.log(err) |
|
|
|
// }) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
addBlackOrVipUser(data, type) { |
|
|
|
const message = type === 1 ? 'VIP' : '黑名单' |
|
|
|
this.$confirm('此操作将所选用户加入' + message + '<span>你是否还要继续?</span>', '提示', { |
|
|
|
this.$confirm('此操作将所选用户加入 / 移出 ' + message + '<span>你是否还要继续?</span>', '提示', { |
|
|
|
confirmButtonText: '继续', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning', |
|
|
|
dangerouslyUseHTMLString: true |
|
|
|
}).then(() => { |
|
|
|
// crudColumn.FetchUpdateFondsStatus(data).then(res => { |
|
|
|
// this.$message({ message: '修改成功', type: 'success', offset: 8 }) |
|
|
|
// }).catch(() => { |
|
|
|
// data.fondsStatus = !data.fondsStatus |
|
|
|
// }) |
|
|
|
if (data.personType === 0 && type === 1) { |
|
|
|
data.personType = 1 |
|
|
|
} else if (data.personType === 0 && type === 0) { |
|
|
|
data.personType = 2 |
|
|
|
} else if (data.personType === 1 && type === 1) { |
|
|
|
data.personType = 0 |
|
|
|
} else if (data.personType === 1 && type === 0) { |
|
|
|
data.personType = 2 |
|
|
|
} else if (data.personType === 2 && type === 1) { |
|
|
|
data.personType = 1 |
|
|
|
} else if (data.personType === 2 && type === 0) { |
|
|
|
data.personType = 0 |
|
|
|
} |
|
|
|
FetchChangePersonInfo(data).then(res => { |
|
|
|
this.$message({ message: '修改成功', type: 'success', offset: 8 }) |
|
|
|
}).catch(() => { |
|
|
|
this.$message({ message: '修改失败', type: 'error', offset: 8 }) |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
this.$message({ message: '已取消修改', offset: 8 }) |
|
|
|
// data.fondsStatus = data.fondsStatus ? 0 : 1 |
|
|
|
}) |
|
|
|
}, |
|
|
|
getBase64(file) { |
|
|
|
@ -307,6 +366,10 @@ export default { |
|
|
|
resolve({ width, height }) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
clickRowHandler(row) { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.toggleRowSelection(row) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -334,4 +397,28 @@ export default { |
|
|
|
margin: 20px 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
::v-deep .el-tag{ |
|
|
|
&.el-tag--small{ |
|
|
|
color: #0348f3 !important; |
|
|
|
background-color: #eef5fe !important; |
|
|
|
border-color: #eef5fe !important; |
|
|
|
} |
|
|
|
&.el-tag--success { |
|
|
|
background-color: #e7faf0 !important; |
|
|
|
border-color: #d0f5e0!important; |
|
|
|
color: #13ce66!important; |
|
|
|
} |
|
|
|
&.el-tag--info { |
|
|
|
background-color: #f4f4f5 !important; |
|
|
|
border-color: #f4f4f5!important; |
|
|
|
color: #909399!important; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.remove-black-btn, |
|
|
|
.remove-vip-btn{ |
|
|
|
border-color: #909399; |
|
|
|
color: #909399; |
|
|
|
} |
|
|
|
</style> |