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

@@ -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;