weizong song 7 days ago
parent 4ca6cf3c61
commit 0b2d734d09

@ -1260,7 +1260,7 @@
:href="getContractAttachmentUrl(contractDrawerDetail)"
target="_blank"
>
{{ (contractDrawerDetail.attachment && contractDrawerDetail.attachment.original_name) || (contractDrawerDetail.attachment && contractDrawerDetail.attachment.name) || '查看附件' }}
{{ getContractAttachmentName(contractDrawerDetail) }}
</el-link>
</template>
<span v-else>-</span>
@ -2100,9 +2100,28 @@ export default {
}
return String(rawValue);
},
getContractAttachment(detail) {
if (!detail) return null;
return detail.effective_attachment || detail.oa_inferred_attachment || detail.attachment || null;
},
getContractAttachmentName(detail) {
const att = this.getContractAttachment(detail);
return att?.original_name || att?.name || '查看附件';
},
getContractAttachmentUrl(detail) {
const att = detail?.attachment;
return att?.url || att?.path || att?.file_url || att?.download_url || att?.preview_url || '';
const att = this.getContractAttachment(detail);
if (!att) return '';
const directUrl = att.url || att.path || att.file_url || att.download_url || att.preview_url;
if (directUrl) return directUrl;
if (!att.folder || !att.name) return '';
const configuredBase = process.env.VUE_APP_BASE_API || window.location.origin;
const baseUrl = configuredBase.replace(/\/$/, '').replace(/\/api\/?$/, '');
const folder = String(att.folder).replace(/^\/+|\/+$/g, '');
const name = encodeURIComponent(String(att.name));
return `${baseUrl}/${folder}/${name}`;
},
//
formatDateTime(dateTime) {

Loading…
Cancel
Save