接口错误信息提示文案调整,下载预览接口错误消息文案调整

This commit is contained in:
renpy 2023-07-14 16:52:18 +08:00 committed by orgin
parent 98179100dd
commit c9676af104
23 changed files with 65 additions and 56 deletions

View File

@ -14,7 +14,7 @@
</span> </span>
<!-- </a> --> <!-- </a> -->
</div> </div>
<div class="right-btn" @click="downloadFile(fileSrc)"> <div class="right-btn" @click="downloadFile">
<!-- <a :href="fileSrc" :download="type"> --> <!-- <a :href="fileSrc" :download="type"> -->
<img class="icon-download" src="../../assets/images/web-statistics/download.png" alt=""> <img class="icon-download" src="../../assets/images/web-statistics/download.png" alt="">
<span style="margin-left: 10px;"> <span style="margin-left: 10px;">
@ -584,7 +584,6 @@ export default {
}, },
methods: { methods: {
getFildBlob() { getFildBlob() {
console.log("afsdfasdfasdfasdfasdf");
let _this = this let _this = this
let params = { let params = {
sampleId: this.sampleId, sampleId: this.sampleId,
@ -592,29 +591,34 @@ export default {
} }
let url = "/webStatistics/radionuclideFile" let url = "/webStatistics/radionuclideFile"
getAction(url, params).then((res) => { getAction(url, params).then((res) => {
if (res.code&&res.code==500) {
_this.fileSrc = ""
} else {
const blob = new Blob([res], { type: 'text/plain' }) const blob = new Blob([res], { type: 'text/plain' })
const blobZip = new Blob([res], { type: 'application/zip' })
_this.fileSrc = window.URL.createObjectURL(blob) _this.fileSrc = window.URL.createObjectURL(blob)
_this.zipSrc = window.URL.createObjectURL(blobZip) }
}) })
}, },
downloadFile(src) { downloadFile() {
if (src) { if (this.fileSrc) {
let link = document.createElement('a') let link = document.createElement('a')
link.href = src link.href = this.fileSrc
link.target = '_blank' link.target = '_blank'
link.download = this.type link.download = this.type
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
document.body.removeChild(link) document.body.removeChild(link)
} else { } else {
this.$message.info("File download failed") this.$message.warning("This operation fails. Contact your system administrator")
} }
}, },
downloadZip() { downloadZip() {
getAction('/webStatistics/radionuclideFile',{ getAction('/webStatistics/radionuclideFile',{
sampleId: this.sampleId, sampleId: this.sampleId,
}).then(async res => { }).then(async res => {
if (res.code&&res.code==500) {
this.$message.warning("This operation fails. Contact your system administrator")
} else {
const arrayBufferView = new Uint8Array(res) const arrayBufferView = new Uint8Array(res)
const zip = new JSZip() const zip = new JSZip()
const blob = new Blob([res], { type: 'text/plain' }) const blob = new Blob([res], { type: 'text/plain' })
@ -625,6 +629,7 @@ export default {
const zipContent = await zip.generateAsync({ type: 'blob' }); const zipContent = await zip.generateAsync({ type: 'blob' });
// ZIP // ZIP
saveAs(zipContent, this.type); saveAs(zipContent, this.type);
}
}) })
}, },
viewFile() { viewFile() {

View File

@ -71,6 +71,9 @@ export default {
let url = this.type === "soh" ? "/webStatistics/sohFile" : "/webStatistics/arFile" let url = this.type === "soh" ? "/webStatistics/sohFile" : "/webStatistics/arFile"
let params = this.type === "soh" ? paramsSoh : paramsRr let params = this.type === "soh" ? paramsSoh : paramsRr
getAction(url, params).then((res) => { getAction(url, params).then((res) => {
if (res.code && res.code==500) {
_this.fileSrc = ""
} else {
const blob = new Blob([res], { type: 'text/plain' }) const blob = new Blob([res], { type: 'text/plain' })
_this.fileSrc = window.URL.createObjectURL(blob) _this.fileSrc = window.URL.createObjectURL(blob)
var reader = new FileReader(); var reader = new FileReader();
@ -79,6 +82,7 @@ export default {
// //
_this.fileText = reader.result _this.fileText = reader.result
} }
}
}) })
}, },
downloadFile() { downloadFile() {
@ -91,7 +95,7 @@ export default {
link.click() link.click()
document.body.removeChild(link) document.body.removeChild(link)
} else { } else {
this.$message.info("File download failed") this.$message.warning("This operation fails. Contact your system administrator")
} }
}, },
viewFile() { viewFile() {

View File

@ -138,7 +138,7 @@ export default {
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.dataSource = res.result.records this.dataSource = res.result.records
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
} else { } else {

View File

@ -89,7 +89,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })

View File

@ -84,7 +84,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -84,7 +84,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -85,7 +85,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -85,7 +85,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -89,7 +89,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -84,7 +84,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -84,7 +84,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -85,7 +85,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -85,7 +85,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -152,7 +152,7 @@ export default {
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.dataSource = res.result.records this.dataSource = res.result.records
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },
@ -164,7 +164,7 @@ export default {
this.detailJson = JSON.parse(JSON.stringify(this.detailJson)) this.detailJson = JSON.parse(JSON.stringify(this.detailJson))
this.isDetail = true this.isDetail = true
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },
@ -180,7 +180,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -89,7 +89,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -84,7 +84,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -84,7 +84,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -85,7 +85,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -85,7 +85,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -127,7 +127,7 @@ export default {
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.dataSource = res.result.records this.dataSource = res.result.records
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
} else { } else {
@ -143,7 +143,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -138,7 +138,7 @@ export default {
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.dataSource = res.result.records this.dataSource = res.result.records
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
} else { } else {
@ -154,7 +154,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -138,7 +138,7 @@ export default {
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.dataSource = res.result.records this.dataSource = res.result.records
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
} else { } else {
@ -158,7 +158,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },

View File

@ -138,7 +138,7 @@ export default {
this.ipagination.total = res.result.total this.ipagination.total = res.result.total
this.dataSource = res.result.records this.dataSource = res.result.records
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
} else { } else {
@ -158,7 +158,7 @@ export default {
this.stationList=[] this.stationList=[]
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning("This operation fails. Contact your system administrator")
} }
}) })
}, },