feat: Conformance Save Logout done.

This commit is contained in:
chiayin
2023-12-01 14:24:05 +08:00
parent c26a1dfee7
commit 8b502e67f4
8 changed files with 78 additions and 49 deletions

View File

@@ -1,10 +1,4 @@
<template>
<!-- conformanceLogId: {{ conformanceLogId }} <br>
conformanceFilterId: {{ conformanceFilterId }} <br>
conformanceLogTempCheckId: {{ conformanceLogTempCheckId }} <br>
conformanceFilterTempCheckId: {{ conformanceFilterTempCheckId }} <br>
conformanceLogCreateCheckId: {{ conformanceLogCreateCheckId }} <br>
conformanceFilterCreateCheckId: {{ conformanceFilterCreateCheckId }} <br> -->
<main class="h-screen-main relative">
<div class="h-full relative bg-neutral-50">
<ConformanceSidebar></ConformanceSidebar>
@@ -57,14 +51,18 @@ export default {
this.conformanceLogCreateCheckId = params.checkId;
// 為複寫 Modal 取得 fileName
await this.filesStore.fetchConformanceLog();
await this.allConformanceLog.forEach(file => this.conformanceFileName = file.id == this.conformanceLogCreateCheckId ? file.name : null);
await this.allConformanceLog.forEach(file => {
if(file.id == this.conformanceLogCreateCheckId) return this.conformanceFileName = file.name;
});
break;
case 'filter':
this.conformanceFilterId = params.checkFileId;
this.conformanceFilterCreateCheckId = params.checkId;
// 為複寫 Modal 取得 fileName
await this.filesStore.fetchConformanceFilter();
await this.allConformanceFilter.forEach(file => this.conformanceFileName = file.id == this.conformanceFilterCreateCheckId ? file.name : null);
await this.allConformanceFilter.forEach(file => {
if(file.id == this.conformanceFilterCreateCheckId) return this.conformanceFileName = file.name;
});
}
await this.conformanceStore.getConformanceReport();
break;

View File

@@ -67,9 +67,9 @@ export default {
const loadingStore = LoadingStore();
const allMapDataStore = AllMapDataStore();
const { isLoading } = storeToRefs(loadingStore);
const { processMap, bpmn, stats, insights, traceId, traces, baseTraces, baseTraceId, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, temporaryData, isRuleData, ruleData, logId, baseLogId, createFilterId, cases } = storeToRefs(allMapDataStore);
const { processMap, bpmn, stats, insights, traceId, traces, baseTraces, baseTraceId, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, temporaryData, isRuleData, ruleData, logId, baseLogId, createFilterId, cases, postRuleData } = storeToRefs(allMapDataStore);
return { isLoading, processMap, bpmn, stats, insights, traceId, traces, baseTraces, baseTraceId, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, logId, baseLogId, createFilterId, temporaryData, isRuleData, ruleData, allMapDataStore, cases }
return { isLoading, processMap, bpmn, stats, insights, traceId, traces, baseTraces, baseTraceId, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, logId, baseLogId, createFilterId, temporaryData, isRuleData, ruleData, allMapDataStore, cases, postRuleData }
},
props:['type', 'checkType', 'checkId', 'checkFileId'], // 來自 router 的 props
components: {
@@ -387,5 +387,13 @@ export default {
this.sidebarState = boolean;
});
},
beforeUnmount() {
this.logId = null;
this.createFilterId = null;
this.tempFilterId = null;
this.temporaryData = [];
this.postRuleData = [];
this.ruleData = [];
}
}
</script>

View File

@@ -31,17 +31,6 @@ export default {
return { checkLogin, loadingStore, temporaryData, tempFilterId, createFilterId, postRuleData, ruleData, allMapDataStore };
},
watch: {
$route: function(to, from) {
// 離開 Map Log 頁要將 Funnel 的規則刪除, Map Filter 會帶上次儲存的 Funnel, 所以不用做
if(from.name === 'Map' && from.params.type === 'log') {
this.tempFilterId = null;
this.temporaryData = [];
this.postRuleData = [];
this.ruleData = [];
}
}
},
components: {
Header,
Navbar,
@@ -58,14 +47,14 @@ export default {
this.checkLogin();
},
beforeRouteUpdate(to, from, next) {
// 離開 Discover 頁時判斷是否有無資料和需要存檔
if ((from.name === 'Map') && this.tempFilterId) {
// 離開 Map 頁時判斷是否有無資料和需要存檔
if ((from.name === 'Map' || from.name === 'CheckMap') && this.tempFilterId) {
// 傳給 Map通知 Sidebar 要關閉。
this.$emitter.emit('leaveFilter', false);
leaveFilter(next, this.allMapDataStore.addFilterId, to.path)
} else {
next();
}
} else if((this.$route.name === 'Conformance' || this.$route.name === 'CheckConformance') && (this.conformanceLogTempCheckId || this.conformanceFilterTempCheckId)) {
leaveFilter(false, this.conformanceStore.addConformanceCreateCheckId, false, this.logOut)
} else next();
},
};
</script>