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

View File

@ -1,9 +1,10 @@
<template> <template>
<div style="height: 100%;"> <div style="height: 100%">
<a-card :bordered="false" style="margin-left: 20px"> <a-card :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">
<a-button @click="handleExcel" type="primary"> <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="" /> <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
Excel Excel
</a-button> </a-button>
@ -70,13 +71,13 @@ const columns = [
title: 'AVG.REL.HUMIDITY', title: 'AVG.REL.HUMIDITY',
align: 'left', align: 'left',
dataIndex: 'aveHumidity', dataIndex: 'aveHumidity',
width:200 width: 200,
}, },
{ {
title: 'AVG.BAR.READING', title: 'AVG.BAR.READING',
align: 'left', align: 'left',
dataIndex: 'avePressure', dataIndex: 'avePressure',
width:200 width: 200,
}, },
{ {
title: 'AVG.TEMP.', title: 'AVG.TEMP.',
@ -87,15 +88,15 @@ const columns = [
title: 'AVG.WIND.DIRECTION', title: 'AVG.WIND.DIRECTION',
align: 'left', align: 'left',
dataIndex: 'aveWindDir', dataIndex: 'aveWindDir',
width:220 width: 220,
}, },
{ {
title: 'AVG.WIND.SPEED', title: 'AVG.WIND.SPEED',
align: 'left', align: 'left',
dataIndex: 'aveWindSpeed', dataIndex: 'aveWindSpeed',
} },
] ]
import { compareDate } from "../../commom" import { compareDate } from '../../commom'
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, getFileAction } from '../../../../api/manage' import { getAction, getFileAction } from '../../../../api/manage'
import dateFormat from '../../../../components/jeecg/JEasyCron/format-date' import dateFormat from '../../../../components/jeecg/JEasyCron/format-date'
@ -104,12 +105,13 @@ export default {
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
data() { data() {
return { return {
excelLoading: false,
isImmediate: true, isImmediate: true,
columns, columns,
queryParam: { queryParam: {
startTime: dateFormat(new Date(), 'yyyy-MM-dd'), startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
endTime: dateFormat(new Date(), 'yyyy-MM-dd'), endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
stationIds: [] stationIds: [],
}, },
url: { url: {
list: '/webStatistics/findMetPage', list: '/webStatistics/findMetPage',
@ -119,8 +121,8 @@ export default {
}, },
stationList: [], stationList: [],
dataSource: [], dataSource: [],
strIds: "", strIds: '',
allChecked:false allChecked: false,
} }
}, },
created() { created() {
@ -129,17 +131,19 @@ export default {
methods: { methods: {
handleExcel() { handleExcel() {
if (this.dataSource.length > 0) { if (this.dataSource.length > 0) {
this.excelLoading = true
let params = { let params = {
...this.queryParam, ...this.queryParam,
} }
getFileAction("/webStatistics/metExport", params).then(res => { getFileAction('/webStatistics/metExport', params).then((res) => {
this.excelLoading = false
if (res.code && res.code == 500) { 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 { } 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') let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob) link.href = window.URL.createObjectURL(blob)
link.download = "MET" link.download = 'MET'
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
URL.revokeObjectURL(link.href) URL.revokeObjectURL(link.href)
@ -147,7 +151,7 @@ export default {
} }
}) })
} else { } else {
this.$message.warning("No downloadable data") this.$message.warning('No downloadable data')
} }
}, },
searchQueryData() { searchQueryData() {
@ -158,7 +162,7 @@ export default {
let params = { let params = {
...this.queryParam, ...this.queryParam,
pageNo: 1, pageNo: 1,
pageSize: 10 pageSize: 10,
} }
getAction(this.url.list, params).then((res) => { getAction(this.url.list, params).then((res) => {
this.loading = false this.loading = false
@ -168,11 +172,12 @@ 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("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} }
}) })
} else { } 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() { findStationList() {
@ -185,7 +190,7 @@ export default {
}) })
}, },
handleSelectChange(val) { handleSelectChange(val) {
console.log(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
@ -196,11 +201,14 @@ export default {
handleSelectChangeAll(val) { handleSelectChangeAll(val) {
this.allChecked = val this.allChecked = val
if (val) { if (val) {
this.queryParam.stationIds = this.stationList.map(item => item.value) this.queryParam.stationIds = this.stationList.map((item) => item.value)
} else { } else {
this.queryParam.stationIds = [] this.queryParam.stationIds = []
} }
} },
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}, },
computed: { computed: {
formItems() { formItems() {
@ -225,19 +233,18 @@ export default {
name: 'stationIds', name: 'stationIds',
props: { props: {
allChecked: this.allChecked, allChecked: this.allChecked,
filterOption: this.filterOption,
placeholder: 'select stations', placeholder: 'select stations',
mode: 'multiple', mode: 'multiple',
maxTagCount: 1, maxTagCount: 1,
options: [ options: [...this.stationList],
...this.stationList,
],
style: { style: {
width: '200px', width: '200px',
}, },
}, },
on: { on: {
change: this.handleSelectChange, change: this.handleSelectChange,
changeAll: this.handleSelectChangeAll changeAll: this.handleSelectChangeAll,
}, },
style: { style: {
width: 'auto', width: 'auto',

View File

@ -1,9 +1,10 @@
<template> <template>
<div style="height: 100%;"> <div style="height: 100%">
<a-card :bordered="false" style="margin-left: 20px"> <a-card :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">
<a-button @click="handleExcel" type="primary"> <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="" /> <img class="icon-edit" src="@/assets/images/global/edit.png" alt="" />
Excel Excel
</a-button> </a-button>
@ -73,9 +74,9 @@ const columns = [
title: 'ENTRIES', title: 'ENTRIES',
align: 'left', align: 'left',
dataIndex: 'alertText', dataIndex: 'alertText',
} },
] ]
import { compareDate } from "../../commom" import { compareDate } from '../../commom'
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, getFileAction } from '../../../../api/manage' import { getAction, getFileAction } from '../../../../api/manage'
import dateFormat from '../../../../components/jeecg/JEasyCron/format-date' import dateFormat from '../../../../components/jeecg/JEasyCron/format-date'
@ -84,12 +85,13 @@ export default {
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
data() { data() {
return { return {
excelLoading: false,
isImmediate: true, isImmediate: true,
columns, columns,
queryParam: { queryParam: {
startTime: dateFormat(new Date(), 'yyyy-MM-dd'), startTime: dateFormat(new Date(), 'yyyy-MM-dd'),
endTime: dateFormat(new Date(), 'yyyy-MM-dd'), endTime: dateFormat(new Date(), 'yyyy-MM-dd'),
stationIds: [] stationIds: [],
}, },
url: { url: {
list: '/webStatistics/findAlertSohPage', list: '/webStatistics/findAlertSohPage',
@ -99,8 +101,8 @@ export default {
}, },
stationList: [], stationList: [],
dataSource: [], dataSource: [],
strIds: "", strIds: '',
allChecked:false allChecked: false,
} }
}, },
created() { created() {
@ -109,6 +111,7 @@ export default {
methods: { methods: {
handleExcel() { handleExcel() {
if (this.dataSource.length > 0) { if (this.dataSource.length > 0) {
this.excelLoading = true
// this.queryParam = { // this.queryParam = {
// startTime: "2023-07-17", // startTime: "2023-07-17",
// endTime: "2023-07-17", // endTime: "2023-07-17",
@ -117,14 +120,15 @@ export default {
let params = { let params = {
...this.queryParam, ...this.queryParam,
} }
getFileAction("/webStatistics/alertsExport", params).then(res => { getFileAction('/webStatistics/alertsExport', params).then((res) => {
this.excelLoading = false
if (res.code && res.code == 500) { 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 { } 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') let link = document.createElement('a')
link.href = window.URL.createObjectURL(blob) link.href = window.URL.createObjectURL(blob)
link.download = "ALERTS" link.download = 'ALERTS'
document.body.appendChild(link) document.body.appendChild(link)
link.click() link.click()
URL.revokeObjectURL(link.href) URL.revokeObjectURL(link.href)
@ -132,7 +136,7 @@ export default {
} }
}) })
} else { } else {
this.$message.warning("No downloadable data") this.$message.warning('No downloadable data')
} }
}, },
searchQueryData() { searchQueryData() {
@ -148,7 +152,7 @@ export default {
let params = { let params = {
...this.queryParam, ...this.queryParam,
pageNo: 1, pageNo: 1,
pageSize: 10 pageSize: 10,
} }
getAction(this.url.list, params).then((res) => { getAction(this.url.list, params).then((res) => {
this.loading = false this.loading = false
@ -158,11 +162,12 @@ 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("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} }
}) })
} else { } 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() { findStationList() {
@ -174,12 +179,12 @@ export default {
this.stationList = [] this.stationList = []
} }
} else { } else {
this.$message.warning("This operation fails. Contact your system administrator") this.$message.warning('This operation fails. Contact your system administrator')
} }
}) })
}, },
handleSelectChange(val) { handleSelectChange(val) {
console.log(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
@ -190,11 +195,14 @@ export default {
handleSelectChangeAll(val) { handleSelectChangeAll(val) {
this.allChecked = val this.allChecked = val
if (val) { if (val) {
this.queryParam.stationIds = this.stationList.map(item => item.value) this.queryParam.stationIds = this.stationList.map((item) => item.value)
} else { } else {
this.queryParam.stationIds = [] this.queryParam.stationIds = []
} }
} },
filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
},
}, },
computed: { computed: {
formItems() { formItems() {
@ -219,19 +227,18 @@ export default {
name: 'stationIds', name: 'stationIds',
props: { props: {
allChecked: this.allChecked, allChecked: this.allChecked,
filterOption: this.filterOption,
placeholder: 'select stations', placeholder: 'select stations',
mode: 'multiple', mode: 'multiple',
maxTagCount: 1, maxTagCount: 1,
options: [ options: [...this.stationList],
...this.stationList,
],
style: { style: {
width: '200px', width: '200px',
}, },
}, },
on: { on: {
change: this.handleSelectChange, change: this.handleSelectChange,
changeAll: this.handleSelectChangeAll changeAll: this.handleSelectChangeAll,
}, },
style: { style: {
width: 'auto', width: 'auto',

View File

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

View File

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

View File

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

View File

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