|
@ -274,7 +274,7 @@ |
|
|
:columns="downLoadColumns" |
|
|
:columns="downLoadColumns" |
|
|
:data-source="downLoadData" |
|
|
:data-source="downLoadData" |
|
|
bordered |
|
|
bordered |
|
|
:rowKey="(record, index) => index" |
|
|
rowKey="id" |
|
|
:rowSelection="{ |
|
|
:rowSelection="{ |
|
|
selectedRowKeys: selectedRowKeysSet, |
|
|
selectedRowKeys: selectedRowKeysSet, |
|
|
onChange: onSelectionChangeSet, |
|
|
onChange: onSelectionChangeSet, |
|
@ -534,6 +534,7 @@ |
|
|
uid: item.id.toString(), // 使用文件的id作为唯一标识 |
|
|
uid: item.id.toString(), // 使用文件的id作为唯一标识 |
|
|
name: item.fileName, // 文件名 |
|
|
name: item.fileName, // 文件名 |
|
|
status: 'done', // 设置默认状态为已完成 |
|
|
status: 'done', // 设置默认状态为已完成 |
|
|
|
|
|
type: 'done', |
|
|
url: item.filePath, // 文件的URL,这里假设用示例的URL格式 |
|
|
url: item.filePath, // 文件的URL,这里假设用示例的URL格式 |
|
|
})); |
|
|
})); |
|
|
}); |
|
|
}); |
|
@ -623,14 +624,20 @@ |
|
|
if (fileList.value.length !== 0) { |
|
|
if (fileList.value.length !== 0) { |
|
|
const formData = ref(new FormData()); |
|
|
const formData = ref(new FormData()); |
|
|
fileList.value.forEach((file) => { |
|
|
fileList.value.forEach((file) => { |
|
|
formData.value.append('files', file.originFileObj); |
|
|
if (file.type !== 'done') { |
|
|
|
|
|
formData.value.append('files', file.originFileObj); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
formData.value.append('bizType', 3); |
|
|
formData.value.append('bizType', 3); |
|
|
formData.value.append('bizId', formState.value.id); |
|
|
formData.value.append('bizId', formState.value.id); |
|
|
|
|
|
delIds.value.forEach((item) => { |
|
|
|
|
|
formData.value.append('deleteList', item); |
|
|
|
|
|
}); |
|
|
fetch(uploadPic.uploadfiles, formData.value) |
|
|
fetch(uploadPic.uploadfiles, formData.value) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
message.success('操作成功!'); |
|
|
message.success('操作成功!'); |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
|
|
|
delIds.value = []; |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
orgId: orgId.value, |
|
|
orgId: orgId.value, |
|
|
}; |
|
|
}; |
|
@ -641,6 +648,7 @@ |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
|
|
|
delIds.value = []; |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
orgId: orgId.value, |
|
|
orgId: orgId.value, |
|
|
}; |
|
|
}; |
|
@ -652,6 +660,7 @@ |
|
|
fetch(energyConsumption.creat, formState.value).then((res) => { |
|
|
fetch(energyConsumption.creat, formState.value).then((res) => { |
|
|
if (res.data === '新增数据已存在') { |
|
|
if (res.data === '新增数据已存在') { |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
|
|
|
delIds.value = []; |
|
|
NsMessage.warning(res.data); |
|
|
NsMessage.warning(res.data); |
|
|
} else { |
|
|
} else { |
|
|
if (fileList.value.length !== 0) { |
|
|
if (fileList.value.length !== 0) { |
|
@ -665,6 +674,7 @@ |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
message.success('操作成功!'); |
|
|
message.success('操作成功!'); |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
|
|
|
delIds.value = []; |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
orgId: orgId.value, |
|
|
orgId: orgId.value, |
|
|
}; |
|
|
}; |
|
@ -675,6 +685,7 @@ |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
|
|
|
delIds.value = []; |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
orgId: orgId.value, |
|
|
orgId: orgId.value, |
|
|
}; |
|
|
}; |
|
@ -766,6 +777,7 @@ |
|
|
// 关闭新增抽屉 |
|
|
// 关闭新增抽屉 |
|
|
const onClose = () => { |
|
|
const onClose = () => { |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
|
|
|
delIds.value = []; |
|
|
formState.value = { |
|
|
formState.value = { |
|
|
orgId: orgId.value, |
|
|
orgId: orgId.value, |
|
|
}; |
|
|
}; |
|
@ -796,7 +808,9 @@ |
|
|
message.error(`${info.file.name} 文件上传失败`); |
|
|
message.error(`${info.file.name} 文件上传失败`); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
const delIds = ref([]); |
|
|
const handleFileRemove = (file) => { |
|
|
const handleFileRemove = (file) => { |
|
|
|
|
|
delIds.value.push(file.uid); |
|
|
const newFileList = []; |
|
|
const newFileList = []; |
|
|
fileList.value.forEach((item) => { |
|
|
fileList.value.forEach((item) => { |
|
|
if (item.uid !== file.uid) { |
|
|
if (item.uid !== file.uid) { |
|
@ -840,12 +854,50 @@ |
|
|
const downLoad = (record) => { |
|
|
const downLoad = (record) => { |
|
|
const deleteId = ref(new FormData()); |
|
|
const deleteId = ref(new FormData()); |
|
|
deleteId.value.append('id', record.id); |
|
|
deleteId.value.append('id', record.id); |
|
|
fetch(uploadPic.download, deleteId.value).then((res) => { |
|
|
fetch(uploadPic.download, deleteId.value) |
|
|
console.log(res); |
|
|
.then((res) => { |
|
|
|
|
|
// 创建一个 URL 对象,指向图片数据的 blob |
|
|
|
|
|
const url = window.URL.createObjectURL(new Blob([res.data])); |
|
|
|
|
|
// 创建一个 <a> 标签,用于触发下载 |
|
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
|
link.href = url; |
|
|
|
|
|
link.setAttribute('download', record.fileName); // 设置下载的文件名 |
|
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
|
link.click(); |
|
|
|
|
|
|
|
|
|
|
|
// 清理 URL 对象 |
|
|
|
|
|
window.URL.revokeObjectURL(url); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
console.error('下载图片失败:', error); |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
const onSubmitDownLoad = () => { |
|
|
|
|
|
const deleteIds = ref(new FormData()); |
|
|
|
|
|
selectedRowKeysSet.value.forEach((item) => { |
|
|
|
|
|
deleteIds.value.append('ids', item); |
|
|
}); |
|
|
}); |
|
|
|
|
|
fetch(uploadPic.downloadZip, deleteIds.value) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
// 创建一个 URL 对象,指向图片数据的 blob |
|
|
|
|
|
const url = window.URL.createObjectURL(new Blob([res.data])); |
|
|
|
|
|
// 创建一个 <a> 标签,用于触发下载 |
|
|
|
|
|
const link = document.createElement('a'); |
|
|
|
|
|
link.href = url; |
|
|
|
|
|
debugger |
|
|
|
|
|
link.setAttribute('download', ''); // 设置下载的文件名 |
|
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
|
link.click(); |
|
|
|
|
|
|
|
|
|
|
|
// 清理 URL 对象 |
|
|
|
|
|
window.URL.revokeObjectURL(url); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
console.error('下载图片失败:', error); |
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
const onSubmitDownLoad = () => {}; |
|
|
|
|
|
const onCloseDownLoad = () => { |
|
|
const onCloseDownLoad = () => { |
|
|
|
|
|
selectedRowKeysSet.value = [] |
|
|
downLoadVisible.value = false; |
|
|
downLoadVisible.value = false; |
|
|
}; |
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|