This commit is contained in:
大黑 2025-12-26 14:51:17 +08:00
parent 3d49c29967
commit b34d81892b
9 changed files with 461 additions and 310 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -945,12 +945,14 @@ export default {
.info-item { .info-item {
display: flex; display: flex;
flex-direction: column; flex-direction: row;
gap: 6px; align-items: center;
gap: 8px;
.label { .label {
font-size: 13px; font-size: 16px;
color: #909399; color: #909399;
white-space: nowrap;
} }
.value { .value {

View File

@ -562,29 +562,78 @@ export default {
this.$refs.versionModal.showModal(row) this.$refs.versionModal.showModal(row)
}, },
handleDownloadImportTemplate() { handleDownloadImportTemplate() {
const request = { const { url, method = 'get', headers = {} } = api.DOWNLODE_ALL_MODEL || {}
...api.DOWNLODE_ALL_MODEL, const requestConfig = {
disableSuccessMsg: true url,
method,
params: {},
responseType: 'blob',
headers
} }
this.$request(request) if (!requestConfig.url) {
.asyncThen((resp) => { console.log('未配置下载地址')
console.log(resp, 'resp') return
const blobData = resp.data }
if ((requestConfig.method || '').toLowerCase() === 'get') {
requestConfig.data = requestConfig.params
delete requestConfig.params
}
this.$axios(requestConfig)
.then((response) => {
const blobData = response.data
if (!blobData) { if (!blobData) {
console.log('下载失败,文件内容为空') console.log('下载失败,文件内容为空')
return return
} }
const contentType =
response.headers &&
(response.headers['content-type'] || response.headers['Content-Type'])
if (contentType && contentType.includes('application/json')) {
try {
const reader = new FileReader()
reader.onload = () => {
console.log(`下载失败: ${reader.result}`)
}
reader.readAsText(blobData)
} catch (err) {
console.error('解析下载失败响应异常:', err)
}
return
}
const disposition =
response.headers &&
(response.headers['content-disposition'] || response.headers['Content-Disposition'])
let filename = '导入模板.xlsx'
if (disposition) {
const filenameMatch = /filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i.exec(
disposition
)
const matchedName = filenameMatch ? filenameMatch[1] || filenameMatch[2] : ''
if (matchedName) {
try {
filename = decodeURIComponent(matchedName)
} catch (err) {
filename = matchedName
}
}
}
const downloadUrl = window.URL.createObjectURL(blobData) const downloadUrl = window.URL.createObjectURL(blobData)
const link = document.createElement('a') const link = document.createElement('a')
link.href = downloadUrl link.href = downloadUrl
link.download = '导入模板.xlsx' link.download = filename
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
document.body.removeChild(link) document.body.removeChild(link)
window.URL.revokeObjectURL(downloadUrl) window.URL.revokeObjectURL(downloadUrl)
this.$message({
type: 'success',
message: '下载成功'
})
console.log('下载开始,请查看浏览器下载列表')
}) })
.asyncErrorCatch((err) => { .catch((err) => {
console.error('下载导入模板失败:', err) console.error('下载失败:', err)
this.$message.error('下载失败,请稍后重试')
}) })
}, },
handleVersionClick(data) { handleVersionClick(data) {

View File

@ -2169,13 +2169,13 @@ export default {
version: res.data.version, version: res.data.version,
status: 'DRAFT', status: 'DRAFT',
rowId: newTemplateId, rowId: newTemplateId,
id: newTemplateId id: res.data.templateId
}) })
} else { } else {
const versionItem = this.versionList.find((v) => v.version === res.data.version) const versionItem = this.versionList.find((v) => v.version === res.data.version)
versionItem.status = 'DRAFT' versionItem.status = 'DRAFT'
versionItem.rowId = newTemplateId versionItem.rowId = newTemplateId
versionItem.id = newTemplateId versionItem.id = res.data.templateId
} }
this.loadData() this.loadData()
}) })

View File

@ -200,9 +200,9 @@
v-if="row.status === 'REJECTED'" v-if="row.status === 'REJECTED'"
href="javascript:void(0)" href="javascript:void(0)"
class="el-link el-link--primary" class="el-link el-link--primary"
@click.stop="handleRestart(row)" @click.stop="handleEdit(row)"
> >
重新发起 修改
</a> </a>
<span <span
v-if="row.status === 'REJECTED'" v-if="row.status === 'REJECTED'"

View File

@ -19,7 +19,7 @@
</div> </div>
<div class="header-right"> <div class="header-right">
<!-- 草稿状态显示发起和修改按钮 --> <!-- 草稿状态显示发起和修改按钮 -->
<template v-if="reportDetail.status === 'DRAFT' && !isEditMode"> <template v-if="(reportDetail.status === 'DRAFT' || reportDetail.status === 'REJECTED')&& !isEditMode">
<el-button @click="handleLaunch"> <el-button @click="handleLaunch">
发起 发起
</el-button> </el-button>
@ -1443,7 +1443,7 @@ export default {
} }
.label { .label {
font-size: 14px; font-size: 16px;
color: #303133; color: #303133;
background: #f5f7fa; background: #f5f7fa;
padding: 12px 16px; padding: 12px 16px;