Commit fa925fdb authored by cat's avatar cat

路由保存数据

parent ee16b1da
......@@ -310,7 +310,6 @@ export default {
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
console.log("離開路由前賦值")
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
......
......@@ -505,6 +505,11 @@ export default {
this.getDict()
this.getList()
this.getCodeDict()
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
},
methods: {
parseTime,
......
......@@ -224,6 +224,8 @@ export default {
const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
this.dateRange[0] = this.queryParams.beginTime
this.dateRange[1] = this.queryParams.endTime
}
this.getList()
},
......
......@@ -439,6 +439,7 @@ export default {
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
console.log('this.queryParams', this.queryParams)
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
......@@ -453,6 +454,8 @@ export default {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
this.dateRange[0] = this.queryParams.beginTime
this.dateRange[1] = this.queryParams.endTime
}
this.getList()
this.getDict()
......@@ -530,12 +533,23 @@ export default {
/** TODO: 重置按钮操作 */
resetQuery() {
this.queryParams = {
page: 1,
rows: 10,
beginTime: '',
endTime: '',
// TODO: 0表示倒序排序,1表示顺序排序
tableSortMark: 0,
entity: {
// TODO: 设备编码
pn: '',
// TODO: lot
lot: '',
// TODO: 位置
plocation: '',
// TODO: 库状态 1 入,2出,3修正,4废弃
poperate: '',
// TODO: 库类型 1设备库 2工序库
ptype: ''
}
}
......
......@@ -427,6 +427,14 @@ export default {
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters
const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
this.dateRange[0] = this.queryParams.beginTime
this.dateRange[1] = this.queryParams.endTime
}
this.getUserName()
this.getYsList()
this.getDict()
......
......@@ -554,6 +554,12 @@ export default {
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters
const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getDict()
this.getList()
},
......
......@@ -581,6 +581,12 @@ export default {
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters
const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getDict()
this.getList()
},
......
......@@ -452,6 +452,8 @@ export default {
const {path} = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = {...param}
this.dateRange[0] = this.queryParams.beginTime
this.dateRange[1] = this.queryParams.endTime
}
this.getList()
this.getDict()
......
......@@ -211,6 +211,8 @@ export default {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
this.dateRange[0] = this.queryParams.beginTime
this.dateRange[1] = this.queryParams.endTime
}
this.getList()
},
......
......@@ -318,7 +318,22 @@ export default {
basicinfoMationList: []
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getList()
},
methods: {
......
......@@ -434,7 +434,22 @@ export default {
basicinfoMationList: []
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getDict()
this.getList()
},
......
......@@ -401,7 +401,22 @@ export default {
basicinfoMationList: []
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getDict()
this.getList()
},
......
......@@ -188,7 +188,23 @@ export default {
basicinfoMationList: []
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters
const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getList()
},
methods: {
......
......@@ -170,7 +170,23 @@ export default {
basicinfoMationList: []
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters
const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getList()
},
methods: {
......
......@@ -317,6 +317,13 @@ export default {
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
this.dateRange[0] = this.queryParams.beginTime
this.dateRange[1] = this.queryParams.endTime
}
this.getList()
},
// 监听回车
......
......@@ -350,6 +350,13 @@ export default {
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
this.dateRange[0] = this.queryParams.beginTime
this.dateRange[1] = this.queryParams.endTime
}
this.getList()
},
// 监听回车
......
......@@ -199,7 +199,23 @@ export default {
basicinfoMationList: []
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters
const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getList()
},
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