Convert all store files from JavaScript to TypeScript
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
47
src/stores/conformanceInput.ts
Normal file
47
src/stores/conformanceInput.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { defineStore } from "pinia";
|
||||
import moment from 'moment';
|
||||
|
||||
/**
|
||||
* stores/conformanceInput.js 與 stores/conformance.js 的差別在於
|
||||
* 本store側重在暫存使用者的輸入
|
||||
* 而後者則側重在 API 的串接之所需
|
||||
*/
|
||||
|
||||
export const useConformanceInputStore = defineStore('conformanceInputStore', {
|
||||
state: () => ({
|
||||
inputDataToSave: {
|
||||
inputStart: null, // 有待釐清,start 是活動的開始,還是時間的開始?
|
||||
inputEnd: null,
|
||||
min: null,
|
||||
max: null,
|
||||
type: null,
|
||||
task: null,
|
||||
},
|
||||
activityRadioData: {
|
||||
category: null,
|
||||
task: ['', ''],
|
||||
},
|
||||
}),
|
||||
getters: {
|
||||
},
|
||||
actions: {
|
||||
/**
|
||||
* Sets the activity radio global state for either the start ('From') or end ('To') of a task.
|
||||
* We arrange in this way because backend needs us to communicate in this way.
|
||||
* @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;
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user