Commit 3fd02a18 by 冒粤蓉

improve menu

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