Files
lucia-frontend/src/components/Discover/Conformance/ConformanceSidebar.vue
2023-09-12 11:48:32 +08:00

862 lines
34 KiB
Vue

<template>
<section class="h-full shadow-[1px_0px_4px_rgba(0,0,0,0.25)] bg-neutral-100 absolute inset-y-0 left-0 z-10" :class="isShowBar?'w-full':'w-[312px]'">
<!-- header -->
<div class="bg-neutral-200 px-4">
<p class="h2">Rule Settings</p>
</div>
<!-- contanier -->
<div class="p-4 h-[calc(100%_-_40px)] flex">
<div class="h-full flex flex-col justify-between w-[280px]">
<!-- select -->
<div class="h-full overflow-y-auto scrollbar w-[280px]">
<!-- radio group -->
<ConformanceRadioGroup></ConformanceRadioGroup>
<!-- show and hidden button -->
<div class="flex items-center justify-between mr-1" :class="isShowBar ? 'text-primary' : ''">
<p class="h2">Activity Selector</p>
<span class="material-symbols-outlined cursor-pointer duration-300 hover:bg-primary/50 hover:rounded" @click="isShowBar = !isShowBar">{{ isShowBar ? 'keyboard_double_arrow_right' : 'keyboard_double_arrow_left' }}</span>
</div>
<!-- select result -->
<ConformanceSelectResult
:isSubmit="isSubmit"
:isSubmitTask="isSubmitTask"
:isSubmitStartAndEnd="isSubmitStartAndEnd"
:isSubmitListSeq="isSubmitListSeq"
:isSubmitDurationData="isSubmitDurationData"
:isSubmitCfmPtEteStart="isSubmitCfmPtEteStart"
:isSubmitCfmPtEteEnd="isSubmitCfmPtEteEnd"
:isSubmitCfmPtEteSE="isSubmitCfmPtEteSE"
:isSubmitCfmPtPStart="isSubmitCfmPtPStart"
:isSubmitCfmPtPEnd="isSubmitCfmPtPEnd"
:isSubmitCfmPtPSE="isSubmitCfmPtPSE"
:isSubmitCfmWtEteStart="isSubmitCfmWtEteStart"
:isSubmitCfmWtEteEnd="isSubmitCfmWtEteEnd"
:isSubmitCfmWtEteSE="isSubmitCfmWtEteSE"
:isSubmitCfmWtPStart="isSubmitCfmWtPStart"
:isSubmitCfmWtPEnd="isSubmitCfmWtPEnd"
:isSubmitCfmWtPSE="isSubmitCfmWtPSE"
:isSubmitCfmCtEteStart="isSubmitCfmCtEteStart"
:isSubmitCfmCtEteEnd="isSubmitCfmCtEteEnd"
:isSubmitCfmCtEteSE="isSubmitCfmCtEteSE"
></ConformanceSelectResult>
<ConformanceTimeRange
@min-total-seconds="minTotalSeconds"
@max-total-seconds="maxTotalSeconds"
:isSubmitDurationTime="isSubmitDurationTime"
:isSubmitTimeCfmPtEteAll="isSubmitTimeCfmPtEteAll"
:isSubmitTimeCfmPtEteStart="isSubmitTimeCfmPtEteStart"
:isSubmitTimeCfmPtEteEnd="isSubmitTimeCfmPtEteEnd"
:isSubmitTimeCfmPtEteSE="isSubmitTimeCfmPtEteSE"
:isSubmitTimeCfmPtPStart="isSubmitTimeCfmPtPStart"
:isSubmitTimeCfmPtPEnd="isSubmitTimeCfmPtPEnd"
:isSubmitTimeCfmPtPSE="isSubmitTimeCfmPtPSE"
:isSubmitTimeCfmWtEteAll="isSubmitTimeCfmWtEteAll"
:isSubmitTimeCfmWtEteStart="isSubmitTimeCfmWtEteStart"
:isSubmitTimeCfmWtEteEnd="isSubmitTimeCfmWtEteEnd"
:isSubmitTimeCfmWtEteSE="isSubmitTimeCfmWtEteSE"
:isSubmitTimeCfmWtPStart="isSubmitTimeCfmWtPStart"
:isSubmitTimeCfmWtPEnd="isSubmitTimeCfmWtPEnd"
:isSubmitTimeCfmWtPSE="isSubmitTimeCfmWtPSE"
:isSubmitTimeCfmCtEteAll="isSubmitTimeCfmCtEteAll"
:isSubmitTimeCfmCtEteStart="isSubmitTimeCfmCtEteStart"
:isSubmitTimeCfmCtEteEnd="isSubmitTimeCfmCtEteEnd"
:isSubmitTimeCfmCtEteSE="isSubmitTimeCfmCtEteSE"
></ConformanceTimeRange>
</div>
<!-- button -->
<div class="space-x-4 p-4 flex justify-center items-content border-t border-neutral-300">
<button type="button" class="btn btn-sm btn-neutral" @click="reset">Clear</button>
<button type="button" class="btn btn-sm btn-neutral" @click="submit">Apply</button>
</div>
</div>
<!-- show bar -->
<ConformanceShowBar :class="isShowBar?'':'hidden'"
:isSubmit="isSubmit"
:isSubmitTask="isSubmitTask"
:isSubmitStartAndEnd="isSubmitStartAndEnd"
:isSubmitListSeq="isSubmitListSeq"
:isSubmitDurationData="isSubmitDurationData"
:isSubmitCfmPtEteStart="isSubmitCfmPtEteStart"
:isSubmitCfmPtEteEnd="isSubmitCfmPtEteEnd"
:isSubmitCfmPtEteSE="isSubmitCfmPtEteSE"
:isSubmitCfmPtPStart="isSubmitCfmPtPStart"
:isSubmitCfmPtPEnd="isSubmitCfmPtPEnd"
:isSubmitCfmPtPSE="isSubmitCfmPtPSE"
:isSubmitCfmWtEteStart="isSubmitCfmWtEteStart"
:isSubmitCfmWtEteEnd="isSubmitCfmWtEteEnd"
:isSubmitCfmWtEteSE="isSubmitCfmWtEteSE"
:isSubmitCfmWtPStart="isSubmitCfmWtPStart"
:isSubmitCfmWtPEnd="isSubmitCfmWtPEnd"
:isSubmitCfmWtPSE="isSubmitCfmWtPSE"
:isSubmitCfmCtEteStart="isSubmitCfmCtEteStart"
:isSubmitCfmCtEteEnd="isSubmitCfmCtEteEnd"
:isSubmitCfmCtEteSE="isSubmitCfmCtEteSE"
></ConformanceShowBar>
</div>
</section>
</template>
<script>
import { storeToRefs } from 'pinia';
import LoadingStore from '@/stores/loading.js';
import ConformanceStore from '@/stores/conformance.js';
import ConformanceRadioGroup from './ConformanceSidebar/ConformanceRadioGroup.vue';
import ConformanceShowBar from './ConformanceSidebar/ConformanceShowBar.vue';
import ConformanceTimeRange from './ConformanceSidebar/ConformanceTimeRange.vue';
import ConformanceSelectResult from './ConformanceSidebar/ConformanceSelectResult.vue';
export default {
setup() {
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 } = 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 }
},
data() {
return {
isShowBar: false,
visibleLeft: false,
selectConformanceTask: null,
selectConformanceStartAndEnd: null,
selectCfmSeqStart: null,
selectCfmSeqEnd: null,
selectConformanceFrom: null,
selectConformanceTo: null,
listSeq: [],
selectDurationData: null,
selectDurationTime: { min: 0, max: 0},
selectTimeRangeMin: 0, // Time Range min
selectTimeRangeMax: 0, // Time Range max
selectCfmPtEteStart: null, // Processing time
selectCfmPtEteEnd: null,
selectCfmPtEteSEStart: null,
selectCfmPtEteSEEnd: null,
selectCfmPtPStart: null,
selectCfmPtPEnd: null,
selectCfmPtPSEStart: null,
selectCfmPtPSEEnd: null,
selectCfmWtEteStart: null, // Waiting time
selectCfmWtEteEnd: null,
selectCfmWtEteSEStart: null,
selectCfmWtEteSEEnd: null,
selectCfmWtPStart: null,
selectCfmWtPEnd: null,
selectCfmWtPSEStart: null,
selectCfmWtPSEEnd: null,
selectCfmCtEteStart: null, // Cycle time
selectCfmCtEteEnd: null,
selectCfmCtEteSEStart: null,
selectCfmCtEteSEEnd: null,
isSubmit: false,
isSubmitTask: null,
isSubmitStartAndEnd: null,
isSubmitListSeq: [],
isSubmitDurationData: null, // Activity duration
isSubmitCfmPtEteStart: null, // Processing time
isSubmitCfmPtEteEnd: null,
isSubmitCfmPtEteSE: null,
isSubmitCfmPtPStart: null,
isSubmitCfmPtPEnd: null,
isSubmitCfmPtPSE: null,
isSubmitCfmWtEteStart: null, // Waiting time
isSubmitCfmWtEteEnd: null,
isSubmitCfmWtEteSE: null,
isSubmitCfmWtPStart: null,
isSubmitCfmWtPEnd: null,
isSubmitCfmWtPSE: null,
isSubmitCfmCtEteStart: null, // Cycle time
isSubmitCfmCtEteEnd: null,
isSubmitCfmCtEteSE: null,
isSubmitDurationTime: null, // Activity duration Time Range
isSubmitTimeCfmPtEteAll: null, // Processing time Time Range
isSubmitTimeCfmPtEteStart: null,
isSubmitTimeCfmPtEteEnd: null,
isSubmitTimeCfmPtEteSE: null,
isSubmitTimeCfmPtPStart: null,
isSubmitTimeCfmPtPEnd: null,
isSubmitTimeCfmPtPSE: null,
isSubmitTimeCfmWtEteAll: null, // Waiting time Time Range
isSubmitTimeCfmWtEteStart: null,
isSubmitTimeCfmWtEteEnd: null,
isSubmitTimeCfmWtEteSE: null,
isSubmitTimeCfmWtPStart: null,
isSubmitTimeCfmWtPEnd: null,
isSubmitTimeCfmWtPSE: null,
isSubmitTimeCfmCtEteAll: null, // Cycle time Time Range
isSubmitTimeCfmCtEteStart: null,
isSubmitTimeCfmCtEteEnd: null,
isSubmitTimeCfmCtEteSE: null,
}
},
components: {
ConformanceRadioGroup,
ConformanceShowBar,
ConformanceTimeRange,
ConformanceSelectResult,
},
methods: {
/**
* get min total seconds
* @param {Number} e
*/
minTotalSeconds(e) {
this.selectTimeRangeMin = e;
},
/**
* get min total seconds
* @param {Number} e
*/
maxTotalSeconds(e) {
this.selectTimeRangeMax = e;
},
/**
* select Time Reset
*/
selectTimeReset() {
// 不包含 this.selectDurationTime
this.selectConformanceTask = null; // Have activity
this.selectConformanceStartAndEnd = null; // Activity Sequence
this.selectCfmSeqStart = null;
this.selectCfmSeqEnd = null;
this.selectConformanceFrom = null;
this.selectConformanceTo = null;
this.listSeq = [];
this.selectDurationData = null; // Activity durations
this.selectTimeRangeMin = 0; // Time Range min
this.selectTimeRangeMax = 0; // Time Range max
this.selectCfmPtEteStart = null; // Processing time
this.selectCfmPtEteEnd = null;
this.selectCfmPtEteSEStart = null;
this.selectCfmPtEteSEEnd = null;
this.selectCfmPtPStart = null;
this.selectCfmPtPEnd = null;
this.selectCfmPtPSEStart = null;
this.selectCfmPtPSEEnd = null;
this.selectCfmWtEteStart = null; // Waiting time
this.selectCfmWtEteEnd = null;
this.selectCfmWtEteSEStart = null;
this.selectCfmWtEteSEEnd = null;
this.selectCfmWtPStart = null;
this.selectCfmWtPEnd = null;
this.selectCfmWtPSEStart = null;
this.selectCfmWtPSEEnd = null;
this.selectCfmCtEteStart = null; // Cycle time
this.selectCfmCtEteEnd = null;
this.selectCfmCtEteSEStart = null;
this.selectCfmCtEteSEEnd = null;
},
/**
* is submit select Reset
*/
isSubmitReset() {
this.isSubmitTask = null;
this.isSubmitStartAndEnd = null;
this.isSubmitListSeq = [];
this.isSubmitDurationData = null;
this.isSubmitDurationTime = null;
this.isSubmitCfmPtEteStart = null; // Processing time
this.isSubmitCfmPtEteEnd = null;
this.isSubmitCfmPtEteSE = null;
this.isSubmitCfmPtPStart = null;
this.isSubmitCfmPtPEnd = null;
this.isSubmitCfmPtPSE = null;
this.isSubmitCfmWtEteStart = null; // Waiting time
this.isSubmitCfmWtEteEnd = null;
this.isSubmitCfmWtEteSE = null;
this.isSubmitCfmWtPStart = null;
this.isSubmitCfmWtPEnd = null;
this.isSubmitCfmWtPSE = null;
this.isSubmitCfmCtEteStart = null; // Cycle time
this.isSubmitCfmCtEteEnd = null;
this.isSubmitCfmCtEteSE = null;
this.isSubmitTimeCfmPtEteAll = null; // Processing time Time Range
this.isSubmitTimeCfmPtEteStart = null;
this.isSubmitTimeCfmPtEteEnd = null;
this.isSubmitTimeCfmPtEteSE = null;
this.isSubmitTimeCfmPtPStart = null;
this.isSubmitTimeCfmPtPEnd = null;
this.isSubmitTimeCfmPtPSE = null;
this.isSubmitTimeCfmWtEteAll = null; // Waiting time Time Range
this.isSubmitTimeCfmWtEteStart = null;
this.isSubmitTimeCfmWtEteEnd = null;
this.isSubmitTimeCfmWtEteSE = null;
this.isSubmitTimeCfmWtPStart = null;
this.isSubmitTimeCfmWtPEnd = null;
this.isSubmitTimeCfmWtPSE = null;
this.isSubmitTimeCfmCtEteAll = null; // Cycle time Time Range
this.isSubmitTimeCfmCtEteStart = null;
this.isSubmitTimeCfmCtEteEnd = null;
this.isSubmitTimeCfmCtEteSE = null;
},
/**
* @param {boolean} massage true | false 清空選單選項, 選擇的結果
*/
reset() {
// Results page Cover Plate(遮罩為 ture)
this.$emitter.emit('coverPlate', true);
// is submit select Reset
this.isSubmitReset();
this.isSubmit = false;
// 其他子元件 reset
this.selectTimeReset();
this.$emitter.emit('reset', null);
// reset 成功訊息
this.$toast.success('Reset Success.');
},
/**
* Apply button 發送選項,取得 Checker Id.
*/
async submit() {
let data;
this.selectDurationTime = await {
min: this.selectTimeRangeMin,
max: this.selectTimeRangeMax
};
this.$emitter.emit('timeRangeMaxMin', this.selectDurationTime);
switch (this.selectedRuleType) {
case 'Have activity': // Rule Type 選 Have activity 的行為
if(!this.selectConformanceTask?.length) return this.$toast.error('Not selected.');
else {
data = {
type: 'contains-tasks',
tasks: this.selectConformanceTask,
};
// 其他 isSubmitData 為 null
this.isSubmitReset();
this.isSubmitTask = this.selectConformanceTask;
}
break;
case 'Activity sequence': // Rule Type 選 Activity sequence 的行為
switch (this.selectedActivitySequence) {
case 'Start & End': // Activity Sequence 選 Start & End 的行為
if(this.selectCfmSeqStart === null || this.selectCfmSeqEnd === null) return this.$toast.error('Both Start and End must be selected.');
else {
data = {
type: 'start-end',
starts_with: this.selectCfmSeqStart,
ends_with: this.selectCfmSeqEnd,
};
this.isSubmitReset();
this.isSubmitStartAndEnd = [
{category: 'Start', task: this.selectCfmSeqStart},
{category: 'End', task: this.selectCfmSeqEnd},
];
};
break;
case 'Sequence': // Activity Sequence 選 Sequence 的行為
switch (this.selectedMode) {
case 'Directly follows':
if(this.listSeq.length < 2) return this.$toast.error('Select two or more.');
else data = {
type: 'directly-follows',
task_seq: this.listSeq,
};
break;
case 'Eventually follows':
if(this.listSeq.length < 2) return this.$toast.error('Select two or more.');
else data = {
type: 'eventually-follows',
task_seq: this.listSeq,
};
break;
case 'Short loop(s)':
data = {
type: 'short-loops',
};
break;
case 'Self loop(s)':
data = {
type: 'self-loops',
};
break;
default:
break;
};
this.isSubmitReset();
this.isSubmitListSeq = this.listSeq;
default:
break;
}
break;
case '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.isSubmitReset();
this.isSubmitDurationData = this.selectDurationData;
this.isSubmitDurationTime = this.selectDurationTime;
};
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',
};
this.isSubmitReset();
this.isSubmitTimeCfmPtEteAll = this.selectDurationTime;
break;
case 'Start':
if(!this.selectCfmPtEteStart) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmPtEteStart,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'processing-time-end-to-end-starts-with',
};
this.isSubmitReset();
this.isSubmitCfmPtEteStart = [
{category: 'Start', task: this.selectCfmPtEteStart},
];
this.isSubmitTimeCfmPtEteStart = this.selectDurationTime;
}
break;
case 'End':
if(!this.selectCfmPtEteEnd) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmPtEteEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'processing-time-end-to-end-ends-with',
};
this.isSubmitReset();
this.isSubmitCfmPtEteEnd = [
{category: 'End', task: this.selectCfmPtEteEnd},
];
this.isSubmitTimeCfmPtEteEnd = this.selectDurationTime;
}
break;
case 'Start & End':
if(!this.selectCfmPtEteSEStart || !this.selectCfmPtEteSEEnd) return this.$toast.error('Both Start and End must be selected.');
else {
data = {
start: this.selectCfmPtEteSEStart,
end: this.selectCfmPtEteSEEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'processing-time-end-to-end-start-end',
};
this.isSubmitReset();
this.isSubmitCfmPtEteSE = [
{category: 'Start', task: this.selectCfmPtEteStart},
{category: 'End', task: this.selectCfmPtEteSEEnd},
];
this.isSubmitTimeCfmPtEteSE = this.selectDurationTime;
}
break;
default:
break;
};
break;
case 'Partial':
switch (this.selectedActSeqFromTo) {
case 'From':
if(!this.selectCfmPtPStart) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmPtPStart,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'processing-time-partial-starts-with',
};
this.isSubmitReset();
this.isSubmitCfmPtPStart = [
{category: 'From', task: this.selectCfmPtPStart},
];
this.isSubmitTimeCfmPtPStart = this.selectDurationTime;
}
break;
case 'To':
if(!this.selectCfmPtPEnd) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmPtPEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'processing-time-partial-ends-with',
};
this.isSubmitReset();
this.isSubmitCfmPtPEnd = [
{category: 'To', task: this.selectCfmPtPEnd},
];
this.isSubmitTimeCfmPtPEnd = this.selectDurationTime;
}
break;
case 'From & To':
if(!this.selectCfmPtPSEStart || !this.selectCfmPtPSEEnd) return this.$toast.error('Both Start and End must be selected.');
else {
data = {
start: this.selectCfmPtPSEStart,
end: this.selectCfmPtPSEEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'processing-time-partial-start-end',
};
this.isSubmitReset();
this.isSubmitCfmPtPSE = [
{category: 'From', task: this.selectCfmPtPSEStart},
{category: 'To', task: this.selectCfmPtPSEEnd},
];
this.isSubmitTimeCfmPtPSEd = this.selectDurationTime;
}
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',
};
this.isSubmitReset();
this.isSubmitTimeCfmWtEteAll = this.selectDurationTime;
break;
case 'Start':
if(!this.selectCfmWtEteStart) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmWtEteStart,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'waiting-time-end-to-end-starts-with',
};
this.isSubmitReset();
this.isSubmitCfmWtEteStart = [
{category: 'Start', task: this.selectCfmWtEteStart},
];
this.isSubmitTimeCfmWtEteStart = this.selectDurationTime;
}
break;
case 'End':
if(!this.selectCfmWtEteEnd) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmWtEteEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'waiting-time-end-to-end-ends-with',
};
this.isSubmitReset();
this.isSubmitCfmWtEteEnd = [
{category: 'End', task: this.selectCfmWtEteEnd},
];
this.isSubmitTimeCfmWtEteEnd = this.selectDurationTime;
}
break;
case 'Start & End':
if(!this.selectCfmWtEteSEStart || !this.selectCfmWtEteSEEnd) return this.$toast.error('Both Start and End must be selected.');
else {
data = {
start: this.selectCfmWtEteSEStart,
end: this.selectCfmWtEteSEEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'waiting-time-end-to-end-start-end',
};
this.isSubmitReset();
this.isSubmitCfmWtEteSE = [
{category: 'Start', task: this.selectCfmWtEteSEStart},
{category: 'End', task: this.selectCfmWtEteSEEnd},
];
this.isSubmitTimeCfmWtEteSE = this.selectDurationTime;
}
break;
default:
break;
};
break;
case 'Partial':
switch (this.selectedActSeqFromTo) {
case 'From':
if(!this.selectCfmWtPStart) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmWtPStart,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'waiting-time-partial-starts-with',
};
this.isSubmitReset();
this.isSubmitCfmWtPStart = [
{category: 'From', task: this.selectCfmWtPStart},
];
this.isSubmitTimeCfmWtPStart = this.selectDurationTime;
}
break;
case 'To':
if(!this.selectCfmWtPEnd) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmWtPEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'waiting-time-partial-ends-with',
};
this.isSubmitReset();
this.isSubmitCfmWtPEnd = [
{category: 'To', task: this.selectCfmWtPEnd},
];
this.isSubmitTimeCfmWtPEnd = this.selectDurationTime;
}
break;
case 'From & To':
if(!this.selectCfmWtPSEStart || !this.selectCfmWtPSEEnd) return this.$toast.error('Both Start and End must be selected.');
else {
data = {
start: this.selectCfmWtPSEStart,
end: this.selectCfmWtPSEEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'waiting-time-partial-start-end',
};
this.isSubmitReset();
this.isSubmitCfmWtPSE = [
{category: 'From', task: this.selectCfmWtPSEStart},
{category: 'To', task: this.selectCfmWtPSEEnd},
];
this.isSubmitTimeCfmWtPSE = this.selectDurationTime;
}
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: 'cycle-time-end-to-end-whole',
};
this.isSubmitReset();
this.isSubmitTimeCfmCtEteAll = this.selectDurationTime;
break;
case 'Start':
if(!this.selectCfmCtEteStart) return this.$toast.error('Not selected.');
else data = {
task: this.selectCfmCtEteStart,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'cycle-time-end-to-end-starts-with',
};
this.isSubmitReset();
this.isSubmitCfmCtEteStart = [
{category: 'Start', task: this.selectCfmCtEteStart},
];
this.isSubmitTimeCfmCtEteStart = this.selectDurationTime;
break;
case 'End':
if(!this.selectCfmCtEteEnd) return this.$toast.error('Not selected.');
else {
data = {
task: this.selectCfmCtEteEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'cycle-time-end-to-end-ends-with',
};
this.isSubmitReset();
this.isSubmitCfmCtEteEnd = [
{category: 'End', task: this.selectCfmCtEteEnd},
];
this.isSubmitTimeCfmCtEteEnd = this.selectDurationTime;
}
break;
case 'Start & End':
if(!this.selectCfmCtEteSEStart || !this.selectCfmCtEteSEEnd) return this.$toast.error('Both Start and End must be selected.');
else {
data = {
start: this.selectCfmCtEteSEStart,
end: this.selectCfmCtEteSEEnd,
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'cycle-time-end-to-end-start-end',
};
this.isSubmitReset();
this.isSubmitCfmCtEteSE = [
{category: 'Start', task: this.selectCfmCtEteSEStart},
{category: 'End', task: this.selectCfmCtEteSEEnd},
];
this.isSubmitTimeCfmCtEteSE = this.selectDurationTime;
}
break;
default:
break;
};
break;
default:
break;
};
this.isLoading = true;
this.isSubmit = true;
await this.conformanceStore.addLogConformanceTempCheckerId(data);
await this.conformanceStore.getLogConformanceTempReport();
this.isShowBar = false;
this.isLoading = false;
// Results page Cover Plate
this.$emitter.emit('coverPlate', false);
this.$toast.success('Apply Success. View the Conformance Checking Results.');
},
},
created() {
this.isShowBar = true;
this.$emitter.on('actListData', (data) => {
this.selectConformanceTask = data;
});
this.$emitter.on('actRadioData', (data) => {
switch (data.category) {
// Activity sequence
case 'cfmSeqStart':
this.selectCfmSeqStart = data.task;
break;
case 'cfmSeqEnd':
this.selectCfmSeqEnd = data.task;
break;
// Processing time
case 'cfmPtEteStart':
this.selectCfmPtEteStart = data.task;
break;
case 'cfmPtEteEnd':
this.selectCfmPtEteEnd = data.task;
break;
case 'cfmPtEteSEStart':
this.selectCfmPtEteSEStart = data.task;
break;
case 'cfmPtEteSEEnd':
this.selectCfmPtEteSEEnd = data.task;
break;
case 'cfmPtPStart':
this.selectCfmPtPStart = data.task;
break;
case 'cfmPtPEnd':
this.selectCfmPtPEnd = data.task;
break;
case 'cfmPtPSEStart':
this.selectCfmPtPSEStart = data.task;
break;
case 'cfmPtPSEEnd':
this.selectCfmPtPSEEnd = data.task;
break;
// Waiting time
case 'cfmWtEteStart':
this.selectCfmWtEteStart = data.task;
break;
case 'cfmWtEteEnd':
this.selectCfmWtEteEnd = data.task;
break;
case 'cfmWtEteSEStart':
this.selectCfmWtEteSEStart = data.task;
break;
case 'cfmWtEteSEEnd':
this.selectCfmWtEteSEEnd = data.task;
break;
case 'cfmWtPStart':
this.selectCfmWtPStart = data.task;
break;
case 'cfmWtPEnd':
this.selectCfmWtPEnd = data.task;
break;
case 'cfmWtPSEStart':
this.selectCfmWtPSEStart = data.task;
break;
case 'cfmWtPSEEnd':
this.selectCfmWtPSEEnd = data.task;
break;
// Cycle time
case 'cfmCtEteStart':
this.selectCfmCtEteStart = data.task;
break;
case 'cfmCtEteEnd':
this.selectCfmCtEteEnd = data.task;
break;
case 'cfmCtEteSEStart':
this.selectCfmCtEteSEStart = data.task;
break;
case 'cfmCtEteSEEnd':
this.selectCfmCtEteSEEnd = data.task;
break;
default:
if(this.selectedRuleType === 'Activity sequence') this.listSequence = [data.task];
else if(this.selectedRuleType === 'Activity duration') {
this.selectDurationData = [data.task];
};
break;
};
});
this.$emitter.on('getListSequence', (data) => {
this.listSeq = data;
});
// Radio 切換時,資料要清空
this.$emitter.on('isRadioChange', (data) => {
if(data) {
this.selectTimeReset();
this.selectDurationTime = { min: 0, max: 0};
};
});
this.$emitter.on('isRadioSeqChange', (data) => {
if(data) {
this.selectConformanceStartAndEnd = null;
this.listSeq = [];
};
});
this.$emitter.on('isRadioMode', (data) => {
if(data) {
if(this.selectedMode === 'Short loop(s)' || this.selectedMode === 'Self loop(s)') this.isShowBar = false;
}
})
this.$emitter.on('isRadioProcessScopeChange', (data) => {
if(data) {
this.selectDurationTime = { min: 0, max: 0};
};
});
this.$emitter.on('isRadioActSeqMoreChange', (data) => {
if(data) {
if(this.selectedActSeqMore !== 'All') this.selectDurationTime = { min: 0, max: 0};
};
});
this.$emitter.on('isRadioActSeqFromToChange', (data) => {
if(data) {
this.selectDurationTime = { min: 0, max: 0};
};
});
},
}
</script>
<style>
.text-shadow{
text-shadow: 1.5px 1px 8px black;
}
</style>