|
|
|
@ -43,15 +43,15 @@
|
|
|
|
|
{{ item.templateName }}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="flex flex-btns">
|
|
|
|
|
<dl @click="toPrint(item.id, '1')">
|
|
|
|
|
<dl @click="toPrint(item, '1')">
|
|
|
|
|
<dt><img src="../../assets/images/PDF2.png" alt=""></dt>
|
|
|
|
|
<dd>pdf</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl @click="toPrint(item.id, '2', item.name)">
|
|
|
|
|
<dl @click="toPrint(item, '2', item.name)">
|
|
|
|
|
<dt><img src="../../assets/images/xksx2.png" alt=""></dt>
|
|
|
|
|
<dd>xlsx</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
<dl @click="toPrint(item.id, '3')">
|
|
|
|
|
<dl @click="toPrint(item, '3')">
|
|
|
|
|
<dt><img src="../../assets/images/DOC2.png" alt=""></dt>
|
|
|
|
|
<dd>doc</dd>
|
|
|
|
|
</dl>
|
|
|
|
@ -72,7 +72,8 @@
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup name="DsPrint">
|
|
|
|
|
import { ref, defineExpose, defineProps } from 'vue'
|
|
|
|
|
import { GetOpenPrintTemplateList, GetOpenJsonPrintInfo } from '/@/views/operation/seaexport/api/BookingLedger.js'
|
|
|
|
|
import { useUserStore } from '/@/store/modules/user'
|
|
|
|
|
import { GetOpenPrintTemplateList, GetOpenJsonPrintInfo, GetOpenSqlPrintInfo } from '/@/views/operation/seaexport/api/BookingLedger.js'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
const { createMessage } = useMessage()
|
|
|
|
|
const props = defineProps({
|
|
|
|
@ -80,6 +81,11 @@
|
|
|
|
|
code: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: null
|
|
|
|
|
},
|
|
|
|
|
// 有数据源打印的参数
|
|
|
|
|
paramJsonStr: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: null
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 关键字名称
|
|
|
|
@ -141,28 +147,55 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 跳转打印
|
|
|
|
|
const toPrint = (id, type, name) => {
|
|
|
|
|
const postData = {
|
|
|
|
|
jsonDataStr: jsonDataStr.value || '',
|
|
|
|
|
printType: type,
|
|
|
|
|
templateId: id
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetOpenJsonPrintInfo(postData).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
let fileURL = `http://118.190.144.189:3008/printtempfile/${res.data}`
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
window.open(fileURL)
|
|
|
|
|
const toPrint = (item, type) => {
|
|
|
|
|
if (item.isUseDataSource) {
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const postData = {
|
|
|
|
|
printType: type,
|
|
|
|
|
templateId: item.id,
|
|
|
|
|
paramJsonStr: props.paramJsonStr,
|
|
|
|
|
templateCode: item.templateCode,
|
|
|
|
|
tenantId: userStore.getUserInfo.tenantId
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetOpenSqlPrintInfo(postData).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
let fileURL = `http://118.190.144.189:3008/printtempfile/${res.data}`
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
window.open(fileURL)
|
|
|
|
|
} else {
|
|
|
|
|
window.open(`//118.190.144.189:3008/printtempfile/${res.data}`, '_blank')
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
window.open(`//118.190.144.189:3008/printtempfile/${res.data}`, '_blank')
|
|
|
|
|
createMessage.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error(res.message)
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
const postData = {
|
|
|
|
|
jsonDataStr: jsonDataStr.value || '',
|
|
|
|
|
printType: type,
|
|
|
|
|
templateId: item.id
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
loading.value = true
|
|
|
|
|
GetOpenJsonPrintInfo(postData).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
let fileURL = `http://118.190.144.189:3008/printtempfile/${res.data}`
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
window.open(fileURL)
|
|
|
|
|
} else {
|
|
|
|
|
window.open(`//118.190.144.189:3008/printtempfile/${res.data}`, '_blank')
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
createMessage.error(res.message)
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
|