Commit 3fd02a18 by 冒粤蓉

improve menu

1 parent 098fd495
...@@ -40,7 +40,7 @@ function render({ data = {} , container } = {}) { ...@@ -40,7 +40,7 @@ function render({ data = {} , container } = {}) {
render: h => h(App), render: h => h(App),
}).$mount(container ? container.querySelector('#glsx-sub-system') : '#glsx-sub-system'); }).$mount(container ? container.querySelector('#glsx-sub-system') : '#glsx-sub-system');
router.beforeEach((to,from,next)=>{ router.beforeEach((to, from, next)=>{
const metaTitle = to.meta.title; const metaTitle = to.meta.title;
if(metaTitle) { if(metaTitle) {
const thisBreadCrumb = data.store.getters.curBreadCrumb; const thisBreadCrumb = data.store.getters.curBreadCrumb;
......
...@@ -86,6 +86,7 @@ export default { ...@@ -86,6 +86,7 @@ export default {
data() { data() {
return { return {
DICTSTATUS: this.$Constants.DICT_STATUS, DICTSTATUS: this.$Constants.DICT_STATUS,
storageParams: {},
searchForm: { searchForm: {
name: '' name: ''
}, },
...@@ -198,20 +199,49 @@ export default { ...@@ -198,20 +199,49 @@ export default {
} }
}, },
mounted() { mounted() {
this.searchForm.name = this.$route.params.row.dictName let params = this.$route.params;
this.dictDataForm.dictType = this.$route.params.row.dictType if((JSON.stringify(params) === '{}' || !params)) {
this.dictDataForm.enableStatus = this.$route.params.row.enableStatus params = this.getInitStorage();
this.storageParams = params;
}
if(params) {
this.searchForm.name = params.row.dictName
this.dictDataForm.dictType = params.row.dictType
this.dictDataForm.enableStatus = params.row.enableStatus
}
}, },
methods: { methods: {
getInitStorage() {
const getStorageParams = localStorage.getItem('dictionaryParams');
if(getStorageParams) {
return JSON.parse(getStorageParams);
} else {
return '';
}
},
// 重置搜索条件 // 重置搜索条件
refresh() { refresh() {
let name = '';
if(this.$route.params.row) {
name = this.$route.params.row.dictName;
} else if(this.storageParams.row) {
name = this.storageParams.row.dictName;
}
this.searchForm = { this.searchForm = {
name: this.$route.params.row.dictName name
} }
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.searchForm.type = this.$route.params.row.dictType let getDictType = '';
setTimeout(() => {
if(this.$route.params.row) {
getDictType = this.$route.params.row.dictType;
} else if(this.storageParams.row) {
getDictType = this.storageParams.row.dictType;
}
this.searchForm.type = getDictType;
if (this.searchForm.daterange) { if (this.searchForm.daterange) {
this.searchForm.sDate = this.searchForm.daterange[0] this.searchForm.sDate = this.searchForm.daterange[0]
this.searchForm.eDate = this.searchForm.daterange[1] this.searchForm.eDate = this.searchForm.daterange[1]
...@@ -220,6 +250,7 @@ export default { ...@@ -220,6 +250,7 @@ export default {
if (this.searchForm.sDate) delete this.searchForm.sDate && delete this.searchForm.eDate if (this.searchForm.sDate) delete this.searchForm.sDate && delete this.searchForm.eDate
} }
resolve() resolve()
}, 100)
}) })
}, },
// 确定 // 确定
......
...@@ -277,7 +277,7 @@ export default { ...@@ -277,7 +277,7 @@ export default {
case 'list': case 'list':
console.log('list', scope) console.log('list', scope)
const listData = { row: scope }; const listData = { row: scope };
localStorage.setItem('dictionaryParams', listData); localStorage.setItem('dictionaryParams', JSON.stringify(listData));
this.$router.push({ name: 'dictionaryData', params: listData }); this.$router.push({ name: 'dictionaryData', params: listData });
break break
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!