Add JSDoc documentation and file headers to all source files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -122,6 +122,19 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// The Lucia project.
|
||||
// Copyright 2023-2026 DSP, inc. All rights reserved.
|
||||
// Authors:
|
||||
// chiayin.kuo@dsp.im (chiayin), 2023/1/31
|
||||
// imacat.yang@dsp.im (imacat), 2023/9/23
|
||||
// cindy.chang@dsp.im (Cindy Chang), 2024/5/30
|
||||
/**
|
||||
* @module components/Discover/Conformance/ConformanceSidebar
|
||||
* Main sidebar for conformance checking with rule
|
||||
* configuration, activity selection, and submit/reset
|
||||
* actions.
|
||||
*/
|
||||
|
||||
import { ref, computed, watch, onBeforeUnmount } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useToast } from 'vue-toast-notification';
|
||||
@@ -622,14 +635,14 @@ watch(conformanceTempReportData, (newValue) => {
|
||||
// methods
|
||||
/**
|
||||
* get min total seconds
|
||||
* @param {Number} e 最小值總秒數
|
||||
* @param {number} e - The minimum total seconds.
|
||||
*/
|
||||
function minTotalSeconds(e) {
|
||||
selectTimeRangeMin.value = e;
|
||||
}
|
||||
/**
|
||||
* get min total seconds
|
||||
* @param {Number} e 最大值總秒數
|
||||
* @param {number} e - The maximum total seconds.
|
||||
*/
|
||||
function maxTotalSeconds(e) {
|
||||
selectTimeRangeMax.value = e;
|
||||
@@ -715,7 +728,7 @@ function isSubmitReset() {
|
||||
isSubmitTimeCfmCtEteSE.value = { base: {}, rule: {}};
|
||||
}
|
||||
/**
|
||||
* 清空選單的行為
|
||||
* Clears all form selections and resets the sidebar state.
|
||||
*/
|
||||
function reset() {
|
||||
// Results page Cover Plate(遮罩為 ture)
|
||||
@@ -733,7 +746,7 @@ function reset() {
|
||||
isShowBarOpen.value = true;
|
||||
}
|
||||
/**
|
||||
* 設定 Start & End Data 連動資料
|
||||
* Sets linked Start & End data for activity selection.
|
||||
* @param {string} start task
|
||||
* @param {string} end task
|
||||
* @returns {object}
|
||||
@@ -758,7 +771,7 @@ function setSubmitShowDataByStartEnd(start, end) {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Apply button 發送選項,取得 Check Id.
|
||||
* Submits the selected options via the Apply button and retrieves the Check ID.
|
||||
*/
|
||||
async function submitConformance() {
|
||||
let dataToSave;
|
||||
@@ -810,6 +823,9 @@ async function submitConformance() {
|
||||
$toast.success(i18next.t("Conformance.RuleApplied"));
|
||||
}
|
||||
|
||||
/** Builds the data payload for the 'Have activity' rule.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getHaveActivityData() {
|
||||
const dataToSave = {
|
||||
type: 'contains-tasks',
|
||||
@@ -820,6 +836,9 @@ function getHaveActivityData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds the data payload for the 'Activity sequence' rule.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getActivitySequenceData() {
|
||||
let dataToSave;
|
||||
switch (selectedActivitySequence.value) {
|
||||
@@ -843,6 +862,9 @@ function getActivitySequenceData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds the data payload for sequence sub-rules.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getSequenceData() {
|
||||
let dataToSave;
|
||||
switch (selectedMode.value) {
|
||||
@@ -872,6 +894,9 @@ function getSequenceData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds the data payload for the 'Activity duration' rule.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getActivityDurationData() {
|
||||
const dataToSave = {
|
||||
type: 'task-duration',
|
||||
@@ -885,6 +910,9 @@ function getActivityDurationData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds the data payload for the 'Processing time' rule.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getProcessingTimeData() {
|
||||
let dataToSave;
|
||||
switch (selectedProcessScope.value) {
|
||||
@@ -898,6 +926,9 @@ function getProcessingTimeData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds end-to-end processing time rule data.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getEndToEndProcessingTimeData() {
|
||||
let dataToSave;
|
||||
switch (selectedActSeqMore.value) {
|
||||
@@ -952,6 +983,9 @@ function getEndToEndProcessingTimeData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds partial processing time rule data.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getPartialProcessingTimeData() {
|
||||
let dataToSave;
|
||||
switch (selectedActSeqFromTo.value) {
|
||||
@@ -997,6 +1031,9 @@ function getPartialProcessingTimeData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds the data payload for the 'Waiting time' rule.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getWaitingTimeData() {
|
||||
let dataToSave;
|
||||
switch (selectedProcessScope.value) {
|
||||
@@ -1010,6 +1047,9 @@ function getWaitingTimeData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds end-to-end waiting time rule data.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getEndToEndWaitingTimeData() {
|
||||
let dataToSave;
|
||||
switch (selectedActSeqMore.value) {
|
||||
@@ -1064,6 +1104,9 @@ function getEndToEndWaitingTimeData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds partial waiting time rule data.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getPartialWaitingTimeData() {
|
||||
let dataToSave;
|
||||
switch (selectedActSeqFromTo.value) {
|
||||
@@ -1109,6 +1152,9 @@ function getPartialWaitingTimeData() {
|
||||
return dataToSave;
|
||||
}
|
||||
|
||||
/** Builds the data payload for the 'Cycle time' rule.
|
||||
* @returns {object} The rule data to submit.
|
||||
*/
|
||||
function getCycleTimeData() {
|
||||
let dataToSave;
|
||||
switch (selectedActSeqMore.value) {
|
||||
@@ -1164,7 +1210,7 @@ function getCycleTimeData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 設置根據類別的任務選擇邏輯
|
||||
* Sets up category-based task selection logic.
|
||||
*/
|
||||
function setTaskByCategoryOnRadioEmitting() {
|
||||
emitter.on('actRadioData', (data) => {
|
||||
@@ -1201,6 +1247,10 @@ function setTaskByCategoryOnRadioEmitting() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles start task selection for activity sequence.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmSeqStart(task) {
|
||||
if (isStartSelected.value && task !== selectCfmSeqStart.value) {
|
||||
selectCfmSeqEnd.value = null;
|
||||
@@ -1208,6 +1258,10 @@ function handleCfmSeqStart(task) {
|
||||
selectCfmSeqStart.value = task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles end task selection for activity sequence.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmSeqEnd(task) {
|
||||
if (isEndSelected.value && task !== selectCfmSeqEnd.value) {
|
||||
selectCfmSeqStart.value = null;
|
||||
@@ -1215,64 +1269,109 @@ function handleCfmSeqEnd(task) {
|
||||
selectCfmSeqEnd.value = task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a simple task selection on a ref field.
|
||||
* @param {object} field - The ref to set.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleSimpleSelection(field, task) {
|
||||
selectFieldRefs[field].value = task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles start task for end-to-end processing time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmPtEteSEStart(task) {
|
||||
if (isStartSelected.value && task !== selectCfmPtEteSEStart.value) {
|
||||
selectCfmPtEteSEEnd.value = null;
|
||||
}
|
||||
selectCfmPtEteSEStart.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles end task for end-to-end processing time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmPtEteSEEnd(task) {
|
||||
if (isEndSelected.value && task !== selectCfmPtEteSEEnd.value) {
|
||||
selectCfmPtEteSEStart.value = null;
|
||||
}
|
||||
selectCfmPtEteSEEnd.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles start task for partial processing time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmPtPSEStart(task) {
|
||||
if (isStartSelected.value && task !== selectCfmPtPSEStart.value) {
|
||||
selectCfmPtPSEEnd.value = null;
|
||||
}
|
||||
selectCfmPtPSEStart.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles end task for partial processing time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmPtPSEEnd(task) {
|
||||
if (isEndSelected.value && task !== selectCfmPtPSEEnd.value) {
|
||||
selectCfmPtPSEStart.value = null;
|
||||
}
|
||||
selectCfmPtPSEEnd.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles start task for end-to-end waiting time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmWtEteSEStart(task) {
|
||||
if (isStartSelected.value && task !== selectCfmWtEteSEStart.value) {
|
||||
selectCfmWtEteSEEnd.value = null;
|
||||
}
|
||||
selectCfmWtEteSEStart.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles end task for end-to-end waiting time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmWtEteSEEnd(task) {
|
||||
if (isEndSelected.value && task !== selectCfmWtEteSEEnd.value) {
|
||||
selectCfmWtEteSEStart.value = null;
|
||||
}
|
||||
selectCfmWtEteSEEnd.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles start task for partial waiting time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmWtPSEStart(task) {
|
||||
if (isStartSelected.value && task !== selectCfmWtPSEStart.value) {
|
||||
selectCfmWtPSEEnd.value = null;
|
||||
}
|
||||
selectCfmWtPSEStart.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles end task for partial waiting time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmWtPSEEnd(task) {
|
||||
if (isEndSelected.value && task !== selectCfmWtPSEEnd.value) {
|
||||
selectCfmWtPSEStart.value = null;
|
||||
}
|
||||
selectCfmWtPSEEnd.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles start task for end-to-end cycle time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmCtEteSEStart(task) {
|
||||
if (isStartSelected.value && task !== selectCfmCtEteSEStart.value) {
|
||||
selectCfmCtEteSEEnd.value = null;
|
||||
}
|
||||
selectCfmCtEteSEStart.value = task;
|
||||
}
|
||||
/**
|
||||
* Handles end task for end-to-end cycle time.
|
||||
* @param {string} task - The selected task.
|
||||
*/
|
||||
function handleCfmCtEteSEEnd(task) {
|
||||
if (isEndSelected.value && task !== selectCfmCtEteSEEnd.value) {
|
||||
selectCfmCtEteSEStart.value = null;
|
||||
@@ -1280,6 +1379,7 @@ function handleCfmCtEteSEEnd(task) {
|
||||
selectCfmCtEteSEEnd.value = task;
|
||||
}
|
||||
|
||||
/** Sets task data when the list sequence emits a change. */
|
||||
function setTaskByCategoryOnListSeqEmitting(){
|
||||
emitter.on('getListSequence', (data) => {
|
||||
switch (data.category) {
|
||||
@@ -1295,15 +1395,21 @@ function setTaskByCategoryOnListSeqEmitting(){
|
||||
});
|
||||
}
|
||||
|
||||
/** Checks if the 'Have activity' rule has valid selections.
|
||||
* @returns {boolean} Whether the button should be disabled.
|
||||
*/
|
||||
function checkHaveActivity() {
|
||||
return !(selectConformanceTask.value?.length);
|
||||
}
|
||||
/** Checks if the 'Activity duration' rule has valid selections.
|
||||
* @returns {boolean} Whether the button should be disabled.
|
||||
*/
|
||||
function checkActivityDuration() {
|
||||
return !selectDurationData.value?.length;
|
||||
}
|
||||
/**
|
||||
* 檢查活動序列的邏輯
|
||||
* @returns {boolean} 是否禁用按鈕
|
||||
* Checks the activity sequence logic.
|
||||
* @returns {boolean} Whether the button should be disabled.
|
||||
*/
|
||||
function checkActivitySequence() {
|
||||
switch (selectedActivitySequence.value) {
|
||||
@@ -1316,15 +1422,18 @@ function checkActivitySequence() {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 檢查 Start & End 活動序列
|
||||
* @param {string} start 活動開始
|
||||
* @param {string} end 活動結束
|
||||
* @returns {boolean} 是否禁用按鈕
|
||||
* Checks the Start & End activity sequence.
|
||||
* @param {string} start - The start activity.
|
||||
* @param {string} end - The end activity.
|
||||
* @returns {boolean} Whether the button should be disabled.
|
||||
*/
|
||||
function checkStartAndEndSequence(start, end) {
|
||||
return !(start && end);
|
||||
}
|
||||
|
||||
/** Checks if the 'Processing time' rule has valid selections.
|
||||
* @returns {boolean} Whether the button should be disabled.
|
||||
*/
|
||||
function checkProcessingTime() {
|
||||
let disabled = true;
|
||||
switch (selectedProcessScope.value) {
|
||||
@@ -1339,6 +1448,9 @@ function checkProcessingTime() {
|
||||
}
|
||||
return disabled;
|
||||
}
|
||||
/** Checks end-to-end scope selections.
|
||||
* @returns {boolean} Whether the button should be disabled.
|
||||
*/
|
||||
function checkEndToEnd() {
|
||||
let disabled = true;
|
||||
switch (selectedActSeqMore.value) {
|
||||
@@ -1362,6 +1474,9 @@ function checkEndToEnd() {
|
||||
}
|
||||
return disabled;
|
||||
}
|
||||
/** Checks partial scope selections.
|
||||
* @returns {boolean} Whether the button should be disabled.
|
||||
*/
|
||||
function checkPartial() {
|
||||
let disabled = true;
|
||||
switch (selectedActSeqFromTo.value) {
|
||||
|
||||
Reference in New Issue
Block a user