fix #217; this time finally found the root cause.
If user didn't click any start-end radio button this time, the start, end value might be null as their initial values are. So we need to use the earliest value stored in pinia. (In ActRadio.vue created phase)
This commit is contained in:
@@ -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');
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user