优化缓存页面 修复缓存页面导致数据不一致的问题

2024年9月9日shanao
shanao 2024-10-23 14:31:03 +08:00
parent 999fbe52e5
commit 4dcae30533
5 changed files with 29 additions and 12 deletions

View File

@ -41,7 +41,9 @@
border border
fit fit
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="40"/>
<el-table-column type="index" label="序号" width="50" align="center" /> <el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="CORP_NAME" label="公司名称" show-overflow-tooltip /> <el-table-column prop="CORP_NAME" label="公司名称" show-overflow-tooltip />
<!-- <el-table-column prop="STARTTIME" label="属地" show-overflow-tooltip> <!-- <el-table-column prop="STARTTIME" label="属地" show-overflow-tooltip>
@ -95,7 +97,6 @@ import Pagination from '@/components/Pagination' // 通过 el-pagination二次
import { requestFN } from '@/utils/request' import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' import waves from '@/directive/waves'
import axios from 'axios' import axios from 'axios'
import dayjs from 'dayjs' // waves directive
export default { export default {
name: 'IndexVue', name: 'IndexVue',
components: { Pagination }, components: { Pagination },
@ -122,7 +123,9 @@ export default {
OUTSOURCED_NAME: '', OUTSOURCED_NAME: '',
CORP_NAME: '', CORP_NAME: '',
varList: [], varList: [],
row: null row: null,
/** 当前选中行 */
multipleSelection: []
} }
}, },
created() { created() {
@ -168,12 +171,22 @@ export default {
this.row = row this.row = row
}, },
/**
* 表格行选择器处理
*/
handleSelectionChange(val) {
console.log('表格行选择器处理')
this.multipleSelection = val
},
exportExcel() { exportExcel() {
if (this.row == null || this.row.CORPINFO_ID == null || this.row.CORPINFO_ID === '') { const selectedRows = this.multipleSelection
this.$message.error('请选择公司') //
if (selectedRows === [] || selectedRows.length === 0) {
this.$message.warning('请选择要导出的公司')
return return
} }
this.$confirm('确定要下载' + this.row.CORP_NAME + '的检查数据吗?', { this.$confirm('确定要下载' + selectedRows[0].CORP_NAME + '的检查数据吗?', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@ -185,16 +198,20 @@ export default {
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}) })
axios.get(config.httpurl + '/keyprojectcheck/export/excel/' + this.row.CORPINFO_ID, { let ids = ''
selectedRows.forEach(row => {
ids += row.CORPINFO_ID + ','
})
axios.get(config.httpurl + '/keyprojectcheck/export/excel/' + ids, {
responseType: 'blob' responseType: 'blob'
}).then(res => { }).then(res => {
setTimeout(() => { setTimeout(() => {
const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) const blob = new Blob([res.data], { type: res.headers['content-type'] })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) const href = window.URL.createObjectURL(blob)
downloadElement.style.display = 'none' downloadElement.style.display = 'none'
downloadElement.href = href downloadElement.href = href
downloadElement.download = this.row.CORP_NAME downloadElement.download = '导出数据'
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) document.body.removeChild(downloadElement)

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<keep-alive> <keep-alive exclude="meteorologicalList,meteorologicalHistory">
<component :is="activeName"/> <component :is="activeName"/>
</keep-alive> </keep-alive>
</div> </div>

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<keep-alive> <keep-alive exclude="meteorologicalinfoList">
<component :is="activeName"/> <component :is="activeName"/>
</keep-alive> </keep-alive>
</div> </div>

View File

@ -1,5 +1,5 @@
<template> <template>
<keep-alive> <keep-alive exclude="CorpUserList,CorpUserDetail">
<component :is="activeName" /> <component :is="activeName" />
</keep-alive> </keep-alive>
</template> </template>

View File

@ -1,5 +1,5 @@
<template> <template>
<keep-alive> <keep-alive exclude="CorpUserList">
<component :is="activeName" /> <component :is="activeName" />
</keep-alive> </keep-alive>
</template> </template>