refactor: Discover Router done.
This commit is contained in:
@@ -80,7 +80,7 @@ export default {
|
||||
showNavbarBreadcrumb: false,
|
||||
navViewData:
|
||||
{
|
||||
// FILES: ['ALL', 'DISCOVER', 'COMPARE', 'DESIGN'],
|
||||
// FILES: ['ALL', 'DISCOVER', 'COMPARE', 'DESIGN', 'SIMULATION'],
|
||||
FILES: ['ALL', 'DISCOVER', 'COMPARE'],
|
||||
// DISCOVER: ['MAP', 'CONFORMANCE', 'PERFORMANCE', 'DATA']
|
||||
DISCOVER: ['MAP', 'CONFORMANCE', 'PERFORMANCE'],
|
||||
@@ -132,6 +132,7 @@ export default {
|
||||
switchNavItem(event) {
|
||||
let type;
|
||||
let fileId;
|
||||
let isCheckPage;
|
||||
|
||||
this.isActive = event.target.innerText;
|
||||
switch (this.navViewName) {
|
||||
@@ -141,22 +142,20 @@ export default {
|
||||
case 'DISCOVER':
|
||||
type = this.$route.params.type;
|
||||
fileId = this.$route.params.fileId;
|
||||
isCheckPage = this.$route.name.includes('Check');
|
||||
|
||||
switch (event.target.innerText) {
|
||||
case 'MAP':
|
||||
if(type === 'rule') this.$router.push({name: 'CheckMap'});
|
||||
if(isCheckPage) this.$router.push({name: 'CheckMap', params: { type: type, fileId: fileId }});
|
||||
else this.$router.push({name: 'Map', params: { type: type, fileId: fileId }});
|
||||
break;
|
||||
case 'CONFORMANCE':
|
||||
if(type === 'rule') this.$router.push({name: 'CheckConformance'});
|
||||
if(isCheckPage) this.$router.push({name: 'CheckConformance', params: { type: type, fileId: fileId }});
|
||||
else this.$router.push({name: 'Conformance', params: { type: type, fileId: fileId }});
|
||||
break
|
||||
case 'PERFORMANCE':
|
||||
if(type === 'rule') {
|
||||
type = this.$route.params.checkType;
|
||||
fileId = this.$route.params.checkFileId;
|
||||
}
|
||||
this.$router.push({name: 'Performance', params: { type: type, fileId: fileId }});
|
||||
if(isCheckPage) this.$router.push({name: 'CheckPerformance', params: { type: type, fileId: fileId }});
|
||||
else this.$router.push({name: 'Performance', params: { type: type, fileId: fileId }});
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -185,6 +184,7 @@ export default {
|
||||
this.isActive = 'CONFORMANCE';
|
||||
break;
|
||||
case 'Performanc':
|
||||
case 'CheckPerformanc':
|
||||
this.isActive = 'PERFORMANCE';
|
||||
break;
|
||||
}
|
||||
@@ -219,14 +219,15 @@ export default {
|
||||
}else if(this.logId){
|
||||
await saveFilter(this.allMapDataStore.addFilterId);
|
||||
// 存檔後為 filterID,換網址不跳頁,使用 push 記錄歷史路由
|
||||
await this.$router.push(`/discover/map/filter/${this.createFilterId}`);
|
||||
await this.$router.push(`/discover/filter/${this.createFilterId}/map`);
|
||||
};
|
||||
break;
|
||||
case 'CheckMap':
|
||||
// 無論 parentLog, parentFilter,做新 filter 皆另存新檔
|
||||
await saveFilter(this.allMapDataStore.addFilterId);
|
||||
// 存檔後為 filterID,換網址不跳頁,使用 push 記錄歷史路由
|
||||
await this.$router.push(`/discover/map/filter/${this.createFilterId}`);
|
||||
await this.$router.push(`/discover/filter/${this.createFilterId}/map`);
|
||||
console.log('Check Map save filter need to check_id');
|
||||
case 'Conformance':
|
||||
case 'CheckConformance':
|
||||
// 先判斷有沒有 check Id,有就儲存 return,沒有就往下走
|
||||
@@ -237,8 +238,8 @@ export default {
|
||||
} else {
|
||||
await saveConformance(this.conformanceStore.addConformanceCreateCheckId);
|
||||
// 存檔後為 checkID,換網址不跳頁,使用 push 記錄歷史路由
|
||||
if(this.conformanceLogId) await this.$router.push(`/rule/log/${this.conformanceLogCreateCheckId}/conformance/${this.conformanceLogId}`);
|
||||
else if(this.conformanceFilterId) await this.$router.push(`/rule/filter/${this.conformanceFilterCreateCheckId}/conformance/${this.conformanceFilterId}`);
|
||||
if(this.conformanceLogId) await this.$router.push(`/discover/conformance/log/${this.conformanceLogCreateCheckId}/conformance`);
|
||||
else if(this.conformanceFilterId) await this.$router.push(`/discover/conformance/filter/${this.conformanceFilterCreateCheckId}/conformance`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user