<template>
	<image class="avatar-img" :src="avatarSrc"></image>
</template>

<script>
export default {
	name: 'detailAvatar',
	props: {
		info: {
			default: () => ({}),
			type: Object,
		},
	},
	computed: {
		avatarSrc() {
			const { avatar, status } = this.info;
			if (avatar) {
				return avatar;
			}
			console.log(status, 'status');
			const icons = {
				0: 'pend-approval', // 待审批
				1: 'agree', // 已抄送
				2: 'rejected', // 已撤销
				3: 'rejected', // 已驳回
				4: 'agree', // 已审批
				5: 'pend-approval', // 待抄送
			};
			const iconName = icons[status || 0]; // status为空默认给待审批icon
			return require(`@/static/images/approval/${iconName}.png`); // 已通过/已归档
			// return require('@/static/images/approval/rejected.png'); // 已驳回/已撤销
			// return require('@/static/images/approval/pend-approval.png'); // 待审批
		},
	},
};
</script>

<style scoped lang="scss">
.avatar-img {
	width: 40px;
	height: 40px;
}
</style>
