<script lang="ts" setup>
|
import type { HrmEmployeeContractApi } from '#/api/hrm/employee/contract';
|
|
import { ref } from 'vue';
|
|
import { useVbenModal } from '#/packages/effects/common-ui/src';
|
|
import { getEmployeeContract } from '#/api/hrm/employee/contract';
|
|
const attachments = ref<HrmEmployeeContractApi.AttachmentItem[]>([]);
|
const loading = ref(false);
|
|
const [Modal, modalApi] = useVbenModal({
|
async onOpenChange(isOpen: boolean) {
|
if (!isOpen) {
|
return;
|
}
|
const data = modalApi.getData<{ id?: number }>();
|
if (!data?.id) {
|
return;
|
}
|
loading.value = true;
|
try {
|
const detail = await getEmployeeContract(data.id);
|
attachments.value = detail.attachmentList || [];
|
} finally {
|
loading.value = false;
|
}
|
},
|
});
|
</script>
|
|
<template>
|
<Modal title="合同附件" class="w-[560px]">
|
<div v-if="loading" class="py-6 text-center text-gray-400">加载中...</div>
|
<div v-else-if="attachments.length === 0" class="py-6 text-center text-gray-400">
|
暂无附件(可在「更多 → 修改」里上传,或用「生成合同」生成后自动归档)
|
</div>
|
<ul v-else class="max-h-[50vh] overflow-auto pl-5">
|
<li v-for="f in attachments" :key="f.id" class="mb-2 list-disc">
|
<a :href="f.url" target="_blank" rel="noopener" class="text-primary">
|
{{ f.name || `附件${f.id}` }}
|
</a>
|
</li>
|
</ul>
|
</Modal>
|
</template>
|