所有下载的按钮增加load效果,如果下载失败记得关掉load

出现不能查询的提示,table的loading应该关闭了
台站下拉框增加过滤
This commit is contained in:
任珮宇 2023-11-16 14:19:12 +08:00
parent 5861337d44
commit f6450af8b2
7 changed files with 245 additions and 201 deletions

View File

@ -7,6 +7,7 @@
</div>
<div class="top-actions">
<div class="right-btn" @click="downloadZip">
<a-icon v-if="zipLoading" style="margin-right: 10px" type="loading" />
<img class="icon-download" src="../../assets/images/web-statistics/download.png" alt="" />
<span style="margin-left: 10px"> ZIP </span>
</div>
@ -301,6 +302,7 @@ export default {
},
data() {
return {
zipLoading: false,
yAxisType_g: 'value',
yAxisType_b: 'value',
spectrumChart_G: null,
@ -630,6 +632,7 @@ export default {
}
},
async downloadZip() {
this.zipLoading = true
let url = '/webStatistics/downloadFile'
let params = { sampleId: this.sampleId }
// let params = { sampleId: 7480344 }
@ -637,6 +640,8 @@ export default {
await fetchAndDownload(url, params, 'get')
} catch (error) {
console.error(error)
} finally {
this.zipLoading = false
}
},
viewFile() {

View File

@ -1,9 +1,10 @@
<template>
<div style="height: 100%;">
<div style="height: 100%">
<a-card :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">
<a-button @click="handleExcel" type="primary">
<a-icon v-if="excelLoading" style="margin-right: 10px" type="loading" />
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
Excel
</a-button>
@ -32,7 +33,7 @@ const columns = [
{
title: 'NO',
align: 'left',
width:80,
width: 80,
scopedSlots: {
customRender: 'index',
},
@ -70,13 +71,13 @@ const columns = [
title: 'AVG.REL.HUMIDITY',
align: 'left',
dataIndex: 'aveHumidity',
width:200
width: 200,
},
{
title: 'AVG.BAR.READING',
align: 'left',
dataIndex: 'avePressure',
width:200
width: 200,
},
{
title: 'AVG.TEMP.',
@ -87,15 +88,15 @@ const columns = [
title: 'AVG.WIND.DIRECTION',
align: 'left',
dataIndex: 'aveWindDir',
width:220
width: 220,
},
{
title: 'AVG.WIND.SPEED',
align: 'left',
dataIndex: 'aveWindSpeed',
}
},
]
import { compareDate } from "../../commom"
import { compareDate } from '../../commom'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, getFileAction } from '../../../../api/manage'
import dateFormat from '../../../../components/jeecg/JEasyCron/format-date'
@ -104,12 +105,13 @@ export default {
mixins: [JeecgListMixin],
data() {
return {
isImmediate:true,
excelLoading: false,
isImmediate: true,
columns,
queryParam: {
startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
stationIds: []
stationIds: [],
},
url: {
list: '/webStatistics/findMetPage',
@ -119,8 +121,8 @@ export default {
},
stationList: [],
dataSource: [],
strIds: "",
allChecked:false
strIds: '',
allChecked: false,
}
},
created() {
@ -128,18 +130,20 @@ export default {
},
methods: {
handleExcel() {
if (this.dataSource.length>0) {
if (this.dataSource.length > 0) {
this.excelLoading = true
let params = {
...this.queryParam,
}
getFileAction("/webStatistics/metExport", params).then(res => {
getFileAction('/webStatistics/metExport', params).then((res) => {
this.excelLoading = false
if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
} else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = "MET"
link.download = 'MET'
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href)
@ -147,7 +151,7 @@ export default {
}
})
} else {
this.$message.warning("No downloadable data")
this.$message.warning('No downloadable data')
}
},
searchQueryData() {
@ -158,7 +162,7 @@ export default {
let params = {
...this.queryParam,
pageNo: 1,
pageSize: 10
pageSize: 10,
}
getAction(this.url.list, params).then((res) => {
this.loading = false
@ -168,24 +172,25 @@ export default {
this.ipagination.total = res.result.total
this.dataSource = res.result.records
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
} else {
this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.")
this.loading = false
this.$message.info('Maximum timespan duration is 10 days. Please, change start or end date.')
}
},
findStationList() {
getAction(this.url.findStationList, { menuName: '' }).then((res) => {
if (res.result.length>0) {
if (res.result.length > 0) {
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
} else {
this.stationList=[]
this.stationList = []
}
})
},
handleSelectChange(val) {
console.log(val);
console.log(val)
let length = this.stationList.length
if (val.length === length) {
this.allChecked = true
@ -196,12 +201,15 @@ export default {
handleSelectChangeAll(val) {
this.allChecked = val
if (val) {
this.queryParam.stationIds = this.stationList.map(item => item.value)
this.queryParam.stationIds = this.stationList.map((item) => item.value)
} else {
this.queryParam.stationIds =[]
}
this.queryParam.stationIds = []
}
},
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
},
computed: {
formItems() {
return [
@ -224,20 +232,19 @@ export default {
label: 'Stations',
name: 'stationIds',
props: {
allChecked:this.allChecked,
allChecked: this.allChecked,
filterOption: this.filterOption,
placeholder: 'select stations',
mode: 'multiple',
maxTagCount: 1,
options: [
...this.stationList,
],
options: [...this.stationList],
style: {
width: '200px',
},
},
on: {
change: this.handleSelectChange,
changeAll: this.handleSelectChangeAll
changeAll: this.handleSelectChangeAll,
},
style: {
width: 'auto',
@ -281,7 +288,7 @@ export default {
}
</script>
<style lang="less" scoped>
.icon-edit{
.icon-edit {
margin-right: 10px;
}
</style>

View File

@ -1,9 +1,10 @@
<template>
<div style="height: 100%;">
<div style="height: 100%">
<a-card :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">
<a-button @click="handleExcel" type="primary">
<a-icon v-if="excelLoading" style="margin-right: 10px" type="loading" />
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
Excel
</a-button>
@ -32,7 +33,7 @@ const columns = [
{
title: 'NO',
align: 'left',
width:100,
width: 100,
scopedSlots: {
customRender: 'index',
},
@ -54,28 +55,28 @@ const columns = [
{
title: 'TYPE',
align: 'left',
width:200,
width: 200,
dataIndex: 'alertType',
},
{
title: 'TIME',
align: 'left',
width:200,
width: 200,
dataIndex: 'time',
},
{
title: 'STATION',
align: 'left',
width:200,
width: 200,
dataIndex: 'stationCode',
},
{
title: 'ENTRIES',
align: 'left',
dataIndex: 'alertText',
}
},
]
import { compareDate } from "../../commom"
import { compareDate } from '../../commom'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, getFileAction } from '../../../../api/manage'
import dateFormat from '../../../../components/jeecg/JEasyCron/format-date'
@ -84,12 +85,13 @@ export default {
mixins: [JeecgListMixin],
data() {
return {
isImmediate:true,
excelLoading: false,
isImmediate: true,
columns,
queryParam: {
startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
stationIds: []
stationIds: [],
},
url: {
list: '/webStatistics/findAlertSohPage',
@ -99,8 +101,8 @@ export default {
},
stationList: [],
dataSource: [],
strIds: "",
allChecked:false
strIds: '',
allChecked: false,
}
},
created() {
@ -108,7 +110,8 @@ export default {
},
methods: {
handleExcel() {
if (this.dataSource.length>0) {
if (this.dataSource.length > 0) {
this.excelLoading = true
// this.queryParam = {
// startTime: "2023-07-17",
// endTime: "2023-07-17",
@ -117,14 +120,15 @@ export default {
let params = {
...this.queryParam,
}
getFileAction("/webStatistics/alertsExport", params).then(res => {
getFileAction('/webStatistics/alertsExport', params).then((res) => {
this.excelLoading = false
if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
} else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = "ALERTS"
link.download = 'ALERTS'
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href)
@ -132,7 +136,7 @@ export default {
}
})
} else {
this.$message.warning("No downloadable data")
this.$message.warning('No downloadable data')
}
},
searchQueryData() {
@ -148,7 +152,7 @@ export default {
let params = {
...this.queryParam,
pageNo: 1,
pageSize: 10
pageSize: 10,
}
getAction(this.url.list, params).then((res) => {
this.loading = false
@ -158,28 +162,29 @@ export default {
this.ipagination.total = res.result.total
this.dataSource = res.result.records
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
} else {
this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.")
this.loading = false
this.$message.info('Maximum timespan duration is 10 days. Please, change start or end date.')
}
},
findStationList() {
getAction(this.url.findStationList, { menuName: '' }).then((res) => {
if (res.success) {
if (res.result.length>0) {
if (res.result.length > 0) {
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
} else {
this.stationList=[]
this.stationList = []
}
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
},
handleSelectChange(val) {
console.log(val);
console.log(val)
let length = this.stationList.length
if (val.length === length) {
this.allChecked = true
@ -190,12 +195,15 @@ export default {
handleSelectChangeAll(val) {
this.allChecked = val
if (val) {
this.queryParam.stationIds = this.stationList.map(item => item.value)
this.queryParam.stationIds = this.stationList.map((item) => item.value)
} else {
this.queryParam.stationIds =[]
}
this.queryParam.stationIds = []
}
},
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
},
computed: {
formItems() {
return [
@ -218,20 +226,19 @@ export default {
label: 'Stations',
name: 'stationIds',
props: {
allChecked:this.allChecked,
allChecked: this.allChecked,
filterOption: this.filterOption,
placeholder: 'select stations',
mode: 'multiple',
maxTagCount: 1,
options: [
...this.stationList,
],
options: [...this.stationList],
style: {
width: '200px',
},
},
on: {
change: this.handleSelectChange,
changeAll: this.handleSelectChangeAll
changeAll: this.handleSelectChangeAll,
},
style: {
width: 'auto',
@ -275,7 +282,7 @@ export default {
}
</script>
<style lang="less" scoped>
.icon-edit{
.icon-edit {
margin-right: 10px;
}
</style>

View File

@ -1,9 +1,10 @@
<template>
<div style="height: 100%;">
<div style="height: 100%">
<a-card v-if="!isFileDetail" :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">
<a-button @click="handleExcel" type="primary">
<a-icon v-if="excelLoading" style="margin-right: 10px" type="loading" />
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
Excel
</a-button>
@ -70,13 +71,13 @@ const columns = [
title: 'SID',
align: 'left',
dataIndex: 'sohId',
}
},
]
import { compareDate } from "../../commom"
import { compareDate } from '../../commom'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, getFileAction } from '../../../../api/manage'
import dateFormat from '../../../../components/jeecg/JEasyCron/format-date'
import FileDetail from "../../fileDetail.vue"
import FileDetail from '../../fileDetail.vue'
export default {
name: 'menuTree',
mixins: [JeecgListMixin],
@ -85,12 +86,13 @@ export default {
},
data() {
return {
isImmediate:true,
excelLoading: false,
isImmediate: true,
columns,
queryParam: {
startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
stationIds: []
stationIds: [],
},
url: {
list: '/webStatistics/findSohPage',
@ -100,10 +102,10 @@ export default {
},
stationList: [],
dataSource: [],
strIds: "",
strIds: '',
allChecked: false,
isFileDetail: false,
currSampleId:""
currSampleId: '',
}
},
created() {
@ -111,18 +113,20 @@ export default {
},
methods: {
handleExcel() {
if (this.dataSource.length>0) {
if (this.dataSource.length > 0) {
this.excelLoading = true
let params = {
...this.queryParam,
}
getFileAction("/webStatistics/sohExport", params).then(res => {
getFileAction('/webStatistics/sohExport', params).then((res) => {
this.excelLoading = false
if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
} else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = "RMSSOH"
link.download = 'RMSSOH'
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href)
@ -130,14 +134,14 @@ export default {
}
})
} else {
this.$message.warning("No downloadable data")
this.$message.warning('No downloadable data')
}
},
handleBack(flag) {
this.isFileDetail = flag
},
handleDetail(record) {
console.log(record);
console.log(record)
this.currSampleId = record.sohId
this.isFileDetail = true
},
@ -154,7 +158,7 @@ export default {
let params = {
...this.queryParam,
pageNo: 1,
pageSize: 10
pageSize: 10,
}
getAction(this.url.list, params).then((res) => {
this.loading = false
@ -164,28 +168,29 @@ export default {
this.ipagination.total = res.result.total
this.dataSource = res.result.records
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
} else {
this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.")
this.loading = false
this.$message.info('Maximum timespan duration is 10 days. Please, change start or end date.')
}
},
findStationList() {
getAction(this.url.findStationList, { menuName: '' }).then((res) => {
if (res.success) {
if (res.result.length>0) {
if (res.result.length > 0) {
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
} else {
this.stationList=[]
this.stationList = []
}
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
},
handleSelectChange(val) {
console.log(val);
console.log(val)
let length = this.stationList.length
if (val.length === length) {
this.allChecked = true
@ -196,12 +201,15 @@ export default {
handleSelectChangeAll(val) {
this.allChecked = val
if (val) {
this.queryParam.stationIds = this.stationList.map(item => item.value)
this.queryParam.stationIds = this.stationList.map((item) => item.value)
} else {
this.queryParam.stationIds =[]
}
this.queryParam.stationIds = []
}
},
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
},
computed: {
formItems() {
return [
@ -224,20 +232,19 @@ export default {
label: 'Stations',
name: 'stationIds',
props: {
allChecked:this.allChecked,
allChecked: this.allChecked,
filterOption: this.filterOption,
placeholder: 'select stations',
mode: 'multiple',
maxTagCount: 1,
options: [
...this.stationList,
],
options: [...this.stationList],
style: {
width: '200px',
},
},
on: {
change: this.handleSelectChange,
changeAll: this.handleSelectChangeAll
changeAll: this.handleSelectChangeAll,
},
style: {
width: 'auto',
@ -281,7 +288,7 @@ export default {
}
</script>
<style lang="less" scoped>
.icon-edit{
.icon-edit {
margin-right: 10px;
}
</style>

View File

@ -1,9 +1,10 @@
<template>
<div style="height: 100%;">
<div style="height: 100%">
<a-card v-if="!isFileDetail" :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">
<a-button @click="handleExcel" type="primary">
<a-icon v-if="excelLoading" style="margin-right: 10px" type="loading" />
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
Excel
</a-button>
@ -70,13 +71,13 @@ const columns = [
title: 'SID',
align: 'left',
dataIndex: 'sampleId',
}
},
]
import { compareDate } from "../../commom"
import { compareDate } from '../../commom'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, getFileAction } from '../../../../api/manage'
import dateFormat from '../../../../components/jeecg/JEasyCron/format-date'
import FileDetail from "../../fileDetail.vue"
import FileDetail from '../../fileDetail.vue'
export default {
name: 'menuTree',
mixins: [JeecgListMixin],
@ -85,12 +86,13 @@ export default {
},
data() {
return {
isImmediate:true,
excelLoading: false,
isImmediate: true,
columns,
queryParam: {
startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
stationIds: []
stationIds: [],
},
url: {
list: '/radionuclide/findAutoPage',
@ -100,10 +102,10 @@ export default {
},
stationList: [],
dataSource: [],
strIds: "",
strIds: '',
allChecked: false,
isFileDetail: false,
currSampleId:""
currSampleId: '',
}
},
created() {
@ -112,18 +114,20 @@ export default {
},
methods: {
handleExcel() {
if (this.dataSource.length>0) {
if (this.dataSource.length > 0) {
this.excelLoading = true
let params = {
...this.queryParam,
}
getFileAction("/webStatistics/arrExport", params).then(res => {
getFileAction('/webStatistics/arrExport', params).then((res) => {
this.excelLoading = false
if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
} else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = "ARR"
link.download = 'ARR'
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href)
@ -131,7 +135,7 @@ export default {
}
})
} else {
this.$message.warning("No downloadable data")
this.$message.warning('No downloadable data')
}
},
handleBack(flag) {
@ -154,7 +158,7 @@ export default {
let params = {
...this.queryParam,
pageNo: 1,
pageSize: 10
pageSize: 10,
}
getAction(this.url.list, params).then((res) => {
this.loading = false
@ -164,32 +168,33 @@ export default {
this.ipagination.total = res.result.total
this.dataSource = res.result.records
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
} else {
this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.")
this.loading = false
this.$message.info('Maximum timespan duration is 10 days. Please, change start or end date.')
}
},
findStationList() {
getAction(this.url.findStationList, { menuName: '' }).then((res) => {
if (res.success) {
if (res.result.length>0) {
if (res.result.length > 0) {
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
//
this.queryParam.stationIds = this.stationList.map(item => item.value)
this.queryParam.stationIds = this.stationList.map((item) => item.value)
this.allChecked = true
this.searchQueryData()
} else {
this.stationList=[]
this.stationList = []
}
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
},
handleSelectChange(val) {
console.log(val);
console.log(val)
let length = this.stationList.length
if (val.length === length) {
this.allChecked = true
@ -200,32 +205,35 @@ export default {
handleSelectChangeAll(val) {
this.allChecked = val
if (val) {
this.queryParam.stationIds = this.stationList.map(item => item.value)
this.queryParam.stationIds = this.stationList.map((item) => item.value)
} else {
this.queryParam.stationIds =[]
this.queryParam.stationIds = []
}
},
getBeforeDate(n){
var n = n;
var d = new Date();
var year = d.getFullYear();
var mon=d.getMonth()+1;
var day=d.getDate();
if(day <= n){
if(mon>1) {
mon=mon-1;
getBeforeDate(n) {
var n = n
var d = new Date()
var year = d.getFullYear()
var mon = d.getMonth() + 1
var day = d.getDate()
if (day <= n) {
if (mon > 1) {
mon = mon - 1
} else {
year = year-1;
mon = 12;
year = year - 1
mon = 12
}
}
d.setDate(d.getDate()-n);
year = d.getFullYear();
mon=d.getMonth()+1;
day=d.getDate();
var s = year+"-"+(mon<10?('0'+mon):mon)+"-"+(day<10?('0'+day):day);
return s;
}
d.setDate(d.getDate() - n)
year = d.getFullYear()
mon = d.getMonth() + 1
day = d.getDate()
var s = year + '-' + (mon < 10 ? '0' + mon : mon) + '-' + (day < 10 ? '0' + day : day)
return s
},
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
},
computed: {
formItems() {
@ -249,20 +257,19 @@ export default {
label: 'Stations',
name: 'stationIds',
props: {
allChecked:this.allChecked,
allChecked: this.allChecked,
filterOption: this.filterOption,
placeholder: 'select stations',
mode: 'multiple',
maxTagCount: 1,
options: [
...this.stationList,
],
options: [...this.stationList],
style: {
width: '200px',
},
},
on: {
change: this.handleSelectChange,
changeAll: this.handleSelectChangeAll
changeAll: this.handleSelectChangeAll,
},
style: {
width: 'auto',
@ -306,7 +313,7 @@ export default {
}
</script>
<style lang="less" scoped>
.icon-edit{
.icon-edit {
margin-right: 10px;
}
</style>

View File

@ -1,9 +1,10 @@
<template>
<div style="height: 100%;">
<div style="height: 100%">
<a-card v-if="!isFileDetail" :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">
<a-button @click="handleExcel" type="primary">
<a-icon v-if="excelLoading" style="margin-right: 10px" type="loading" />
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
Excel
</a-button>
@ -70,13 +71,13 @@ const columns = [
title: 'SID',
align: 'left',
dataIndex: 'sampleId',
}
},
]
import { compareDate } from "../../commom"
import { compareDate } from '../../commom'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, getFileAction } from '../../../../api/manage'
import dateFormat from '../../../../components/jeecg/JEasyCron/format-date'
import FileDetail from "../../fileDetail.vue"
import FileDetail from '../../fileDetail.vue'
export default {
name: 'menuTree',
mixins: [JeecgListMixin],
@ -85,12 +86,13 @@ export default {
},
data() {
return {
isImmediate:true,
excelLoading: false,
isImmediate: true,
columns,
queryParam: {
startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
stationIds: []
stationIds: [],
},
url: {
list: '/radionuclide/findReviewedPage',
@ -100,10 +102,10 @@ export default {
},
stationList: [],
dataSource: [],
strIds: "",
strIds: '',
allChecked: false,
isFileDetail: false,
currSampleId:""
currSampleId: '',
}
},
created() {
@ -112,18 +114,20 @@ export default {
},
methods: {
handleExcel() {
if (this.dataSource.length>0) {
if (this.dataSource.length > 0) {
this.excelLoading = true
let params = {
...this.queryParam,
}
getFileAction("/webStatistics/rrrExport", params).then(res => {
getFileAction('/webStatistics/rrrExport', params).then((res) => {
this.excelLoading = false
if (res.code && res.code == 500) {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
} else {
const blob = new Blob([res], { type: "application/vnd.ms-excel" })
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = "RRR"
link.download = 'RRR'
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href)
@ -131,7 +135,7 @@ export default {
}
})
} else {
this.$message.warning("No downloadable data")
this.$message.warning('No downloadable data')
}
},
handleBack(flag) {
@ -154,7 +158,7 @@ export default {
let params = {
...this.queryParam,
pageNo: 1,
pageSize: 10
pageSize: 10,
}
getAction(this.url.list, params).then((res) => {
this.loading = false
@ -164,32 +168,33 @@ export default {
this.ipagination.total = res.result.total
this.dataSource = res.result.records
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
} else {
this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.")
this.loading = false
this.$message.info('Maximum timespan duration is 10 days. Please, change start or end date.')
}
},
findStationList() {
getAction(this.url.findStationList, { menuName: '' }).then((res) => {
if (res.success) {
if (res.result.length>0) {
if (res.result.length > 0) {
this.stationList = res.result.map((res) => ({ label: res.stationCode, value: res.stationId }))
//
this.queryParam.stationIds = this.stationList.map(item => item.value)
this.queryParam.stationIds = this.stationList.map((item) => item.value)
this.allChecked = true
this.searchQueryData()
} else {
this.stationList=[]
this.stationList = []
}
} else {
this.$message.warning("This operation fails. Contact your system administrator")
this.$message.warning('This operation fails. Contact your system administrator')
}
})
},
handleSelectChange(val) {
console.log(val);
console.log(val)
let length = this.stationList.length
if (val.length === length) {
this.allChecked = true
@ -200,32 +205,35 @@ export default {
handleSelectChangeAll(val) {
this.allChecked = val
if (val) {
this.queryParam.stationIds = this.stationList.map(item => item.value)
this.queryParam.stationIds = this.stationList.map((item) => item.value)
} else {
this.queryParam.stationIds =[]
this.queryParam.stationIds = []
}
},
getBeforeDate(n){
var n = n;
var d = new Date();
var year = d.getFullYear();
var mon=d.getMonth()+1;
var day=d.getDate();
if(day <= n){
if(mon>1) {
mon=mon-1;
getBeforeDate(n) {
var n = n
var d = new Date()
var year = d.getFullYear()
var mon = d.getMonth() + 1
var day = d.getDate()
if (day <= n) {
if (mon > 1) {
mon = mon - 1
} else {
year = year-1;
mon = 12;
year = year - 1
mon = 12
}
}
d.setDate(d.getDate()-n);
year = d.getFullYear();
mon=d.getMonth()+1;
day=d.getDate();
var s = year+"-"+(mon<10?('0'+mon):mon)+"-"+(day<10?('0'+day):day);
return s;
}
d.setDate(d.getDate() - n)
year = d.getFullYear()
mon = d.getMonth() + 1
day = d.getDate()
var s = year + '-' + (mon < 10 ? '0' + mon : mon) + '-' + (day < 10 ? '0' + day : day)
return s
},
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
},
computed: {
formItems() {
@ -249,20 +257,19 @@ export default {
label: 'Stations',
name: 'stationIds',
props: {
allChecked:this.allChecked,
allChecked: this.allChecked,
filterOption: this.filterOption,
placeholder: 'select stations',
mode: 'multiple',
maxTagCount: 1,
options: [
...this.stationList,
],
options: [...this.stationList],
style: {
width: '200px',
},
},
on: {
change: this.handleSelectChange,
changeAll: this.handleSelectChangeAll
changeAll: this.handleSelectChangeAll,
},
style: {
width: 'auto',
@ -306,7 +313,7 @@ export default {
}
</script>
<style lang="less" scoped>
.icon-edit{
.icon-edit {
margin-right: 10px;
}
</style>

View File

@ -5,6 +5,7 @@
<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">
<a-icon v-if="excelLoading" style="margin-right: 10px" type="loading" />
<img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
Excel
</a-button>
@ -89,6 +90,7 @@ export default {
},
data() {
return {
excelLoading: false,
spinning: false,
isImmediate: true,
isDetail: false,
@ -115,11 +117,13 @@ export default {
methods: {
handleExcel() {
if (this.dataSource.length > 0) {
this.excelLoading = true
let params = {
...this.queryParam,
pageType: this.pageType,
}
getFileAction('/webStatistics/radionuclideExport', params).then((res) => {
this.excelLoading = false
if (res.code && res.code == 500) {
this.$message.warning('This operation fails. Contact your system administrator')
} else {