diff --git a/src/api/community/memberhouse/index.ts b/src/api/community/memberhouse/index.ts
index a965497..cf9909b 100644
--- a/src/api/community/memberhouse/index.ts
+++ b/src/api/community/memberhouse/index.ts
@@ -11,7 +11,7 @@ export interface MemberHouse {
buildingNo: string; // 楼号
unitNo: string; // 单元号
roomNo: string; // 门牌号
- isOwner?: number; // 是否产权人(0-否,1-是)
+ isOwner?: boolean; // 是否产权人(false-否,true-是)
relationType: string; // 与产权人关系
name: string; // 姓名
mobile: string; // 手机号
@@ -20,8 +20,11 @@ export interface MemberHouse {
sex: number; // 性别(0-未知,1-男,2-女)
birthday: string | Dayjs; // 出生日期
attachmentUrl: string; // 附件URL
+ facePhotoUrl: string; // 人脸照片URL
status?: number; // 认证状态(0-待审核,1-已认证,2-驳回)
rejectReason: string; // 驳回原因
+ auditorName: string; // 审核人
+ auditTime: string | Dayjs; // 审核时间
}
// 业主认证信息 API
@@ -59,5 +62,10 @@ export const MemberHouseApi = {
// 导出业主认证信息 Excel
exportMemberHouse: async (params) => {
return await request.download({ url: `/community/member-house/export-excel`, params })
+ },
+
+ // 审核业主认证
+ auditMemberHouse: async (data: { id: number; status: number; rejectReason?: string }) => {
+ return await request.put({ url: `/community/member-house/audit`, data })
}
-}
\ No newline at end of file
+}
diff --git a/src/views/community/memberhouse/AuditDialog.vue b/src/views/community/memberhouse/AuditDialog.vue
index 849f559..96d6f8e 100644
--- a/src/views/community/memberhouse/AuditDialog.vue
+++ b/src/views/community/memberhouse/AuditDialog.vue
@@ -11,25 +11,25 @@
-
+
暂无照片
-
-
+
+
通过
驳回
-
+
import { MemberHouseApi, MemberHouse } from '@/api/community/memberhouse'
+import { createImageViewer } from '@/components/ImageViewer'
defineOptions({ name: 'AuditDialog' })
@@ -66,16 +67,11 @@ const formData = ref({
buildingNo: '',
unitNo: '',
roomNo: '',
- attachmentUrl: '',
- auditStatus: 1,
+ facePhotoUrl: '',
+ status: 1,
rejectReason: ''
})
-const formRules = reactive({
- auditStatus: [{ required: true, message: '请选择审核结果', trigger: 'change' }],
- rejectReason: [{ required: true, message: '请输入驳回原因', trigger: 'blur' }]
-})
-
const open = (row: MemberHouse) => {
dialogVisible.value = true
formData.value = {
@@ -86,8 +82,8 @@ const open = (row: MemberHouse) => {
buildingNo: row.buildingNo,
unitNo: row.unitNo,
roomNo: row.roomNo,
- attachmentUrl: row.attachmentUrl,
- auditStatus: 1,
+ facePhotoUrl: row.facePhotoUrl,
+ status: 1,
rejectReason: ''
}
}
@@ -95,18 +91,18 @@ const open = (row: MemberHouse) => {
defineExpose({ open })
const submitAudit = async () => {
- if (formData.value.auditStatus === 2 && !formData.value.rejectReason) {
+ if (formData.value.status === 2 && !formData.value.rejectReason) {
message.error('请输入驳回原因')
return
}
formLoading.value = true
try {
- await MemberHouseApi.updateMemberHouse({
+ await MemberHouseApi.auditMemberHouse({
id: formData.value.id!,
- status: formData.value.auditStatus,
+ status: formData.value.status,
rejectReason: formData.value.rejectReason
- } as MemberHouse)
+ })
message.success('审核成功')
dialogVisible.value = false
@@ -115,4 +111,14 @@ const submitAudit = async () => {
formLoading.value = false
}
}
+
+/** 预览图片 */
+const handlePreviewImage = (url: string) => {
+ createImageViewer({
+ urlList: [url],
+ zIndex: 3000,
+ hideOnClickModal: true,
+ teleported: true
+ })
+}
diff --git a/src/views/community/memberhouse/MemberHouseForm.vue b/src/views/community/memberhouse/MemberHouseForm.vue
index f8c479b..13beaff 100644
--- a/src/views/community/memberhouse/MemberHouseForm.vue
+++ b/src/views/community/memberhouse/MemberHouseForm.vue
@@ -17,6 +17,7 @@
filterable
style="width: 100%"
@change="handleCommunityChange"
+ :disabled="readonlyMode"
>
@@ -86,7 +90,7 @@
-
+
-
+
-
+
-
+
@@ -127,7 +131,7 @@
-
+
-
+
@@ -147,7 +151,7 @@
-
+
@@ -173,13 +178,13 @@
-
-
+
+
-
-
+
+
@@ -188,19 +193,20 @@
审核
-
-
-
-
-
+
+
+ 通过
+ 驳回
+
-
+
@@ -229,7 +235,8 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
-const formType = ref('') // 表单的类型:create - 新增;update - 修改
+const formType = ref('') // 表单的类型:create - 新增;update - 修改;audit - 审核
+const readonlyMode = ref(false) // 是否只读模式(审核时信息部分只读)
const formData = ref({
id: undefined,
memberId: undefined,
@@ -239,7 +246,7 @@ const formData = ref({
buildingNo: '',
unitNo: '',
roomNo: '',
- isOwner: 1,
+ isOwner: true,
relationType: '',
name: '',
mobile: '',
@@ -248,11 +255,10 @@ const formData = ref({
sex: undefined,
birthday: '',
attachmentUrl: '',
- attachmentUrls: [],
+ facePhotoUrl: '',
status: 0,
rejectReason: '',
- auditStatus: undefined,
- auditUser: '',
+ auditorName: '',
auditTime: ''
})
const formRules = reactive({
@@ -271,7 +277,7 @@ const formRules = reactive({
idNumber: [{ required: true, message: '证件号码不能为空', trigger: 'blur' }],
sex: [{ required: true, message: '请选择性别', trigger: 'change' }],
birthday: [{ required: true, message: '出生日期不能为空', trigger: 'change' }],
- auditStatus: [{ required: true, message: '请选择审核意见', trigger: 'change' }]
+ status: [{ required: true, message: '请选择审核结果', trigger: 'change' }]
})
const formRef = ref() // 表单 Ref
const communityOptions = ref([]) // 小区选项列表
@@ -284,8 +290,8 @@ const roomOptions = ref([]) // 房间选项
const loadCommunityList = async () => {
try {
communityOptions.value = await CommunityApi.getCommunitySimpleList()
- // 默认选中第一个小区
- if (communityOptions.value.length > 0 && !formData.value.communityId) {
+ // 默认选中第一个小区(非审核模式)
+ if (communityOptions.value.length > 0 && !formData.value.communityId && formType.value !== 'audit') {
formData.value.communityId = communityOptions.value[0].id
handleCommunityChange(communityOptions.value[0].id)
}
@@ -325,7 +331,7 @@ const handleCommunityChange = async (communityId: number | undefined) => {
}
/** 楼号选择变化 */
-const handleBuildingChange = (buildingLabel: string) => {
+const handleBuildingChange = (buildingValue: string) => {
// 清空下级数据
unitOptions.value = []
roomOptions.value = []
@@ -333,8 +339,8 @@ const handleBuildingChange = (buildingLabel: string) => {
formData.value.roomNo = ''
formData.value.houseId = undefined
- if (buildingLabel) {
- const buildingNode = houseTreeOptions.value.find(n => n.label === buildingLabel)
+ if (buildingValue) {
+ const buildingNode = houseTreeOptions.value.find(n => n.value === buildingValue)
if (buildingNode?.children) {
unitOptions.value = buildingNode.children
}
@@ -342,14 +348,14 @@ const handleBuildingChange = (buildingLabel: string) => {
}
/** 单元号选择变化 */
-const handleUnitChange = (unitLabel: string) => {
+const handleUnitChange = (unitValue: string) => {
// 清空下级数据
roomOptions.value = []
formData.value.roomNo = ''
formData.value.houseId = undefined
- if (unitLabel) {
- const unitNode = unitOptions.value.find(n => n.label === unitLabel)
+ if (unitValue) {
+ const unitNode = unitOptions.value.find(n => n.value === unitValue)
if (unitNode?.children) {
roomOptions.value = unitNode.children
}
@@ -357,9 +363,9 @@ const handleUnitChange = (unitLabel: string) => {
}
/** 门牌号选择变化 */
-const handleRoomChange = (roomLabel: string) => {
- if (roomLabel) {
- const roomNode = roomOptions.value.find(n => n.label === roomLabel)
+const handleRoomChange = (roomValue: string) => {
+ if (roomValue) {
+ const roomNode = roomOptions.value.find(n => n.value === roomValue)
if (roomNode) {
formData.value.houseId = roomNode.value
}
@@ -368,46 +374,80 @@ const handleRoomChange = (roomLabel: string) => {
}
}
+/** 根据 value 查找节点并返回显示文本 */
+const findNodeLabel = (tree: HouseTreeNode[], value: string): string => {
+ for (const node of tree) {
+ if (node.value === value) {
+ return node.label
+ }
+ if (node.children) {
+ const found = findNodeLabel(node.children, value)
+ if (found) return found
+ }
+ }
+ return value
+}
+
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
- dialogTitle.value = t('action.' + type)
formType.value = type
- resetForm()
+ readonlyMode.value = type === 'audit'
+
+ if (type === 'create') {
+ dialogTitle.value = t('action.create')
+ resetForm()
+ } else if (type === 'update') {
+ dialogTitle.value = t('action.update')
+ resetForm()
+ } else if (type === 'audit') {
+ dialogTitle.value = '审核业主认证'
+ resetForm()
+ }
+
// 加载小区列表
await loadCommunityList()
- // 修改时,设置数据
+
+ // 修改或审核时,设置数据
if (id) {
formLoading.value = true
try {
const data = await MemberHouseApi.getMemberHouse(id)
- formData.value = {
- ...formData.value,
- ...data
- }
+
// 回显房屋下拉选项
if (data.communityId) {
try {
houseTreeOptions.value = await HouseApi.getHouseTree(data.communityId)
buildingOptions.value = houseTreeOptions.value || []
- // 回显楼号
+ // 回显楼号 - 需要找到对应的 value
if (data.buildingNo) {
- const buildingNode = houseTreeOptions.value.find(n => n.label === data.buildingNo)
- if (buildingNode?.children) {
- unitOptions.value = buildingNode.children
+ const buildingLabel = data.buildingNo.replace('号楼', '')
+ const buildingNode = houseTreeOptions.value.find(n => n.label === buildingLabel)
+ if (buildingNode) {
+ formData.value.buildingNo = buildingNode.value
- // 回显单元
- if (data.unitNo) {
- const unitNode = buildingNode.children.find(n => n.label === data.unitNo)
- if (unitNode?.children) {
- roomOptions.value = unitNode.children
+ if (buildingNode.children) {
+ unitOptions.value = buildingNode.children
- // 回显房间
- if (data.roomNo) {
- const roomNode = unitNode.children.find(n => n.label === data.roomNo)
- if (roomNode) {
- formData.value.houseId = roomNode.value
+ // 回显单元
+ if (data.unitNo) {
+ const unitLabel = data.unitNo.replace('单元', '')
+ const unitNode = buildingNode.children.find(n => n.label === unitLabel)
+ if (unitNode) {
+ formData.value.unitNo = unitNode.value
+
+ if (unitNode.children) {
+ roomOptions.value = unitNode.children
+
+ // 回显房间
+ if (data.roomNo) {
+ const roomNode = unitNode.children.find(n => n.label === data.roomNo)
+ if (roomNode) {
+ formData.value.roomNo = roomNode.value
+ formData.value.houseId = roomNode.value
+ }
+ }
}
}
}
@@ -418,6 +458,12 @@ const open = async (type: string, id?: number) => {
console.error('加载房屋树失败:', error)
}
}
+
+ // 设置表单数据
+ formData.value = {
+ ...formData.value,
+ ...data
+ }
} finally {
formLoading.value = false
}
@@ -432,11 +478,21 @@ const submitForm = async () => {
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
+
// 提交请求
formLoading.value = true
try {
const data = formData.value as unknown as MemberHouse
- if (formType.value === 'create') {
+
+ if (formType.value === 'audit') {
+ // 审核模式调用审核接口
+ await MemberHouseApi.auditMemberHouse({
+ id: formData.value.id!,
+ status: formData.value.status,
+ rejectReason: formData.value.rejectReason
+ })
+ message.success('审核成功')
+ } else if (formType.value === 'create') {
await MemberHouseApi.createMemberHouse(data)
message.success(t('common.createSuccess'))
} else {
@@ -462,7 +518,7 @@ const resetForm = () => {
buildingNo: '',
unitNo: '',
roomNo: '',
- isOwner: 1,
+ isOwner: true,
relationType: '',
name: '',
mobile: '',
@@ -471,11 +527,10 @@ const resetForm = () => {
sex: undefined,
birthday: '',
attachmentUrl: '',
- attachmentUrls: [],
+ facePhotoUrl: '',
status: 0,
rejectReason: '',
- auditStatus: undefined,
- auditUser: '',
+ auditorName: '',
auditTime: ''
}
buildingOptions.value = []
diff --git a/src/views/community/memberhouse/index.vue b/src/views/community/memberhouse/index.vue
index 53065e0..3b6c29b 100644
--- a/src/views/community/memberhouse/index.vue
+++ b/src/views/community/memberhouse/index.vue
@@ -140,14 +140,14 @@
-
+
-
@@ -157,13 +157,13 @@
-
+