web 模块的所有页面跳转详情时增加loading的效果

This commit is contained in:
renpy 2023-08-23 11:26:18 +08:00
parent 3ce128affc
commit 54877142f5
3 changed files with 88 additions and 121 deletions

View File

@ -7,25 +7,23 @@
</div>
<div class="top-actions">
<div class="right-btn" @click="downloadFile">
<!-- <a :href="fileSrc" :download="type" rel="noopener noreferrer"> -->
<img class="icon-download" src="../../assets/images/web-statistics/download.png" alt="">
<span style="margin-left: 10px;">
TXT
</span>
<!-- </a> -->
</div>
<div class="right-btn" @click="viewFile">
<!-- <a :href="fileSrc" target="_blank" rel="noopener noreferrer"> -->
<img class="icon-view" src="../../assets/images/web-statistics/view.png" alt="">
<span style="margin-left: 10px;">
View Report
</span>
<!-- </a> -->
</div>
</div>
</div>
<div class="file-content">
<a-spin style="height: 100%;" :spinning="spinning">
<pre>{{ fileText }}</pre>
</a-spin>
</div>
</a-card>
</template>
@ -45,6 +43,7 @@ export default {
},
data() {
return {
spinning: false,
fileText: "",
fileSrc:""
}
@ -58,19 +57,18 @@ export default {
},
getFildBlob() {
let _this = this
_this.spinning = true
let paramsRr = {
type: this.type,
sampleId: this.sampleId,
// type: "rrr",
// sampleId:"1523651"
}
let paramsSoh = {
// sohId:"11"
sohId:this.sampleId
}
let url = this.type === "soh" ? "/webStatistics/sohFile" : "/webStatistics/arFile"
let params = this.type === "soh" ? paramsSoh : paramsRr
getAction(url, params).then((res) => {
_this.spinning = false
if (res.code && res.code==500) {
_this.fileSrc = ""
this.$message.warning("This operation fails. Contact your system administrator")

View File

@ -1,7 +1,7 @@
<template>
<div style="height: 100%;">
<a-spin :spinning="spinning">
<a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px">
<!-- <search-form :items="formItems" v-model="queryParam" @search="searchQuery"> -->
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
<a-space style="float: right" class="btn-group" slot="additional">
<a-button @click="handleExcel" type="primary">
@ -27,6 +27,7 @@
</template>
</custom-table>
</a-card>
</a-spin>
<Detail v-if="isDetail" type="BLANKPHD" :sampleId="currSampleId" :allData="detailJson" @back="handleBack"></Detail>
</div>
</template>
@ -92,6 +93,7 @@ export default {
},
data() {
return {
spinning: false,
isImmediate:true,
isDetail:false,
columns,
@ -115,35 +117,12 @@ export default {
pageType:"ACQ"
}
},
// mounted() {
// console.log("this.$route.meta",this.$route.meta);
// this.queryParam.dataType = this.$route.meta.title
// },
created() {
this.findStationList()
},
// watch: {
// '$route.meta.title'(val) {
// if(val === 'SPHDF'){
// this.queryParam.dataType = 'FULL'
// } else if(val === 'SPHDP'){
// this.queryParam.dataType = 'PREL'
// } else{
// this.queryParam.dataType = val.substring(0, 1)
// }
// // this.searchQuery()
// },
// },
methods: {
handleExcel() {
if (this.dataSource.length>0) {
// this.queryParam = {
// dataType: "S",
// startTime: "2023-07-01",
// endTime: "2023-07-14",
// stationIds: [209],
// spectralQualifie:"FULL"
// }
let params = {
...this.queryParam,
pageType:this.pageType
@ -169,12 +148,6 @@ export default {
searchQueryData() {
this.isImmediate = false
this.loading = true
// this.queryParam = {
// dataType: "S",
// startTime: "2023-05-01",
// endTime: "2023-05-07",
// stationIds: [209, 211, 213]
// }
let params = {
...this.queryParam,
pageNo: 1,
@ -193,8 +166,10 @@ export default {
})
},
handleDetail(record) {
this.spinning = true
this.currSampleId = record.sampleId
getAction("webStatistics/findGeneratedReport", { sampleId: record.sampleId }).then(res => {
this.spinning = false
if (res.success) {
this.detailJson = res.result
this.detailJson = JSON.parse(JSON.stringify(this.detailJson))
@ -202,6 +177,8 @@ export default {
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
}).catch(err => {
this.spinning = false
})
},
handleBack(flag) {
@ -221,7 +198,6 @@ export default {
})
},
handleSelectChange(val) {
console.log(val);
let length = this.stationList.length
if (val.length === length) {
this.allChecked = true

View File

@ -1,5 +1,6 @@
<template>
<div style="height: 100%;">
<a-spin :spinning="spinning">
<a-card v-if="!isDetail" :bordered="false" style="margin-left: 20px">
<search-form :items="formItems" v-model="queryParam" @search="searchQueryData">
<a-space style="float: right" class="btn-group" slot="additional">
@ -26,6 +27,7 @@
</template>
</custom-table>
</a-card>
</a-spin>
<Detail v-if="isDetail" :type="fileName" :sampleId="currSampleId" :allData="detailJson" @back="handleBack"></Detail>
</div>
</template>
@ -69,6 +71,7 @@ export default {
},
data() {
return {
spinning: false,
isImmediate:true,
isDetail:false,
queryParam: {
@ -93,13 +96,6 @@ export default {
methods: {
handleExcel() {
if (this.dataSource.length>0) {
// this.queryParam = {
// dataType: "S",
// startTime: "2023-07-01",
// endTime: "2023-07-14",
// stationIds: [209],
// spectralQualifie:"FULL"
// }
let params = {
...this.queryParam,
pageType:this.pageType
@ -125,12 +121,6 @@ export default {
searchQueryData() {
this.isImmediate = false
this.loading = true
// this.queryParam = {
// dataType: "S",
// startTime: "2023-05-01",
// endTime: "2023-05-07",
// stationIds: [209, 211, 213]
// }
let params = {
...this.queryParam,
pageNo: 1,
@ -149,9 +139,10 @@ export default {
})
},
handleDetail(record) {
this.spinning = true
this.currSampleId = record.sampleId
getAction("webStatistics/findGeneratedReport", { sampleId: record.sampleId }).then(res => {
// getAction("webStatistics/findGeneratedReport", { sampleId: "1523651" }).then(res => {
this.spinning = false
if (res.success){
this.detailJson = res.result
this.detailJson = JSON.parse(JSON.stringify(this.detailJson))
@ -159,6 +150,8 @@ export default {
} else {
this.$message.warning("This operation fails. Contact your system administrator")
}
}).catch(err => {
this.spinning = false
})
},
handleBack(flag) {