Commit 9b747eca by wuqian

下载素材优化

parent 640e6d02
...@@ -324,7 +324,7 @@ const props = defineProps({ ...@@ -324,7 +324,7 @@ const props = defineProps({
type: String, type: String,
}, },
}) })
const emit = defineEmits(['update:detailVisible', 'close','onSuccess']) const emit = defineEmits(['update:detailVisible', 'close', 'onSuccess'])
watch( watch(
() => props.detailVisible, () => props.detailVisible,
...@@ -367,9 +367,11 @@ watch( ...@@ -367,9 +367,11 @@ watch(
watch( watch(
() => props.detailData, () => props.detailData,
(newVal) => { (newVal) => {
// detail.value = { detail.value = {
// imgList: [], id: -1,
// } podOrderId: -1,
imgList: [],
}
if (newVal && Object.keys(newVal).length > 0) { if (newVal && Object.keys(newVal).length > 0) {
const d = JSON.parse(JSON.stringify(newVal)) const d = JSON.parse(JSON.stringify(newVal))
if (d.note) { if (d.note) {
...@@ -462,7 +464,7 @@ const changeStatus = async () => { ...@@ -462,7 +464,7 @@ const changeStatus = async () => {
}) })
} }
const setData = async (orderNumber: string) => { const setData = async (orderNumber: string) => {
if (detail.value && detail.value?.id!=-1) { if (detail.value && detail.value?.id != -1) {
try { try {
const id = detail.value?.id const id = detail.value?.id
await productionQueryApi(id) await productionQueryApi(id)
...@@ -498,19 +500,28 @@ const handleDownload = () => { ...@@ -498,19 +500,28 @@ const handleDownload = () => {
download() download()
} }
const download = async () => { const download = async () => {
if (detail.value && detail.value?.id != -1) {
try { try {
const id = detail.value.id const id = detail.value.id
if (id !== undefined) { if (id !== undefined) {
const res = await downloadMaterialApi([id]) const res = await downloadMaterialApi([id])
const { data } = res const { data } = res
data.forEach((item: string) => { data.forEach((item: string) => {
window.open(filePath + item) // 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) { } catch (e) {
// showError(e) // showError(e)
console.error(e) console.error(e)
} }
}
} }
type AudioKey = keyof typeof audios // 创建一个类型,确保 key 只能是 audios 对象的键之一 type AudioKey = keyof typeof audios // 创建一个类型,确保 key 只能是 audios 对象的键之一
const playAudio = (key: AudioKey, message?: string) => { const playAudio = (key: AudioKey, message?: string) => {
......
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