Commit 2b358e76 authored by 杨硕's avatar 杨硕

回滚代码(切换页面保留查询条件)

parent 22147c5a
...@@ -96,10 +96,10 @@ ...@@ -96,10 +96,10 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="解锁人" prop="pnumber"> <el-table-column label="解锁人" prop="pnumber">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.unlockUsername|| '-' }} {{ scope.row.unlockUsername|| '-' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="解锁时间" prop="pnumber"> <el-table-column label="解锁时间" prop="pnumber">
<template slot-scope="scope"> <template slot-scope="scope">
{{ parseTime(scope.row.unlockDate, '{y}-{m}-{d} {h}:{i}') || '-' }} {{ parseTime(scope.row.unlockDate, '{y}-{m}-{d} {h}:{i}') || '-' }}
...@@ -365,7 +365,7 @@ ...@@ -365,7 +365,7 @@
</div> </div>
<el-form ref="form" :model="loginform" label-width="80px"> <el-form ref="form" :model="loginform" label-width="80px">
<el-form-item label="用户名"> <el-form-item label="用户名">
<el-input v-model="loginform.password" placeholder="请输入用户名" /> <el-input v-model="loginform.password" placeholder="请输入用户名" />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button type="primary" @click="handleConfirm">确定</el-button>
...@@ -493,15 +493,19 @@ export default { ...@@ -493,15 +493,19 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('equipmentParams', JSON.stringify(this.queryParams))
path: this.$route.path,
param: {
...this.queryParams
}
})
next() next()
// this.$store.dispatch('searchSave/searchParamsSet', {
// path: this.$route.path,
// param: {
// ...this.queryParams
// }
// })
}, },
created() { created() {
if (sessionStorage.getItem('equipmentParams')) {
this.queryParams = JSON.parse(sessionStorage.getItem('equipmentParams'))
}
this.getDict() this.getDict()
this.getList() this.getList()
this.getCodeDict() this.getCodeDict()
......
...@@ -212,20 +212,23 @@ export default { ...@@ -212,20 +212,23 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('twoRecord', JSON.stringify(this.queryEntity))
path: this.$route.path, sessionStorage.setItem('twoDateRange', JSON.stringify(this.dateRange))
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (this.$store.getters.searchParams[this.$route.path]) { if (sessionStorage.getItem('twoRecord')) {
const { searchParams } = this.$store.getters this.queryEntity = JSON.parse(sessionStorage.getItem('twoRecord'))
const { path } = this.$route }
const param = JSON.parse(searchParams[path]) // 保留着的查询条件 if (sessionStorage.getItem('twoDateRange')) {
this.queryParams = { ...param } this.dateRange = JSON.parse(sessionStorage.getItem('twoDateRange'))
if (this.dateRange !== null) {
this.queryParams.beginTime = this.dateRange[0] + ' 00:00:00'
this.queryParams.endTime = this.dateRange[1] + ' 23:59:00'
} else {
this.queryParams.beginTime = ''
this.queryParams.endTime = ''
}
} }
this.getList() this.getList()
}, },
...@@ -259,6 +262,7 @@ export default { ...@@ -259,6 +262,7 @@ export default {
if (this.queryParams.beginTime === '' || this.queryParams.endTime === '') { if (this.queryParams.beginTime === '' || this.queryParams.endTime === '') {
this.dateRange = [] this.dateRange = []
} }
console.log('dateRange',this.dateRange)
listdevice(this.queryParams, this.addDateRange(this.queryEntity, this.dateRange)).then(response => { listdevice(this.queryParams, this.addDateRange(this.queryEntity, this.dateRange)).then(response => {
// console.log('list', response) // console.log('list', response)
this.equipmentList = response.rows this.equipmentList = response.rows
......
...@@ -442,19 +442,16 @@ export default { ...@@ -442,19 +442,16 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('oneRecord', JSON.stringify(this.queryEntity))
path: this.$route.path, sessionStorage.setItem('oneDateRange', JSON.stringify(this.dateRange))
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (this.$store.getters.searchParams[this.$route.path]) { if (sessionStorage.getItem('oneRecord')) {
const { searchParams } = this.$store.getters; const { path } = this.$route this.queryEntity = JSON.parse(sessionStorage.getItem('oneRecord'))
const param = JSON.parse(searchParams[path]) // 保留着的查询条件 }
this.queryParams = { ...param } if (sessionStorage.getItem('oneDateRange')) {
this.dateRange = JSON.parse(sessionStorage.getItem('oneDateRange'))
} }
this.getList() this.getList()
this.getDict() this.getDict()
......
...@@ -421,15 +421,24 @@ export default { ...@@ -421,15 +421,24 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('threeRecord', JSON.stringify(this.queryEntity))
path: this.$route.path, sessionStorage.setItem('threeDateRange', JSON.stringify(this.dateRange))
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (sessionStorage.getItem('threeRecord')) {
this.queryEntity = JSON.parse(sessionStorage.getItem('threeRecord'))
}
if (sessionStorage.getItem('threeDateRange')) {
this.dateRange = JSON.parse(sessionStorage.getItem('threeDateRange'))
if (this.dateRange !== null) {
this.queryParams.beginTime = this.dateRange[0] + ' 00:00:00'
this.queryParams.endTime = this.dateRange[1] + ' 23:59:00'
} else {
this.queryParams.beginTime = ''
this.queryParams.endTime = ''
}
}
this.getUserName() this.getUserName()
this.getYsList() this.getYsList()
this.getDict() this.getDict()
......
...@@ -545,15 +545,13 @@ export default { ...@@ -545,15 +545,13 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('fourParams', JSON.stringify(this.queryParams))
path: this.$route.path,
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (sessionStorage.getItem('fourParams')) {
this.queryParams = JSON.parse(sessionStorage.getItem('fourParams'))
}
this.getDict() this.getDict()
this.getList() this.getList()
}, },
......
...@@ -572,15 +572,13 @@ export default { ...@@ -572,15 +572,13 @@ export default {
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('sixParams', JSON.stringify(this.queryParams))
path: this.$route.path,
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (sessionStorage.getItem('sixParams')) {
this.queryParams = JSON.parse(sessionStorage.getItem('sixParams'))
}
this.getDict() this.getDict()
this.getList() this.getList()
}, },
......
...@@ -442,20 +442,16 @@ export default { ...@@ -442,20 +442,16 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('fiveRecord', JSON.stringify(this.queryEntity))
path: this.$route.path, sessionStorage.setItem('fiveDateRange', JSON.stringify(this.dateRange))
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (this.$store.getters.searchParams[this.$route.path]) { if (sessionStorage.getItem('fiveRecord')) {
const {searchParams} = this.$store.getters; this.queryEntity = JSON.parse(sessionStorage.getItem('fiveRecord'))
const {path} = this.$route }
const param = JSON.parse(searchParams[path]) // 保留着的查询条件 if (sessionStorage.getItem('fiveDateRange')) {
this.queryParams = {...param} this.dateRange = JSON.parse(sessionStorage.getItem('fiveDateRange'))
} }
this.getList() this.getList()
this.getDict() this.getDict()
......
...@@ -200,19 +200,23 @@ export default { ...@@ -200,19 +200,23 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('sevenRecord', JSON.stringify(this.queryEntity))
path: this.$route.path, sessionStorage.setItem('sevenDateRange', JSON.stringify(this.dateRange))
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (this.$store.getters.searchParams[this.$route.path]) { if (sessionStorage.getItem('sevenRecord')) {
const { searchParams } = this.$store.getters; const { path } = this.$route this.queryEntity = JSON.parse(sessionStorage.getItem('sevenRecord'))
const param = JSON.parse(searchParams[path]) // 保留着的查询条件 }
this.queryParams = { ...param } if (sessionStorage.getItem('sevenDateRange')) {
this.dateRange = JSON.parse(sessionStorage.getItem('sevenDateRange'))
if (this.dateRange !== null) {
this.queryParams.beginTime = this.dateRange[0] + ' 00:00:00'
this.queryParams.endTime = this.dateRange[1] + ' 23:59:00'
} else {
this.queryParams.beginTime = ''
this.queryParams.endTime = ''
}
} }
this.getList() this.getList()
}, },
......
...@@ -188,7 +188,15 @@ export default { ...@@ -188,7 +188,15 @@ export default {
basicinfoMationList: [] basicinfoMationList: []
} }
}, },
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
sessionStorage.setItem('sampleOneParams', JSON.stringify(this.queryParams))
next()
},
created() { created() {
if (sessionStorage.getItem('sampleOneParams')) {
this.queryParams = JSON.parse(sessionStorage.getItem('sampleOneParams'))
}
this.getList() this.getList()
}, },
methods: { methods: {
......
...@@ -170,7 +170,15 @@ export default { ...@@ -170,7 +170,15 @@ export default {
basicinfoMationList: [] basicinfoMationList: []
} }
}, },
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
sessionStorage.setItem('sampleThreeParams', JSON.stringify(this.queryParams))
next()
},
created() { created() {
if (sessionStorage.getItem('sampleThreeParams')) {
this.queryParams = JSON.parse(sessionStorage.getItem('sampleThreeParams'))
}
this.getList() this.getList()
}, },
methods: { methods: {
......
...@@ -311,15 +311,24 @@ export default { ...@@ -311,15 +311,24 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('sampleFiveRecord', JSON.stringify(this.queryEntity))
path: this.$route.path, sessionStorage.setItem('sampleFiveDateRange', JSON.stringify(this.dateRange))
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (sessionStorage.getItem('sampleFiveRecord')) {
this.queryEntity = JSON.parse(sessionStorage.getItem('sampleFiveRecord'))
}
if (sessionStorage.getItem('sampleFiveDateRange')) {
this.dateRange = JSON.parse(sessionStorage.getItem('sampleFiveDateRange'))
if (this.dateRange !== null) {
this.queryParams.beginTime = this.dateRange[0] + ' 00:00:00'
this.queryParams.endTime = this.dateRange[1] + ' 23:59:00'
} else {
this.queryParams.beginTime = ''
this.queryParams.endTime = ''
}
}
this.getList() this.getList()
}, },
// 监听回车 // 监听回车
......
...@@ -344,15 +344,24 @@ export default { ...@@ -344,15 +344,24 @@ export default {
}, },
/** 路由离开前存储筛选条件*/ /** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', { sessionStorage.setItem('sampleFourRecord', JSON.stringify(this.queryEntity))
path: this.$route.path, sessionStorage.setItem('sampleFourDateRange', JSON.stringify(this.dateRange))
param: {
...this.queryParams
}
})
next() next()
}, },
created() { created() {
if (sessionStorage.getItem('sampleFourRecord')) {
this.queryEntity = JSON.parse(sessionStorage.getItem('sampleFourRecord'))
}
if (sessionStorage.getItem('sampleFourDateRange')) {
this.dateRange = JSON.parse(sessionStorage.getItem('sampleFourDateRange'))
if (this.dateRange !== null) {
this.queryParams.beginTime = this.dateRange[0] + ' 00:00:00'
this.queryParams.endTime = this.dateRange[1] + ' 23:59:00'
} else {
this.queryParams.beginTime = ''
this.queryParams.endTime = ''
}
}
this.getList() this.getList()
}, },
// 监听回车 // 监听回车
......
...@@ -199,7 +199,15 @@ export default { ...@@ -199,7 +199,15 @@ export default {
basicinfoMationList: [] basicinfoMationList: []
} }
}, },
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
sessionStorage.setItem('sampleTwoParams', JSON.stringify(this.queryParams))
next()
},
created() { created() {
if (sessionStorage.getItem('sampleTwoParams')) {
this.queryParams = JSON.parse(sessionStorage.getItem('sampleTwoParams'))
}
this.getList() this.getList()
}, },
methods: { methods: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment