|
|
@ -1,7 +1,7 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
import { syncSendCmd } from 'apis/system' |
|
|
|
import { ElMessageBox } from 'element-plus' |
|
|
|
import { onMounted, ref, watch } from 'vue' |
|
|
|
import { onMounted, ref, watch, watchEffect } from 'vue' |
|
|
|
|
|
|
|
import { FtMessage } from '@/libs/message' |
|
|
|
import { FtMessageBox } from '@/libs/messageBox' |
|
|
@ -28,18 +28,20 @@ onMounted(() => { |
|
|
|
initFormulaList() |
|
|
|
}) |
|
|
|
|
|
|
|
watch(formulaStore.formulaList, () => { |
|
|
|
watchEffect(() => { |
|
|
|
recipes.value = formulaStore.formulaList |
|
|
|
if (formulaStore.formulaList) { |
|
|
|
if (formulaStore.selectedIndex != null) { |
|
|
|
selectedIndex.value = formulaStore.selectedIndex |
|
|
|
} |
|
|
|
else { |
|
|
|
selectedIndex.value = formulaStore.formulaList.length - 1 |
|
|
|
} |
|
|
|
selectedIndex.value = formulaStore.formulaList.length - 1 |
|
|
|
} |
|
|
|
}) |
|
|
|
watch(selectedIndex, () => { |
|
|
|
if (selectedIndex.value != null) { |
|
|
|
const currentIndex: number = selectedIndex.value |
|
|
|
const selectItem: Formula.FormulaItem = recipes.value[currentIndex] |
|
|
|
const item = convertValuesToInt(selectItem) as Formula.FormulaItem |
|
|
|
formulaStore.updateSelectedFormulaData(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
const initFormulaList = () => { |
|
|
|
if (formulaStore.formulaList && formulaStore.formulaList.length) { |
|
|
|
recipes.value = formulaStore.formulaList as Formula.FormulaItem[] |
|
|
@ -48,7 +50,6 @@ const initFormulaList = () => { |
|
|
|
formulaStore.initFormulaList() |
|
|
|
} |
|
|
|
} |
|
|
|
watch(selectedIndex, () => {}) |
|
|
|
const selectRecipe = (item: Formula.FormulaItem, index: number) => { |
|
|
|
selectedIndex.value = index |
|
|
|
formulaStore.updateSelectedIndex(index) |
|
|
|