feat: Conformance Save Log Done.

This commit is contained in:
chiayin
2023-11-29 16:47:25 +08:00
parent f1666a0bd1
commit 1f0a6aa900
14 changed files with 628 additions and 71 deletions

View File

@@ -267,9 +267,15 @@ export default {
watch: {
conformanceTempReportData: {
handler: function(newValue) {
if(newValue?.rule && newValue.rule.min) {
this.selectDurationTime = {
min: newValue.rule.min,
max: newValue.rule.max,
}
}
this.data = this.setConformanceTempReportData(newValue);
},
}
},
},
methods: {
/**

View File

@@ -119,9 +119,9 @@ export default {
const loadingStore = LoadingStore();
const conformanceStore = ConformanceStore();
const { isLoading } = storeToRefs(loadingStore);
const { selectedRuleType, selectedActivitySequence, selectedMode, selectedProcessScope, selectedActSeqMore, selectedActSeqFromTo, conformanceAllTasks, cfmPtEteWhole, cfmPtEteStart, cfmPtEteEnd, cfmPtEteSE, cfmPtPStart, cfmPtPEnd, cfmPtPSE, cfmWtEteWhole, cfmWtEteStart, cfmWtEteEnd, cfmWtEteSE, cfmWtPStart, cfmWtPEnd, cfmWtPSE, cfmCtEteWhole, cfmCtEteStart, cfmCtEteEnd, cfmCtEteSE, isStartSelected, isEndSelected } = storeToRefs(conformanceStore);
const { selectedRuleType, selectedActivitySequence, selectedMode, selectedProcessScope, selectedActSeqMore, selectedActSeqFromTo, conformanceAllTasks, cfmPtEteWhole, cfmPtEteStart, cfmPtEteEnd, cfmPtEteSE, cfmPtPStart, cfmPtPEnd, cfmPtPSE, cfmWtEteWhole, cfmWtEteStart, cfmWtEteEnd, cfmWtEteSE, cfmWtPStart, cfmWtPEnd, cfmWtPSE, cfmCtEteWhole, cfmCtEteStart, cfmCtEteEnd, cfmCtEteSE, isStartSelected, isEndSelected, conformanceRuleData, conformanceLogCreateCheckId, conformanceFilterCreateCheckId, conformanceTempReportData } = storeToRefs(conformanceStore);
return { isLoading, selectedRuleType, selectedActivitySequence, selectedMode, selectedProcessScope, selectedActSeqMore, selectedActSeqFromTo, conformanceStore, conformanceAllTasks, cfmPtEteWhole, cfmPtEteStart, cfmPtEteEnd, cfmPtEteSE, cfmPtPStart, cfmPtPEnd, cfmPtPSE, cfmWtEteWhole, cfmWtEteStart, cfmWtEteEnd, cfmWtEteSE, cfmWtPStart, cfmWtPEnd, cfmWtPSE, cfmCtEteWhole, cfmCtEteStart, cfmCtEteEnd, cfmCtEteSE, isStartSelected, isEndSelected }
return { isLoading, selectedRuleType, selectedActivitySequence, selectedMode, selectedProcessScope, selectedActSeqMore, selectedActSeqFromTo, conformanceStore, conformanceAllTasks, cfmPtEteWhole, cfmPtEteStart, cfmPtEteEnd, cfmPtEteSE, cfmPtPStart, cfmPtPEnd, cfmPtPSE, cfmWtEteWhole, cfmWtEteStart, cfmWtEteEnd, cfmWtEteSE, cfmWtPStart, cfmWtPEnd, cfmWtPSE, cfmCtEteWhole, cfmCtEteStart, cfmCtEteEnd, cfmCtEteSE, isStartSelected, isEndSelected, conformanceRuleData, conformanceLogCreateCheckId, conformanceFilterCreateCheckId, conformanceTempReportData }
},
data() {
return {
@@ -396,6 +396,220 @@ export default {
watch: {
isSubmitData: function(newValue) {
this.isSubmitData = newValue;
},
// 打開 rule 檔要顯示儲存的選項、規則、時間
conformanceTempReportData: {
handler: function(newValue) {
this.isLoading = true;
setTimeout(() => {
if(newValue !== null) {
const rule = newValue.rule;
this.isSubmitData = newValue.rule;
this.isSubmit = true;
switch (rule.type) {
case 'contains-tasks': // Rule Type 選 Have activity 的行為
this.selectedRuleType = 'Have activity';
this.isSubmitTask = rule.tasks;
break;
case 'start-end': // Rule Type 選 Activity sequence 的行為
this.selectedRuleType = 'Activity sequence';
this.isSubmitStartAndEnd = [
{category: 'Start', task: rule.starts_with},
{category: 'End', task: rule.ends_with},
];
// this.isSubmitShowDataSeq = this.setSubmitShowData(rule.start, rule.end);
break;
case 'directly-follows': // Activity Sequence 選 Sequence 的行為
this.selectedRuleType = 'Sequence';
this.selectedMode = 'Directly follows';
this.isSubmitCfmSeqDirectly = rule.task_seq;
break;
case 'eventually-follows':
this.selectedRuleType = 'Sequence';
this.selectedMode = 'Eventually follows';
this.isSubmitCfmSeqEventually = rule.task_seq;
break;
case 'short-loops':
this.selectedRuleType = 'Sequence';
this.selectedMode = 'Short loop(s)';
break;
case 'self-loops':
this.selectedRuleType = 'Sequence';
this.selectedMode = 'Self loop(s)';
break;
case 'task-duration': // Rule Type 選 Activity duration 的行為
this.selectedRuleType = 'Activity duration';
this.isSubmitDurationData = [rule.task];
this.isSubmitDurationTime = { min: rule.min, max: rule.max};
break;
case 'processing-time-end-to-end-whole': // Rule Type 選 Processing time 的行為
this.selectedRuleType = 'Processing time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'All';
this.isSubmitTimeCfmPtEteAll = { min: rule.min, max: rule.max};
break;
case 'processing-time-end-to-end-starts-with':
this.selectedRuleType = 'Processing time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'Start';
this.isSubmitCfmPtEteStart = [
{category: 'Start', task: rule.task}
];
this.isSubmitTimeCfmPtEteStart = { min: rule.min, max: rule.max};
break;
case 'processing-time-end-to-end-ends-with':
this.selectedRuleType = 'Processing time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'End';
this.isSubmitCfmPtEteEnd = [
{category: 'End', task: rule.task}
];
this.isSubmitTimeCfmPtEteEnd = { min: rule.min, max: rule.max};
break;
case 'processing-time-end-to-end-start-end':
this.selectedRuleType = 'Processing time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'Start & End';
this.isSubmitCfmPtEteSE = [
{category: 'Start', task: rule.start},
{category: 'End', task: rule.end}
];
this.isSubmitTimeCfmPtEteSE = { min: rule.min, max: rule.max};
// this.isSubmitShowDataPtEte = this.setSubmitShowData(rule.start, rule.end);
break;
case 'processing-time-partial-starts-with':
this.selectedRuleType = 'Processing time';
this.selectedProcessScope = 'Partial';
this.selectedActSeqFromTo = 'From';
this.isSubmitCfmPtPStart = [
{category: 'From', task: rule.task}
];
this.isSubmitTimeCfmPtPStart = { min: rule.min, max: rule.max};
break;
case 'processing-time-partial-ends-with':
this.selectedRuleType = 'Processing time';
this.selectedProcessScope = 'Partial';
this.selectedActSeqFromTo = 'To';
this.isSubmitCfmPtPEnd = [
{category: 'To', task: rule.task}
];
this.isSubmitTimeCfmPtPEnd = { min: rule.min, max: rule.max};
break;
case 'processing-time-partial-start-end':
this.selectedRuleType = 'Processing time';
this.selectedProcessScope = 'Partial';
this.selectedActSeqFromTo = 'From & To';
this.isSubmitCfmPtPSE = [
{category: 'From', task: rule.start},
{category: 'To', task: rule.end}
];
this.isSubmitTimeCfmPtPSE = { min: rule.min, max: rule.max};
this.isSubmitShowDataPtP = this.setSubmitShowData(rule.start, rule.end);
break;
case 'waiting-time-end-to-end-whole': // Rule Type 選 Waiting time 的行為
this.selectedRuleType = 'Waiting time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'All';
this.isSubmitTimeCfmWtEteAll = { min: rule.min, max: rule.max};
break;
case 'waiting-time-end-to-end-starts-with':
this.selectedRuleType = 'Waiting time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'Start';
this.isSubmitCfmWtEteStart = [
{category: 'Start', task: rule.task}
];
this.isSubmitTimeCfmWtEteStart = { min: rule.min, max: rule.max};
break;
case 'waiting-time-end-to-end-ends-with':
this.selectedRuleType = 'Waiting time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'End';
this.isSubmitCfmWtEteEnd = [
{category: 'End', task: rule.task}
];
this.isSubmitTimeCfmWtEteEnd = { min: rule.min, max: rule.max};
break;
case 'waiting-time-end-to-end-start-end':
this.selectedRuleType = 'Waiting time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'Start & End';
this.isSubmitCfmWtEteSE = [
{category: 'Start', task: rule.start},
{category: 'End', task: rule.end}
];
this.isSubmitTimeCfmWtEteSE = { min: rule.min, max: rule.max};
this.isSubmitShowDataWtEte = this.setSubmitShowData(rule.start, rule.end);
break;
case 'waiting-time-partial-starts-with':
this.selectedRuleType = 'Waiting time';
this.selectedProcessScope = 'Partial';
this.selectedActSeqFromTo = 'From';
this.isSubmitCfmWtPStart = [
{category: 'From', task: rule.task}
];
this.isSubmitTimeCfmWtPStart = { min: rule.min, max: rule.max};
break;
case 'waiting-time-partial-ends-with':
this.selectedRuleType = 'Waiting time';
this.selectedProcessScope = 'Partial';
this.selectedActSeqFromTo = 'To';
this.isSubmitCfmWtPEnd = [
{category: 'To', task: rule.task}
];
this.isSubmitTimeCfmWtPEnd = { min: rule.min, max: rule.max};
break;
case 'waiting-time-partial-start-end':
this.selectedRuleType = 'Waiting time';
this.selectedProcessScope = 'Partial';
this.selectedActSeqFromTo = 'From & To';
this.isSubmitCfmWtPSE = [
{category: 'From', task: rule.start},
{category: 'To', task: rule.end}
];
this.isSubmitTimeCfmWtPSE = { min: rule.min, max: rule.max};
this.isSubmitShowDataWtP = this.setSubmitShowData(rule.start, rule.end);
break;
case 'cycle-time-end-to-end-whole': // Rule Type 選 Cycle time 的行為
this.selectedRuleType = 'Cycle time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'All';
this.isSubmitTimeCfmCtEteAll = { min: rule.min, max: rule.max};
break;
case 'cycle-time-end-to-end-starts-with':
this.selectedRuleType = 'Cycle time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'Start';
this.isSubmitCfmCtEteStart = [
{category: 'Start', task: rule.task}
];
this.isSubmitTimeCfmCtEteStart = { min: rule.min, max: rule.max};
break;
case 'cycle-time-end-to-end-ends-with':
this.selectedRuleType = 'Cycle time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'End';
this.isSubmitCfmCtEteEnd = [
{category: 'End', task: rule.task}
];
this.isSubmitTimeCfmCtEteEnd = { min: rule.min, max: rule.max};
break;
case 'cycle-time-end-to-end-start-end':
this.selectedRuleType = 'Cycle time';
this.selectedProcessScope = 'End to end';
this.selectedActSeqMore = 'Start & End';
this.isSubmitCfmCtEteSE = [
{category: 'Start', task: rule.start},
{category: 'End', task: rule.end}
];
this.isSubmitTimeCfmCtEteSE = { min: rule.min, max: rule.max};
this.isSubmitShowDataCt = this.setSubmitShowData(rule.start, rule.end);
break;
}
}
}, 200);
}
}
},
methods: {
@@ -675,8 +889,6 @@ export default {
this.isSubmitTimeCfmPtEteSE = this.selectDurationTime;
this.isSubmitShowDataPtEte = this.setSubmitShowData(this.selectCfmPtEteSEStart, this.selectCfmPtEteSEEnd);
break;
default:
break;
};
break;
case 'Partial':
@@ -899,8 +1111,6 @@ export default {
break;
};
break;
default:
break;
};
if(data.min > data.max) return this.$toast.error('Please check time range setting.');
if(JSON.stringify(data) === JSON.stringify(this.isSubmitData)) return this.$toast.error('Please set the new rule.');
@@ -908,6 +1118,7 @@ export default {
this.isLoading = true;
this.isSubmit = true;
this.isSubmitData = data; // 已 Apply 後,沒有重新改變規則的 Data
this.conformanceRuleData = data; // 給存檔的 Data
await this.conformanceStore.addConformanceCheckId(data);
await this.conformanceStore.getConformanceReport();
this.isShowBar = false;
@@ -918,7 +1129,7 @@ export default {
},
},
created() {
this.isShowBar = true;
this.isShowBar = this.conformanceLogCreateCheckId || this.conformanceFilterCreateCheckId ? false : true;
// 選取 list 的結果
this.$emitter.on('actListData', (data) => {
this.selectConformanceTask = data;

View File

@@ -27,6 +27,9 @@ export default {
},
immediate: true, // 立即執行一次排序
},
select: function(newValue) {
this.actList = newValue;
}
},
methods: {
actListData() {

View File

@@ -11,6 +11,19 @@
<script>
export default {
name: 'ResultArrow',
props:['data'],
props:['data', 'select'],
// data() {
// return {
// datadata: []
// }
// },
// watch: {
// data: function(newValue) {
// this.datadata = newValue;
// },
// select: function(newValue) {
// this.datadata = newValue;
// }
// }
}
</script>

View File

@@ -20,6 +20,9 @@ export default {
watch: {
data: function(newValue) {
this.datadata = newValue;
},
select: function(newValue) {
this.datadata = newValue;
}
},
created() {

View File

@@ -148,15 +148,23 @@ export default {
}
},
async mounted() {
if(this.$route.params.type === 'log') this.logId = this.$route.params.fileId;
switch (this.$route.params.type) {
let params = this.$route.params;
switch (params.type) {
case 'log':
this.logId = this.$route.params.fileId;
this.logId = params.fileId;
break;
case 'filter':
this.createFilterId = this.$route.params.fileId;
break;
default:
this.createFilterId = params.fileId;
break;
case 'rule':
switch (params.checkType) {
case 'log':
this.logId = params.checkFileId;
break;
case 'filter':
this.createFilterId = params.checkFileId;
}
break;
}
await this.allMapDataStore.getAllMapData();

View File

@@ -24,7 +24,6 @@ import loginStore from '@/stores/login.js';
import DspLogo from '@/components/icons/DspLogo.vue';
import IconMember from '@/components/icons/IconMember.vue';
import AllMapDataStore from '@/stores/allMapData.js';
import { logoutLeave } from '@/module/alertModal.js';
export default {
data() {

View File

@@ -48,11 +48,27 @@
import { storeToRefs } from 'pinia';
import filesStore from '@/stores/files.js';
import AllMapDataStore from '@/stores/allMapData.js';
import ConformanceStore from '@/stores/conformance.js';
import IconSearch from '@/components/icons/IconSearch.vue';
import IconSetting from '@/components/icons/IconSetting.vue';
import { saveFilter, savedSuccessfully } from '@/module/alertModal.js';
export default {
setup() {
const store = filesStore();
const allMapDataStore = AllMapDataStore();
const conformanceStore = ConformanceStore();
const { logId, tempFilterId, createFilterId, filterName, postRuleData, isUpdataFilter } = storeToRefs(allMapDataStore);
const { conformanceRuleData, conformanceLogId, conformanceFilterId, conformanceLogTempCheckId, conformanceFilterTempCheckId, conformanceLogCreateCheckId, conformanceFilterCreateCheckId, isUpdataConformance, conformanceFileName } = storeToRefs(conformanceStore);
return { store, allMapDataStore, logId, tempFilterId, createFilterId, filterName, postRuleData, isUpdataFilter, conformanceStore, conformanceRuleData, conformanceLogId, conformanceFilterId, conformanceLogTempCheckId, conformanceFilterTempCheckId, conformanceLogCreateCheckId, conformanceFilterCreateCheckId, isUpdataConformance, conformanceFileName }
},
components: {
IconSearch,
IconSetting,
saveFilter,
savedSuccessfully
},
data() {
return {
showNavbarBreadcrumb: false,
@@ -67,9 +83,16 @@ export default {
};
},
computed: {
// 沒有 filter Id, 沒有暫存 tempFilterId Id 就不能存檔
disabledSave: function () {
return this.tempFilterId ? false : true;
switch (this.$route.name) {
case 'Map':
case 'CheckMap':
// 沒有 filter Id, 沒有暫存 tempFilterId Id 就不能存檔
return this.tempFilterId ? false : true;
case 'Conformance':
case 'CheckConformance':
return this.conformanceFilterTempCheckId || this.conformanceLogTempCheckId ? false : true;
}
}
},
watch: {
@@ -78,19 +101,6 @@ export default {
this.filterName = newVal;
},
},
setup() {
const store = filesStore();
const allMapDataStore = AllMapDataStore();
const { logId, tempFilterId, createFilterId, filterName, postRuleData, isUpdataFilter } = storeToRefs(allMapDataStore);
return { store, allMapDataStore, logId, tempFilterId, createFilterId, filterName, postRuleData, isUpdataFilter}
},
components: {
IconSearch,
IconSetting,
saveFilter,
savedSuccessfully
},
mounted() {
if(this.$route.params.type === 'filter') this.createFilterId= this.$route.params.fileId;
this.showNavbarBreadcrumb = this.$route.matched[0].name !== ('AuthContainer')? true : false;
@@ -125,17 +135,37 @@ export default {
async saveModal() {
// 傳給 Map通知 Sidebar 要關閉。
this.$emitter.emit('saveModal', false);
// 判斷有沒有 filter Id有就儲存 return沒有就往下走
// 沒有 filter Id, 有暫存 tempFilterId Id 可以另存新檔
if(this.createFilterId) {
await this.allMapDataStore.updataFilter();
if(this.isUpdataFilter) await savedSuccessfully(this.filterName);
this.tempFilterId = null;
}else if(this.logId){
await saveFilter(this.allMapDataStore.addFilterId);
// 存檔後為 filterID換網址不跳頁使用 push 記錄歷史路由
await this.$router.push(`/discover/map/filter/${this.createFilterId}`);
};
// 判斷在哪個子頁面
switch (this.$route.name) {
case 'Map':
// 先判斷有沒有 filter Id有就儲存 return沒有就往下走
// 沒有 filter Id, 有暫存 tempFilterId Id 可以另存新檔
if(this.createFilterId) {
await this.allMapDataStore.updataFilter();
if(this.isUpdataFilter) await savedSuccessfully(this.filterName);
this.tempFilterId = null;
}else if(this.logId){
await saveFilter(this.allMapDataStore.addFilterId);
// 存檔後為 filterID換網址不跳頁使用 push 記錄歷史路由
await this.$router.push(`/discover/map/filter/${this.createFilterId}`);
};
break;
case 'Conformance':
case 'CheckMap':
case 'CheckConformance':
// 先判斷有沒有 check Id有就儲存 return沒有就往下走
// 沒有 check Id, 有暫存 temp Id 可以另存新檔
if(this.conformanceFilterCreateCheckId || this.conformanceLogCreateCheckId){
await this.conformanceStore.updataConformance();
if(this.isUpdataConformance) await savedSuccessfully(this.conformanceFileName);
} else {
await saveFilter(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}`);
}
break;
}
}
},
}