Commit 9b747eca by wuqian

下载素材优化

parent 640e6d02
......@@ -324,7 +324,7 @@ const props = defineProps({
type: String,
},
})
const emit = defineEmits(['update:detailVisible', 'close','onSuccess'])
const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess'])
watch(
() => props.detailVisible,
......@@ -367,9 +367,11 @@ watch(
watch(
() => props.detailData,
(newVal) => {
// detail.value = {
// imgList: [],
// }
detail.value = {
id: -1,
podOrderId: -1,
imgList: [],
}
if (newVal && Object.keys(newVal).length > 0) {
const d = JSON.parse(JSON.stringify(newVal))
if (d.note) {
......@@ -462,7 +464,7 @@ const changeStatus = async () => {
})
}
const setData = async (orderNumber: string) => {
if (detail.value && detail.value?.id!=-1) {
if (detail.value && detail.value?.id != -1) {
try {
const id = detail.value?.id
await productionQueryApi(id)
......@@ -498,18 +500,27 @@ const handleDownload = () => {
download()
}
const download = async () => {
try {
const id = detail.value.id
if (id !== undefined) {
const res = await downloadMaterialApi([id])
const { data } = res
data.forEach((item: string) => {
window.open(filePath + item)
})
if (detail.value && detail.value?.id != -1) {
try {
const id = detail.value.id
if (id !== undefined) {
const res = await downloadMaterialApi([id])
const { data } = res
data.forEach((item: string) => {
// window.open(filePath + item)
const a = document.createElement('a')
a.href = filePath + item
a.download = item
a.target = '_blank'
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
})
}
} catch (e) {
// showError(e)
console.error(e)
}
} catch (e) {
// showError(e)
console.error(e)
}
}
type AudioKey = keyof typeof audios // 创建一个类型,确保 key 只能是 audios 对象的键之一
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment