Discover: Filters Save done.
This commit is contained in:
@@ -50,7 +50,7 @@ import filesStore from '@/stores/files.js';
|
||||
import AllMapDataStore from '@/stores/allMapData.js';
|
||||
import IconSearch from '@/components/icons/IconSearch.vue';
|
||||
import IconSetting from '@/components/icons/IconSetting.vue';
|
||||
import { saveFilter } from '@/module/alertModal.js';
|
||||
import { saveFilter, savedSuccessfully } from '@/module/alertModal.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -72,22 +72,38 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'$route':'getNavViewName',
|
||||
filterName: function(newVal, oldVal) {
|
||||
this.filterName = newVal;
|
||||
},
|
||||
// createfilterId: function(newVal, oldVal) {
|
||||
// // this.filterName = newVal;
|
||||
// console.log(newVal);
|
||||
// console.log(oldVal);
|
||||
// },
|
||||
postRuleData: function(newVal, oldVal) {
|
||||
// this.filterName = newVal;
|
||||
console.log(newVal);
|
||||
console.log(oldVal);
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const store = filesStore();
|
||||
const allMapDataStore = AllMapDataStore();
|
||||
const { tempFilterId } = storeToRefs(allMapDataStore);
|
||||
const { tempFilterId, createfilterId, filterName, postRuleData, isUpdataFilter } = storeToRefs(allMapDataStore);
|
||||
|
||||
return { store, allMapDataStore, tempFilterId}
|
||||
return { store, allMapDataStore, tempFilterId, createfilterId, filterName, postRuleData, isUpdataFilter}
|
||||
},
|
||||
components: {
|
||||
IconSearch,
|
||||
IconSetting,
|
||||
saveFilter
|
||||
saveFilter,
|
||||
savedSuccessfully
|
||||
},
|
||||
mounted() {
|
||||
this.showNavbarBreadcrumb = this.$route.matched[0].name !== ('AuthContainer')? true : false;
|
||||
this.getNavViewName();
|
||||
let filterId = this.$route.params.filterId;
|
||||
this.createfilterId = filterId;
|
||||
},
|
||||
methods: {
|
||||
switchNavItem(event) {
|
||||
@@ -98,9 +114,14 @@ export default {
|
||||
},
|
||||
showAlert() {
|
||||
// 先判斷有沒有 filter Id,有就儲存 return,沒有就往下走
|
||||
|
||||
// 沒有 filter Id, 有暫存 tempFilterId Id 可以另存新檔
|
||||
saveFilter(this.allMapDataStore.addFilterId);
|
||||
// 沒有 filter Id, 有暫存 tempFilterId Id 可以另存新檔
|
||||
if(this.createfilterId) {
|
||||
this.allMapDataStore.updataFilter();
|
||||
console.log(this.isUpdataFilter);
|
||||
if(this.isUpdataFilter) savedSuccessfully(this.filterName);
|
||||
}else{
|
||||
saveFilter(this.allMapDataStore.addFilterId);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user