Commit fa925fdb authored by cat's avatar cat

路由保存数据

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