changes
This commit is contained in:
parent
273d4492a3
commit
d34994bd94
@ -27,7 +27,7 @@ import { storeToRefs } from 'pinia'
|
||||
const store = useGlobalStore()
|
||||
const { goals } = storeToRefs(store)
|
||||
const showEditor = ref(false)
|
||||
const tempGoal = ref<IGoal>(Goal.factory())
|
||||
const tempGoal = ref<IGoal>(Goal.factoryToImpl())
|
||||
|
||||
const canSubmit = computed(() => !Object.values(tempGoal.value).every((v) => v))
|
||||
|
||||
@ -46,7 +46,7 @@ function handleShowEditor() {
|
||||
}
|
||||
|
||||
function handleGoalListEdit(idx: number) {
|
||||
tempGoal.value = goals.value[idx]
|
||||
tempGoal.value = Goal.fac
|
||||
handleShowEditor()
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
import { IGoal, IGoalWeight } from '@renderer/types'
|
||||
import { AssessmentData } from '@renderer/models/Assessment'
|
||||
import { BaseFactoryClass } from '@renderer/types/apidef'
|
||||
|
||||
export class GoalWeight implements IGoalWeight {
|
||||
private _stage: AssessmentData
|
||||
@ -46,7 +47,7 @@ export class GoalWeight implements IGoalWeight {
|
||||
}
|
||||
}
|
||||
|
||||
export class Goal implements IGoal {
|
||||
export class Goal implements IGoal, BaseFactoryClass {
|
||||
private _importance: 'H' | 'M' | 'L'
|
||||
private _indicator: string
|
||||
private _target: string
|
||||
@ -68,6 +69,28 @@ export class Goal implements IGoal {
|
||||
return new Goal('H', '', '', [])
|
||||
}
|
||||
|
||||
public static factoryFromImpl(impl: IGoal): Goal {
|
||||
return new Goal(impl.importance, impl.indicator, impl.target, [])
|
||||
}
|
||||
|
||||
public static factoryToImpl(): IGoal {
|
||||
return {
|
||||
importance: 'H',
|
||||
indicator: '',
|
||||
target: '',
|
||||
weight: []
|
||||
}
|
||||
}
|
||||
|
||||
getCurrentImpl(): IGoal {
|
||||
return {
|
||||
importance: this._importance,
|
||||
indicator: this._indicator,
|
||||
target: this._target,
|
||||
weight: this._weight
|
||||
}
|
||||
}
|
||||
|
||||
get importance(): 'H' | 'M' | 'L' {
|
||||
return this._importance
|
||||
}
|
||||
|
45
src/renderer/src/types/apidef.ts
Normal file
45
src/renderer/src/types/apidef.ts
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2025. Jeffery Hsu - Achievement Report Generator
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
export abstract class BaseFactoryClass {
|
||||
public static factory() {
|
||||
throw new Error('Method not implemented.')
|
||||
}
|
||||
|
||||
public static factoryToImpl<T>(): T {
|
||||
throw new Error('Method not implemented.')
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public static factoryFromImpl<T>(_impl: T): T {
|
||||
throw new Error('Method not implemented.')
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class ExposeImplGetter<T> {
|
||||
getCurrentImpl(): T {
|
||||
throw new Error('Method not implemented.')
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class ExposeImplSetter<T> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public setFromImpl(_impl: T): void {
|
||||
throw new Error('Method not implemented.')
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user