8 changed files with 244 additions and 40 deletions
@ -0,0 +1,80 @@ |
|||
<template> |
|||
<view style="border: 1px solid #e5e5e5"> |
|||
<view class="flex flex-col text-sm" v-for="(family, index) in familyInfo" :key="index"> |
|||
<view class="flex justify-between items-center p-3 border-b"> |
|||
<text>{{ family.name }}</text> |
|||
<u-avatar :src="family.value" mode="square" v-if="family.label === 'avatarUrl'"></u-avatar> |
|||
<view v-else-if="family.label === 'sex'" class="text-gray-400"> |
|||
{{ family.value === 1 ? '男' : family.value === 2 ? '女' : '' }} |
|||
</view> |
|||
<text v-else class="text-gray-400">{{ family.value }}</text> |
|||
</view> |
|||
</view> |
|||
<view class="flex flex-col p-4" v-if="detail.auditStatus === '0'"> |
|||
<u-button type="primary" class="mb-4" @click="auditFamily(1)">通过</u-button> |
|||
<u-button type="error" @click="auditFamily(2)">不通过</u-button> |
|||
</view> |
|||
<view class="flex flex-col p-4" v-else> |
|||
<u-button :plain="true"> |
|||
{{ detail.auditStatus === '1' ? '审核通过' : '审核未通过' }} |
|||
</u-button> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { mapGetters } from 'vuex'; |
|||
import { familyInfo } from '@/config/yyInfo'; |
|||
|
|||
export default { |
|||
name: 'Info', |
|||
props: { detail: { type: Object, default: null } }, |
|||
|
|||
data() { |
|||
return { familyInfo }; |
|||
}, |
|||
|
|||
computed: mapGetters('project', ['projectId']), |
|||
|
|||
mounted() { |
|||
if (this.detail && this.detail.familyId) { |
|||
this.setDate(this.detail); |
|||
} |
|||
}, |
|||
|
|||
methods: { |
|||
setDate(date) { |
|||
if (!date || !date.familyId) return; |
|||
const { familyInfo } = this; |
|||
for (let i = 0; i < familyInfo.length; i++) { |
|||
const item = familyInfo[i]; |
|||
item.value = date[item.label]; |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 审核家属成员 |
|||
* @param { String } auditStatus 审核状态(1审核通过 2审核未通过) |
|||
* @param { String } projectId 项目id |
|||
* @param { String } relationId 关系id |
|||
*/ |
|||
async auditFamily(auditStatus) { |
|||
try { |
|||
const params = { |
|||
auditStatus, |
|||
projectId: this.projectId, |
|||
relationId: this.detail.relationId, |
|||
}; |
|||
await this.$u.api.auditFamily(params); |
|||
this.$emit('showToast', 'success', '审核成功'); |
|||
this.$emit('queryFamilyList'); |
|||
} catch (error) { |
|||
console.error('error: ', error); |
|||
this.$emit('showToast', 'error', '审核失败'); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped></style> |
Loading…
Reference in new issue