Conformance: Activity sequence, Sequence, Directly follows done.

This commit is contained in:
chiayin
2023-08-02 14:38:08 +08:00
parent 86e1c52585
commit 34aa0f28c2
11 changed files with 309 additions and 98 deletions

View File

@@ -28,7 +28,8 @@
</div>
</div>
<!-- show bar -->
<ConformanceShowBar :class="isShowBar?'':'hidden'"></ConformanceShowBar>
<ConformanceShowBar :class="isShowBar?'':'hidden'" :selectConformanceTask="selectConformanceTask" :selectConformanceStartAndEnd="selectConformanceStartAndEnd" :selectConformanceStart="selectConformanceStart" :selectConformanceEnd="selectConformanceEnd" :selectConformanceFrom="selectConformanceFrom" :selectConformanceTo="selectConformanceTo"
:listSeq="listSeq"></ConformanceShowBar>
</div>
</section>
</template>
@@ -56,6 +57,12 @@ export default {
isShowBar: false,
visibleLeft: false,
selectConformanceTask: null,
selectConformanceStartAndEnd: null,
selectConformanceStart: null,
selectConformanceEnd: null,
selectConformanceFrom: null,
selectConformanceTo: null,
listSeq: [],
}
},
components: {
@@ -73,8 +80,12 @@ export default {
this.$emitter.emit('coverPlate', true);
// Have activity
this.selectConformanceTask = null;
this.$emitter.emit('reset', null);
// Activity sequence
this.selectConformanceStartAndEnd = null;
this.listSeq = null;
// 其他子元件 reset
this.$emitter.emit('reset', null);
// reset 成功訊息
this.$toast.success('Reset Success.');
},
@@ -83,12 +94,46 @@ export default {
*/
async submit() {
let data;
let isMode = '';
switch (this.selectedMode) {
case 'Directly follows':
isMode = 'directly-follows';
break;
case 'Eventually follows':
isMode = 'a';
break;
case 'Short loop(s)':
isMode = 'b';
break;
case 'Self loop(s)':
isMode = 'c';
break;
default:
break;
};
if(this.selectedRuleType === 'Have activity') {
if(this.selectedRuleType === 'Have activity') { // Activity Sequence 選 Have activity(s) 的行為
if(!this.selectConformanceTask?.length) return this.$toast.error('Not selected.');
else data = {
type: 'contains-tasks',
tasks: this.selectConformanceTask,
};
}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],
};
}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,
}
}
}
}
@@ -107,6 +152,30 @@ export default {
this.$emitter.on('actListData', (data) => {
this.selectConformanceTask = data;
});
this.$emitter.on('actRadioData', (data) => {
switch (data.category) {
case 'Start':
this.selectConformanceStart = data.task;
break;
case 'End':
this.selectConformanceEnd = data.task;
break;
case 'From':
this.selectConformanceFrom = data.task;
break;
case 'To':
this.selectConformanceTo = data.task;
break;
default:
break;
};
if(this.selectConformanceStart !== null && this.selectConformanceEnd !== null){
this.selectConformanceStartAndEnd = [this.selectConformanceStart, this.selectConformanceEnd];
};
});
this.$emitter.on('getListSequence', (data) => {
this.listSeq = data;
})
},
}
</script>