diff --git a/src/components/Discover/Conformance/ConformanceSidebar.vue b/src/components/Discover/Conformance/ConformanceSidebar.vue index bc47030..9cfeebb 100644 --- a/src/components/Discover/Conformance/ConformanceSidebar.vue +++ b/src/components/Discover/Conformance/ConformanceSidebar.vue @@ -211,91 +211,401 @@ export default { break; }; - if(this.selectedRuleType === 'Have activity') { // Rule Type 選 Have activity 的行為 - if(!this.selectConformanceTask?.length) return this.$toast.error('Not selected.'); - else { - data = { - type: 'contains-tasks', - tasks: this.selectConformanceTask, - }; - this.isSubmitTask = this.selectConformanceTask; - // 其他 isSubmitData 為 null - this.isSubmitStartAndEnd = null; - this.isSubmitListSeq = []; - this.isSubmitDurationData = null; - } - }else if(this.selectedRuleType === 'Activity sequence') { // Activity Sequence 選 Start & End 的行為 - if(this.selectedActivitySequence === 'Start & End'){ - if(this.selectConformanceStartAndEnd === null || this.selectConformanceStartAndEnd.length === 0) return this.$toast.error('Both Start and End must be selected.'); + switch (this.selectedRuleType) { + case 'Have activity': // Rule Type 選 Have activity 的行為 + if(!this.selectConformanceTask?.length) return this.$toast.error('Not selected.'); else { data = { - type: 'start-end', - starts_with: this.selectConformanceStartAndEnd[0], - ends_with: this.selectConformanceStartAndEnd[1], + type: 'contains-tasks', + tasks: this.selectConformanceTask, }; - this.isSubmitStartAndEnd = [ - {category: 'Start', task: this.selectConformanceStartAndEnd[0]}, - {category: 'End', task: this.selectConformanceStartAndEnd[1]}, - ]; + this.isSubmitTask = this.selectConformanceTask; // 其他 isSubmitData 為 null - this.isSubmitTask = null; + this.isSubmitStartAndEnd = null; this.isSubmitListSeq = []; this.isSubmitDurationData = null; } - }else if(this.selectedActivitySequence === 'Sequence'){ // Activity Sequence 選 Sequence 的行為 - if(this.listSeq.length < 2) return this.$toast.error('Select two or more.'); + break; + case 'Activity sequence': // Rule Type 選 Activity sequence 的行為 + switch (this.selectedActivitySequence) { + case 'Start & End': // Activity Sequence 選 Start & End 的行為 + if(this.selectConformanceStartAndEnd === null || this.selectConformanceStartAndEnd.length === 0) return this.$toast.error('Both Start and End must be selected.'); + else { + data = { + type: 'start-end', + starts_with: this.selectConformanceStartAndEnd[0], + ends_with: this.selectConformanceStartAndEnd[1], + }; + this.isSubmitStartAndEnd = [ + {category: 'Start', task: this.selectConformanceStartAndEnd[0]}, + {category: 'End', task: this.selectConformanceStartAndEnd[1]}, + ]; + // 其他 isSubmitData 為 null + this.isSubmitTask = null; + this.isSubmitListSeq = []; + this.isSubmitDurationData = null; + }; + break; + case 'Sequence': // Activity Sequence 選 Sequence 的行為 + if(this.listSeq.length < 2) return this.$toast.error('Select two or more.'); + else { + data = { + type: isMode, + task_seq: this.listSeq, + }; + this.isSubmitListSeq = this.listSeq; + this.isSubmitTask = null; + this.isSubmitStartAndEnd = null; + this.isSubmitDurationData = null; + }; + default: + break; + } + break; + case 'Activity duration': // Rule Type 選 Activity duration 的行為 + if(!this.selectDurationData?.length) return this.$toast.error('Not selected.'); else { data = { - type: isMode, - task_seq: this.listSeq, + type: 'task-duration', + task: this.selectDurationData[0], + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, }; - this.isSubmitListSeq = this.listSeq; + this.isSubmitDurationData = this.selectDurationData; + // 其他 isSubmitData 為 null this.isSubmitTask = null; this.isSubmitStartAndEnd = null; - this.isSubmitDurationData = null; - } - } - }else if(this.selectedRuleType === 'Activity duration') { // Rule Type 選 Activity duration 的行為 - if(!this.selectDurationData?.length) return this.$toast.error('Not selected.'); - else { - data = { - type: 'task-duration', - task: this.selectDurationData[0], - min: this.selectDurationTime.min, - max: this.selectDurationTime.max, + this.isSubmitListSeq = []; }; - this.isSubmitDurationData = this.selectDurationData; - // 其他 isSubmitData 為 null - this.isSubmitTask = null; - this.isSubmitStartAndEnd = null; - this.isSubmitListSeq = []; - } - }else if(this.selectedRuleType === 'Processing time') { // Rule Type 選 Processing time 的行為 - if(this.selectedProcessScope === 'selectedProcessScope') { + break; + case 'Processing time': // Rule Type 選 Processing time 的行為 + switch (this.selectedProcessScope) { + case 'End to end': + switch (this.selectedActSeqMore) { + case 'All': + data = { + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'processing-time-end-to-end-whole', + }; + break; + case 'Start': + data = { + task: this.selectCfmPtEteStart, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'processing-time-end-to-end-starts-with', + }; + break; + case 'End': + data = { + task: this.selectCfmPtEteEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'processing-time-end-to-end-ends-with', + }; + break; + case 'Start & End': + data = { + start: this.selectCfmPtEteSEStart, + end: this.selectCfmPtEteSEEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'processing-time-end-to-end-start-end', + }; + break; + default: + break; + }; + break; + case 'Partial': + switch (this.selectedActSeqFromTo) { + case 'From': + data = { + task: this.selectCfmPtPStart, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'processing-time-partial-starts-with', + }; + break; + case 'To': + data = { + task: this.selectCfmPtPEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'processing-time-partial-ends-with', + }; + break; + case 'From & To': + data = { + start: this.selectCfmPtPSEStart, + end: this.selectCfmPtPSEEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'processing-time-partial-start-end', + }; + break; + default: + break; + }; + break; + default: + break; + }; + break; + case 'Waiting time': // Rule Type 選 Waiting time 的行為 + switch (this.selectedProcessScope) { + case 'End to end': + switch (this.selectedActSeqMore) { + case 'All': + data = { + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'waiting-time-end-to-end-whole', + }; + break; + case 'Start': + data = { + task: this.selectCfmWtEteStart, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'waiting-time-end-to-end-starts-with', + }; + break; + case 'End': + data = { + task: this.selectCfmWtEteEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'waiting-time-end-to-end-ends-with', + }; + break; + case 'Start & End': + data = { + start: this.selectCfmWtEteSEStart, + end: this.selectCfmWtEteSEEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'waiting-time-end-to-end-start-end', + }; + break; + default: + break; + }; + break; + case 'Partial': + switch (this.selectedActSeqFromTo) { + case 'From': + data = { + task: this.selectCfmWtPStart, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'waiting-time-partial-starts-with', + }; + break; + case 'To': + data = { + task: this.selectCfmWtPEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'waiting-time-partial-ends-with', + }; + break; + case 'From & To': + data = { + start: this.selectCfmWtPSEStart, + end: this.selectCfmWtPSEEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'waiting-time-partial-start-end', + }; + break; + default: + break; + }; + break; + default: + break; + }; + break; + case 'Cycle time': // Rule Type 選 Cycle time 的行為 switch (this.selectedActSeqMore) { case 'All': data = { min: this.selectDurationTime.min, max: this.selectDurationTime.max, - type: 'processing-time-end-to-end-whole', - } + type: 'cycle-time-end-to-end-whole', + }; break; case 'Start': - + data = { + task: this.selectCfmCtEteStart, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'cycle-time-end-to-end-starts-with', + }; break; case 'End': - + data = { + task: this.selectCfmCtEteEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'cycle-time-end-to-end-ends-with', + }; break; - case 'Start & End': - + case 'Start & End': + data = { + start: this.selectCfmCtEteSEStart, + end: this.selectCfmCtEteSEEnd, + min: this.selectDurationTime.min, + max: this.selectDurationTime.max, + type: 'cycle-time-end-to-end-start-end', + }; break; - default: break; - } - } - + }; + break; + default: + break; }; + + // if(this.selectedRuleType === 'Have activity') { // Rule Type 選 Have activity 的行為 + // if(!this.selectConformanceTask?.length) return this.$toast.error('Not selected.'); + // else { + // data = { + // type: 'contains-tasks', + // tasks: this.selectConformanceTask, + // }; + // this.isSubmitTask = this.selectConformanceTask; + // // 其他 isSubmitData 為 null + // this.isSubmitStartAndEnd = null; + // this.isSubmitListSeq = []; + // this.isSubmitDurationData = null; + // } + // }else if(this.selectedRuleType === 'Activity sequence') { // Activity Sequence 選 Start & End 的行為 + // if(this.selectedActivitySequence === 'Start & End'){ + // if(this.selectConformanceStartAndEnd === null || this.selectConformanceStartAndEnd.length === 0) return this.$toast.error('Both Start and End must be selected.'); + // else { + // data = { + // type: 'start-end', + // starts_with: this.selectConformanceStartAndEnd[0], + // ends_with: this.selectConformanceStartAndEnd[1], + // }; + // this.isSubmitStartAndEnd = [ + // {category: 'Start', task: this.selectConformanceStartAndEnd[0]}, + // {category: 'End', task: this.selectConformanceStartAndEnd[1]}, + // ]; + // // 其他 isSubmitData 為 null + // this.isSubmitTask = null; + // this.isSubmitListSeq = []; + // this.isSubmitDurationData = null; + // } + // }else if(this.selectedActivitySequence === 'Sequence'){ // Activity Sequence 選 Sequence 的行為 + // if(this.listSeq.length < 2) return this.$toast.error('Select two or more.'); + // else { + // data = { + // type: isMode, + // task_seq: this.listSeq, + // }; + // this.isSubmitListSeq = this.listSeq; + // this.isSubmitTask = null; + // this.isSubmitStartAndEnd = null; + // this.isSubmitDurationData = null; + // } + // } + // }else if(this.selectedRuleType === 'Activity duration') { // Rule Type 選 Activity duration 的行為 + // if(!this.selectDurationData?.length) return this.$toast.error('Not selected.'); + // else { + // data = { + // type: 'task-duration', + // task: this.selectDurationData[0], + // min: this.selectDurationTime.min, + // max: this.selectDurationTime.max, + // }; + // this.isSubmitDurationData = this.selectDurationData; + // // 其他 isSubmitData 為 null + // this.isSubmitTask = null; + // this.isSubmitStartAndEnd = null; + // this.isSubmitListSeq = []; + // } + // }else if(this.selectedRuleType === 'Processing time') { // Rule Type 選 Processing time 的行為 + // switch (this.selectedProcessScope) { + // case 'End to end': + // switch (this.selectedActSeqMore) { + // case 'All': + // data = { + // min: this.selectDurationTime.min, + // max: this.selectDurationTime.max, + // type: 'processing-time-end-to-end-whole', + // }; + // break; + // case 'Start': + // data = { + // task: this.selectCfmPtEteStart, + // min: this.selectDurationTime.min, + // max: this.selectDurationTime.max, + // type: 'processing-time-end-to-end-starts-with', + // }; + // break; + // case 'End': + // data = { + // task: this.selectCfmPtEteEnd, + // min: this.selectDurationTime.min, + // max: this.selectDurationTime.max, + // type: 'processing-time-end-to-end-ends-with', + // }; + // break; + // case 'Start & End': + // data = { + // start: this.selectCfmPtEteSEStart, + // end: this.selectCfmPtEteSEEnd, + // min: this.selectDurationTime.min, + // max: this.selectDurationTime.max, + // type: 'processing-time-end-to-end-start-end', + // }; + // break; + // default: + // break; + // }; + // break; + // case 'Partial': + // switch (this.selectedActSeqFromTo) { + // case 'From': + // data = { + // task: this.selectCfmPtPStart, + // min: this.selectDurationTime.min, + // max: this.selectDurationTime.max, + // type: 'processing-time-partial-starts-with', + // }; + // break; + // case 'To': + // data = { + // task: this.selectCfmPtPEnd, + // min: this.selectDurationTime.min, + // max: this.selectDurationTime.max, + // type: 'processing-time-partial-ends-with', + // }; + // break; + // case 'From & To': + // data = { + // start: this.selectCfmPtPSEStart, + // end: this.selectCfmPtPSEEnd, + // min: this.selectDurationTime.min, + // max: this.selectDurationTime.max, + // type: 'processing-time-partial-start-end', + // }; + // break; + // default: + // break; + // }; + // break; + // default: + // break; + // } + + + // }; // selectedActSeqMore, selectedActSeqFromTo, this.isLoading = true; @@ -441,11 +751,9 @@ export default { }; switch (this.selectedRuleType) { case 'Processing time': - console.log(this.cfmPtEteWhole); this.getDurationTime(this.cfmPtEteWhole, 'all'); break; case 'Waiting time': - console.log(this.cfmWtEteWhole); this.getDurationTime(this.cfmWtEteWhole, 'all'); break; case 'Cycle time': @@ -467,7 +775,6 @@ export default { }; }); this.$emitter.on('isRadioActSeqMoreChange', (data) => { - if(data) { if(this.selectedActSeqMore === 'All') { switch (this.selectedRuleType) { @@ -489,7 +796,6 @@ export default { this.selectDurationTime = null; }; }; - }); this.$emitter.on('isRadioActSeqFromToChange', (data) => { if(data) {