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:
Cindy Chang
2024-06-07 15:31:53 +08:00
parent 88082c3b8a
commit 7e362d8740
5 changed files with 86 additions and 20 deletions

View File

@@ -124,8 +124,8 @@
<script>
import { storeToRefs } from 'pinia';
import i18next from '@/i18n/i18n';
import { mapState, } from 'pinia';
import conformanceInputStore from '@/stores/conformanceInput';
import { mapState, mapActions, } from 'pinia';
import ConformanceInputStore from '@/stores/conformanceInput';
import LoadingStore from '@/stores/loading.js';
import ConformanceStore from '@/stores/conformance.js';
import ConformanceRadioGroup from './ConformanceSidebar/ConformanceRadioGroup.vue';
@@ -502,7 +502,7 @@ export default {
return this.isMainBtnDisabled = disabledBool;
},
...mapState(conformanceInputStore, ['inputDataToSave']),
...mapState(ConformanceInputStore, ['activityRadioData']),
},
watch: {
isSubmittedData: function(newValue) {
@@ -1101,9 +1101,12 @@ export default {
this.isSubmitTimeCfmPtPEnd.rule = this.selectDurationTime;
break;
case 'From & To':
// 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.
dataToSave = {
start: this.selectCfmPtPSEStart,
end: this.selectCfmPtPSEEnd,
start: this.selectCfmPtPSEStart ? this.selectCfmPtPSEStart : this.activityRadioData.task[0],
end: this.selectCfmPtPSEEnd ? this.selectCfmPtPSEEnd : this.activityRadioData.task[this.activityRadioData.task.length - 1],
min: this.selectDurationTime.min,
max: this.selectDurationTime.max,
type: 'processing-time-partial-start-end',
@@ -1427,6 +1430,7 @@ export default {
}
});
},
...mapActions(ConformanceInputStore, [''])
},
created() {
this.isShowBarOpen = this.conformanceLogCreateCheckId || this.conformanceFilterCreateCheckId ? false : true;