diff --git a/src/components/Discover/Conformance/ConformanceSidebar.vue b/src/components/Discover/Conformance/ConformanceSidebar.vue
index f0445c7..662fb81 100644
--- a/src/components/Discover/Conformance/ConformanceSidebar.vue
+++ b/src/components/Discover/Conformance/ConformanceSidebar.vue
@@ -124,8 +124,8 @@
diff --git a/src/components/Discover/Conformance/ConformanceSidebar/ConformanceTimeRange.vue b/src/components/Discover/Conformance/ConformanceSidebar/ConformanceTimeRange.vue
index 2cd7312..c04f974 100644
--- a/src/components/Discover/Conformance/ConformanceSidebar/ConformanceTimeRange.vue
+++ b/src/components/Discover/Conformance/ConformanceSidebar/ConformanceTimeRange.vue
@@ -165,17 +165,23 @@ export default {
switch (category) {
case 'act':
data.forEach(i => {
- if(i.label === task) result = i.duration;
+ if(i.label === task) {
+ result = i.duration;
+ }
});
break;
case 'single':
data.forEach(i => {
- if(i.task === task) result = i.time;
+ if(i.task === task) {
+ result = i.time;
+ }
});
break;
case 'double':
data.forEach(i => {
- if(i.start === task && i.end === taskTwo) result = i.time;
+ if(i.start === task && i.end === taskTwo) {
+ result = i.time;
+ }
});
break;
case 'all':
diff --git a/src/components/durationjs.vue b/src/components/durationjs.vue
index 771972b..d0e4ac9 100644
--- a/src/components/durationjs.vue
+++ b/src/components/durationjs.vue
@@ -28,8 +28,9 @@
:maxlength="tUnits[unit].dsp === 'd' ? 3 : 2"
:value="tUnits[unit].val.toString().padStart(2, '0')"
@focus="onFocus"
- @blur="onBlur"
+ @change="onChange"
@keyup="onKeyUp"
+ v-model="inputTimeFields[index]"
/>
@@ -127,6 +128,16 @@ export default {
}
},
},
+ inputTimeFields: {
+ get() {
+ let paddedTimeFields = [];
+ this.inputTypes.map(inputTypeUnit => {
+ // Pad the dd/hh/mm/ss field string to 2 digits and add it to the list
+ paddedTimeFields.push(this.tUnits[inputTypeUnit].val.toString().padStart(2, '0'));
+ });
+ return paddedTimeFields;
+ },
+ }
},
watch: {
max: {
@@ -176,7 +187,7 @@ export default {
* when blur update input value and show number
* @param {event} event input 傳入的事件
*/
- onBlur(event) {
+ onChange(event) {
let baseInputValue = event.target.value;
let decoratedInputValue;
// 讓前綴數字自動補 0
@@ -184,6 +195,7 @@ export default {
event.target.value = '00' :
// event.target.value = event.target.value.toString().padStart(2, '0'); // 前綴要補 0
event.target.value = event.target.value.toString();
+ decoratedInputValue = event.target.value.toString();
// 手 key 數值大於最大值時,要等於最大值
// 先將字串轉為數字才能比大小
@@ -283,7 +295,9 @@ export default {
this.seconds = input.value;
break;
};
- if (selectIt) input.select();
+ if (selectIt) {
+ input.select();
+ }
this.calculateTotalSeconds();
},
/**
diff --git a/src/stores/conformanceInput.js b/src/stores/conformanceInput.js
index 8c353b4..0092c27 100644
--- a/src/stores/conformanceInput.js
+++ b/src/stores/conformanceInput.js
@@ -4,17 +4,45 @@ import moment from 'moment';
export default defineStore('conformanceInputStore', {
state: () => ({
inputDataToSave: {
- inputStart: null,
+ inputStart: null, // 有待釐清,start 是活動的開始,還是時間的開始?
inputEnd: null,
min: null,
max: null,
type: null,
task: null,
- },
+ },
+ activityRadioData: {
+ category: null,
+ task: ['', ''],
+ },
}),
getters: {
},
actions: {
+ /**
+ * Set input activity radio data
+ * @param {object} actRadioData
+ */
+ setActivityRadioStartEndData(actRadioData) {
+ this.activityRadioData = actRadioData;
+ },
+ /**
+ * Sets the activity radio global state for either the start ('From') or end ('To') of a task.
+ * @param {object} actRadioData
+ * @param {string} fromToStr 'From' or 'To'
+ */
+ setActivityRadioStartEndData(actRadioData, fromToStr){
+ switch(fromToStr) {
+ case 'From':
+ this.activityRadioData.task[0] = actRadioData;
+ break;
+ case 'To':
+ this.activityRadioData.task[this.activityRadioData.task.length - 1] = actRadioData;
+ break;
+ default:
+ break;
+ }
+ },
/**
* Temporarily set conformance input data which is probably fed to backend later.
* @param {object} userInputObj
@@ -27,7 +55,6 @@ export default defineStore('conformanceInputStore', {
* @param {string} startStr
*/
setConformanceInputStart(startStr){
- console.log('startStr', startStr);
this.inputDataToSave.inputStart = moment(startStr).format('YYYY-MM-DDTHH:mm:ss');
},
/**
@@ -35,7 +62,6 @@ export default defineStore('conformanceInputStore', {
* @param {string} startStr
*/
setConformanceInputEnd(endStr){
- console.log('endStr', endStr);
this.inputDataToSave.inputEnd = moment(endStr).format('YYYY-MM-DDTHH:mm:ss');
},
},