Commit 6f989f74 by yuzhenWang

Merge branch 'feature-20250827wyz-写业务' into 'test'

预约发布测试

See merge request !7
parents 8fe36d78 7479d644
......@@ -171,6 +171,14 @@ export function editPolicytransfer(data) {
data: data
})
}
// 预约-编辑附件
export function editAppointmentFile(data) {
return request({
url: '/csf/api/appointmentFile/edit',
method: 'put',
data: data
})
}
// 新增附件
export function addFile(data) {
return request({
......
......@@ -57,6 +57,24 @@
v-model:limit="queryParams.pageSize"
@pagination="getFileList"
/>
<el-dialog title="重命名文件" v-model="editVisible" width="800px" append-to-body>
<el-form>
<el-row>
<el-col :span="12">
<el-form-item label="文件名">
<el-input v-model="form.fileName" placeholder="请输入文件名" maxlength="300" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="canelEdit">取 消</el-button>
</div>
</template>
</el-dialog>
<!-- 图片查看器 -->
<el-dialog v-model="imageViewerVisible" title="图片预览" width="60%">
<div style="text-align: center">
......@@ -68,8 +86,7 @@
<script setup name="FileUpload">
import { getToken } from '@/utils/auth'
import { ElLoading } from 'element-plus'
import { addFile, getAppointmentFile, delFile } from '@/api/sign/appointment'
import { addFile, getAppointmentFile, delFile, editAppointmentFile } from '@/api/sign/appointment'
const props = defineProps({
activeName: { type: String, default: '' }, //tab名称
formStatus: { type: String, default: '' }, //父组件状态,新增、修改
......@@ -78,6 +95,7 @@ const props = defineProps({
appointmentStatus: { type: Number } //父组件传递过来的预约的状态
})
const { proxy } = getCurrentInstance()
const editVisible = ref(false)
const loading = ref(true)
const total = ref(0)
const fileTableList = ref([])
......@@ -100,6 +118,24 @@ const data = reactive({
})
const { queryParams, form } = toRefs(data)
const canelEdit = () => {
editVisible.value = false
form.value = {}
console.log('fileTableList', fileTableList.value)
}
const submitForm = () => {
let obj = {
appointmentFileBizId: form.value.appointmentFileBizId,
fileName: form.value.fileName
}
editAppointmentFile(obj).then(response => {
if (response.code == 200) {
proxy.$modal.msgSuccess('文件名修改成功')
editVisible.value = false
getFileList()
}
})
}
const handleDetele = row => {
proxy.$modal
.confirm('是否确认删除名称为"' + row.fileName + '"的文件?')
......@@ -117,7 +153,10 @@ const handleDetele = row => {
const isImageFile = fileName => {
return /\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)$/i.test(fileName || '')
}
const handleUpdate = row => {}
const handleUpdate = row => {
editVisible.value = true
form.value = JSON.parse(JSON.stringify(row))
}
const handleView = row => {
imageUrl.value = row.fileUrl
imageViewerVisible.value = true
......@@ -138,88 +177,7 @@ const downloadFile = row => {
link.click()
document.body.removeChild(link)
}
// const downloadFile = async row => {
// try {
// if (!row.fileUrl) {
// proxy.$modal.msgError('文件链接不存在')
// return
// }
// // 显示加载状态
// const loadingInstance = ElLoading.service({
// lock: true,
// text: '文件下载中...',
// background: 'rgba(0, 0, 0, 0.7)'
// })
// try {
// const response = await fetch(row.fileUrl)
// if (!response.ok) {
// throw new Error(`服务器响应错误: ${response.status}`)
// }
// const blob = await response.blob()
// const url = window.URL.createObjectURL(blob)
// const link = document.createElement('a')
// link.href = url
// link.download = row.fileName || extractFileName(row.fileUrl, row.fileName)
// link.style.display = 'none'
// document.body.appendChild(link)
// link.click()
// // 清理资源
// setTimeout(() => {
// document.body.removeChild(link)
// window.URL.revokeObjectURL(url)
// }, 100)
// proxy.$modal.msgSuccess('文件已开始下载')
// } finally {
// loadingInstance.close()
// }
// } catch (error) {
// console.error('下载失败:', error)
// // 如果fetch方式失败,尝试直接链接方式
// try {
// const link = document.createElement('a')
// link.href = row.fileUrl
// link.download = row.fileName || extractFileName(row.fileUrl, row.fileName)
// link.target = '_blank'
// link.style.display = 'none'
// document.body.appendChild(link)
// link.click()
// setTimeout(() => {
// document.body.removeChild(link)
// }, 100)
// proxy.$modal.msgSuccess('已尝试开始下载')
// } catch (fallbackError) {
// proxy.$modal.msgError('下载失败,请检查网络连接')
// }
// }
// }
// // 文件名处理函数
// const extractFileName = (url, fallbackName) => {
// if (fallbackName) return fallbackName
// try {
// const urlObj = new URL(url)
// const pathname = urlObj.pathname
// const filename = pathname.substring(pathname.lastIndexOf('/') + 1)
// return decodeURIComponent(filename) || `file_${Date.now()}`
// } catch {
// const parts = url.split('/')
// const lastPart = parts[parts.length - 1]
// return lastPart.split('?')[0] || `file_${Date.now()}`
// }
// }
// 上传前loading加载
function handleBeforeUpload(file) {
// if (file.name.includes(',')) {
......
......@@ -219,35 +219,37 @@ const { bx_currency_type, csf_ap_status, csf_ap_meeting_point } = proxy.useDict(
)
const handleExprotPdf = () => {
exportLoading.value = true
getItineraryExprot(appointmentSummeryInfo.value.apiAppointmentInfoDto.appointmentBizId).then(
res => {
if (res.code == 200) {
// 创建隐藏的下载链接
const link = document.createElement('a')
link.href = res.data
link.target = '_blank' // 新窗口打开
getItineraryExprot(appointmentSummeryInfo.value.appointmentBizId).then(res => {
if (res.code == 200) {
// 创建隐藏的下载链接
const link = document.createElement('a')
link.href = res.data
link.target = '_blank' // 新窗口打开
// 设置下载文件名(重要)
// 从URL中提取文件名,或者使用返回的文件名
const fileName = `香港行程安排.pdf`
link.download = fileName
// 设置下载文件名(重要)
// 从URL中提取文件名,或者使用返回的文件名
const fileName = `香港行程安排.pdf`
link.download = fileName
// 触发下载
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
exportLoading.value = false
// proxy.$message.success('行程单下载成功')
dialogVisible.value = false
}
// 触发下载
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
exportLoading.value = false
// proxy.$message.success('行程单下载成功')
dialogVisible.value = false
} else {
proxy.$message.error('行程单下载失败')
exportLoading.value = false
}
)
})
}
// 获取预约详情
function getAppointmentInfo(appointmentBizId) {
getItineraryDetail(appointmentBizId).then(res => {
if (res.code == 200) {
appointmentSummeryInfo.value = res.data
appointmentSummeryInfo.value.appointmentBizId = appointmentBizId
csf_ap_meeting_point._object.csf_ap_meeting_point.forEach(item => {
if (item.value == appointmentSummeryInfo.value.meetingPoint) {
appointmentSummeryInfo.value.meetingPoint = item.label
......
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