DeductShow.vue
1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<template>
<BasicModal
v-bind="$attrs"
@register="register"
title="扣款单"
width="700px"
:bodyStyle="{ height: '240px' }"
@ok="handleOk"
>
<a-list item-layout="horizontal" :data-source="itemArray">
<template #renderItem="{ item }">
<a-list-item>
<a-list-item-meta>
<template #title>
<!-- <a :href="item.url" target="_blank" rel="noopener noreferrer">{{ item.name }}</a> -->
<a @click="openPic(item.url)">{{ item.name }}</a>
</template>
</a-list-item-meta>
</a-list-item>
</template>
</a-list>
</BasicModal>
</template>
<script lang="ts" setup>
import { BasicModal, useModalInner } from '@/components/Modal';
import { computed, ref } from 'vue';
import type { UploadProps, UploadChangeParam } from 'ant-design-vue';
import { InboxOutlined } from '@ant-design/icons-vue';
import { message } from 'ant-design-vue';
import { getInvoiceDeductUrlById } from '@/api/project/invoice';
interface Item {
name: string;
url: string;
}
const list = ref();
const id = ref();
const itemArray = ref<Item[]>([]);
const [register, { closeModal }] = useModalInner(async (data) => {
itemArray.value = [];
const res = await getInvoiceDeductUrlById({ id: data.data.id });
console.log(res, '5656resssdata');
for (let item in res) {
const url = res[item];
const name = item;
// 将 name 和 url 放入对象并添加到数组中
itemArray.value.push({ name, url });
}
});
async function handleOk() {
itemArray.value = [];
closeModal();
}
function openPic(url) {
window.open('', '', '').document.write(`<!DOCTYPE html>
<html>
<body
style="display: flex;
justify-content: center;
align-items: center;">
<img src='${url}' width="500px" height="500px"/>
</body>
</html>`);
}
</script>