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

View File

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

View File

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