Compare commits
5 Commits
409999b37b
...
2025-12
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd09e24cf0 | ||
|
|
2a11891988 | ||
|
|
e7d90c3a73 | ||
|
|
72b1f39814 | ||
|
|
38028b5cb0 |
@@ -7,8 +7,20 @@ const SYSTEM_PREFIX = '/system-boot'
|
||||
* @param file
|
||||
*/
|
||||
export const uploadFile = (file: any, path: string) => {
|
||||
const regex = /\[|\]/g
|
||||
// 替换规则:[ 换成 (,] 换成 )
|
||||
|
||||
const newFile = new File(
|
||||
[file], // 原文件的二进制内容
|
||||
file.name.replace(regex, match => (match === '[' ? '(' : ')')), // 新的文件名
|
||||
{
|
||||
type: file.type, // 复用原文件的MIME类型
|
||||
lastModified: file.lastModified // 复用最后修改时间
|
||||
}
|
||||
)
|
||||
|
||||
let form = new FormData()
|
||||
form.append('file', file)
|
||||
form.append('file', newFile)
|
||||
form.append('path', path)
|
||||
return createAxios({
|
||||
url: SYSTEM_PREFIX + '/file/upload',
|
||||
|
||||
@@ -43,6 +43,7 @@ if (VITE_FLAG) {
|
||||
})
|
||||
} else {
|
||||
setTimeout(async () => {
|
||||
|
||||
const previewUrl = await previewFile(currentRoute.value?.href?.split('?')[1])
|
||||
url.value = previewUrl
|
||||
excelOptions.value = ref({
|
||||
|
||||
@@ -55,9 +55,10 @@ function removeLastDotSuffix(str: string) {
|
||||
export const previewFile = async (urls: any) => {
|
||||
//console.log('预览', urls)
|
||||
let url = ''
|
||||
|
||||
//console.log('urls', decodeURI(urls))
|
||||
await downloadFile({ filePath: decodeURI(urls) })
|
||||
.then((res: any) => {
|
||||
|
||||
// 1. 确定文件MIME类型(优化:用更简洁的方式)
|
||||
const getFileType = (url: string) => {
|
||||
const ext = url.split('.').pop()?.toLowerCase() || ''
|
||||
@@ -74,7 +75,7 @@ export const previewFile = async (urls: any) => {
|
||||
}
|
||||
return mimeMap[ext] || ''
|
||||
}
|
||||
|
||||
|
||||
const blob = new Blob([res], { type: getFileType(decodeURI(urls)) })
|
||||
|
||||
|
||||
|
||||
@@ -231,14 +231,14 @@ const init = () => {
|
||||
},
|
||||
backgroundColor: 'rgba(0,0,0,0.55)',
|
||||
formatter: function (params: any) {
|
||||
//console.log(params)
|
||||
console.log(params)
|
||||
let msg = ''
|
||||
msg += params[0].name + '<br/>'
|
||||
msg += params[0].name
|
||||
for (let i in params) {
|
||||
if (params[i].data == 3.14159) {
|
||||
msg +=params[i].marker + ': 暂无数据<br/>'
|
||||
msg += '(' + params[i].seriesName + ')' + '<br/>' + params[i].marker + ': 暂无数据<br/>'
|
||||
} else {
|
||||
msg += params[i].marker + ': ' + params[i].data + '<br/>'
|
||||
msg += '(' + params[i].seriesName + ')' + '<br/>' + params[i].marker + ': ' + params[i].data + '<br/>'
|
||||
}
|
||||
}
|
||||
return msg
|
||||
|
||||
@@ -234,16 +234,18 @@ const tableStore = new TableStore({
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
if (VITE_FLAG) {
|
||||
return !(row.problemType == 2 || row.problemType == 4)
|
||||
}
|
||||
return true;
|
||||
// if (VITE_FLAG) {
|
||||
return !(row.problemType == 2 || row.problemType == 4)
|
||||
// }
|
||||
// return true;
|
||||
},
|
||||
click: row => {
|
||||
|
||||
if (row.problemType == 2) {
|
||||
const match = row.filePath.match(/excelreport(\/[^?#]*)/)
|
||||
|
||||
window.open(window.location.origin + '/#/previewFile?' + match[1])
|
||||
// const match = row.filePath.match(/excelreport(\/[^?#]*)/)
|
||||
|
||||
// window.open(window.location.origin + '/#/previewFile?' + match[1])
|
||||
window.open(window.location.origin + '/#/previewFile?/' + row.absFilePath)
|
||||
} else {
|
||||
if (row.problemPath == null) {
|
||||
ElMessage({
|
||||
@@ -251,7 +253,8 @@ const tableStore = new TableStore({
|
||||
type: 'warning'
|
||||
})
|
||||
} else {
|
||||
window.open(window.location.origin + '/#/previewFile?/' + row.problemPath)
|
||||
//window.open(window.location.origin + '/#/previewFile?/' + row.problemPath)
|
||||
window.open(window.location.origin + '/#/previewFile?/' + row.absFilePath)
|
||||
// getFileNameAndFilePath({ filePath: '/' + row.problemPath }).then(res => {
|
||||
// // window.open(res.data.url)
|
||||
// })
|
||||
@@ -280,10 +283,11 @@ const tableStore = new TableStore({
|
||||
type: 'warning'
|
||||
})
|
||||
} else {
|
||||
getFileNameAndFilePath({ filePath: '/' + row.problemPath }).then(res => {
|
||||
// getFileNameAndFilePath({ filePath: '/' + row.problemPath }).then(res => {
|
||||
|
||||
window.open(res.data.url)
|
||||
})
|
||||
// window.open(res.data.url)
|
||||
// })
|
||||
download('/' + row.absFilePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,16 +151,17 @@ const tableStore = new TableStore({
|
||||
icon: 'el-icon-EditPen',
|
||||
render: 'basicButton',
|
||||
disabled: row => {
|
||||
if (VITE_FLAG) {
|
||||
// if (VITE_FLAG) {
|
||||
return row.problemType != 2;
|
||||
}
|
||||
return true;
|
||||
// }
|
||||
// return true;
|
||||
},
|
||||
|
||||
click: row => {
|
||||
const match = row.filePath.match(/excelreport(\/[^?#]*)/)
|
||||
// const match = row.filePath.match(/excelreport(\/[^?#]*)/)
|
||||
|
||||
window.open(window.location.origin + '/#/previewFile?' + match[1])
|
||||
// window.open(window.location.origin + '/#/previewFile?' + match[1])
|
||||
window.open(window.location.origin + '/#/previewFile?/' + row.absFilePath)
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -177,10 +178,11 @@ const tableStore = new TableStore({
|
||||
//window.open(row.filePath)
|
||||
// const match = row.filePath.match(/excelreport(\/[^?#]*)/)
|
||||
// const decodedPath = decodeURI(match[1]) // 解码URL中的中文字符
|
||||
//download('/' + row.absFilePath)
|
||||
download('/' + row.absFilePath)
|
||||
|
||||
//download('/supervision/微服务系统测试页面功能-20251224合并版本.docx')
|
||||
download('/onlineReport/电能[预]2025年18号-张家口地市 电能质量技术监督预警单.docx')
|
||||
|
||||
//download('/onlineReport/电能[预]2025年18号-张家口地市 电能质量技术监督预警单.docx')
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<el-descriptions-item :span="2" label="采取措施">
|
||||
{{ detailData.takeStep }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :span="2" label="处理成效报告">
|
||||
<el-descriptions-item :span="2" label="反馈报告">
|
||||
<el-icon class="elView" v-if="detailData?.reportName ">
|
||||
<View @click="openFile(detailData?.reportName)" />
|
||||
</el-icon>
|
||||
@@ -51,6 +51,7 @@ import { Link, View } from '@element-plus/icons-vue'
|
||||
|
||||
defineOptions({ name: 'technology/detail' })
|
||||
const openFile = (name: any) => {
|
||||
|
||||
window.open(window.location.origin + '/#/previewFile?/supervision/' + name)
|
||||
}
|
||||
const { query } = useRoute() // 查询参数
|
||||
@@ -92,7 +93,7 @@ const getInfo = async () => {
|
||||
|
||||
const getFileData = async () => {
|
||||
//如果有问题附件
|
||||
console.log('000',detailData.value)
|
||||
//console.log('000',detailData.value)
|
||||
if (detailData.value.problemPath) {
|
||||
await getFileNameAndFilePath({ filePath: detailData.value.problemPath }).then(res => {
|
||||
console.log(res.data)
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
:autosize="{ minRows: 2, maxRows: 6 }" readonly />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="技术监督报告:" v-if="showFile1">
|
||||
<!-- <el-form-item label="技术监督报告:" v-if="showFile1"> -->
|
||||
<el-form-item label="技术监督报告:" v-if="false">
|
||||
<el-icon class="elView" v-if="supervisionReportDetail?.supervisionReportName ">
|
||||
<View @click="openFile(supervisionReportDetail?.supervisionReportName)" />
|
||||
</el-icon>
|
||||
@@ -104,7 +105,7 @@ const reportFilePath: any = ref('')
|
||||
//form表单校验规则
|
||||
const rules = {
|
||||
takeStep: [{ required: true, message: '请输入采取的措施', trigger: 'blur' }],
|
||||
reportPath: [{ required: true, message: '请上传处理成效报告', trigger: 'blur' }]
|
||||
reportPath: [{ required: true, message: '请上传反馈报告', trigger: 'blur' }]
|
||||
}
|
||||
const resetForm = () => {
|
||||
if (formRef.value) {
|
||||
|
||||
Reference in New Issue
Block a user