Browse Source

fix: 首页消毒配置不可修改

master
guoapeng 2 weeks ago
parent
commit
f248a914a8
  1. 23
      src/components/formula/FormulaConfig.vue
  2. 11
      src/components/home/LineChart.vue
  3. 2
      src/stores/homeStore.ts

23
src/components/formula/FormulaConfig.vue

@ -227,7 +227,8 @@ const deviceState = computed(() => {
* 根据是否有formula_id决定是添加新配方还是编辑已有配方
*/
const onSaveFormula = () => {
if (formData.value.formula_id) { //
if (formData.value.formula_id) {
//
//
if (!deviceState.value && formulaStore.selectedFormulaInfo?.formula_id === formData.value.formula_id) {
ElMessage.warning('禁止修改正在执行的配方信息!')
@ -236,7 +237,8 @@ const onSaveFormula = () => {
const formulaForm: Record<string, any> = convertValuesToString(formData.value, 'name')
onEditFormula(formulaForm.formula_id, formulaForm as Formula.FormulaItem)
}
else { //
else {
//
onAddFormula()
}
}
@ -318,7 +320,10 @@ const onEditFormula = (formula_id: string, formulaForm: Formula.FormulaItem) =>
formulaStore.initFormulaList()
// formData.value = formulaForm
formulaStore.updateSelectedFormulaData(formulaForm)
if (formulaStore.selectedFormulaInfo !== null && formulaStore.selectedFormulaInfo.formula_id === formulaForm.formula_id) {
if (
formulaStore.selectedFormulaInfo !== null
&& formulaStore.selectedFormulaInfo.formula_id === formulaForm.formula_id
) {
formulaStore.updateSelectedFormulaDataByList(formulaForm)
}
})
@ -415,8 +420,16 @@ defineExpose({
<template>
<transition name="slide-right">
<div v-if="isFlip" class="formula-form">
<el-form ref="formRef" :model="formData" label-width="auto" label-position="right" :size="size" inline>
<el-form-item v-if="type !== 'setting' && formulaNameVisible" label="配方名称" style="width: 93%;">
<el-form
ref="formRef"
:disabled="type === 'home'"
:model="formData"
label-width="auto"
label-position="right"
:size="size"
inline
>
<el-form-item v-if="type !== 'setting' && formulaNameVisible" label="配方名称" style="width: 93%">
<el-input
v-model="formData.name"
v-prevent-keyboard

11
src/components/home/LineChart.vue

@ -6,8 +6,6 @@ const props = defineProps<{
envData: Home.DisplayrelyMgrParams
}>()
const dataLength = ref(30)
const titles = {
Internal: '仓内',
WiredExtSensor: '外接传感器',
@ -42,7 +40,6 @@ watch(
xAxis: {
type: 'category',
boundaryGap: false,
data: Array.from({ length: dataLength.value }, (_, i) => `${i + 1}`),
},
yAxis: {
type: 'value',
@ -51,7 +48,7 @@ watch(
{
name: '温度',
type: 'line',
data: newValue.map(item => item.temp),
data: newValue.map(item => item.temp.toFixed(2)),
symbol: 'circle',
symbolSize: 2,
lineStyle: {
@ -62,7 +59,7 @@ watch(
{
name: '湿度',
type: 'line',
data: newValue.map(item => item.rh),
data: newValue.map(item => item.rh.toFixed(2)),
symbol: 'circle',
symbolSize: 2,
lineStyle: {
@ -73,7 +70,7 @@ watch(
{
name: 'H2O2浓度',
type: 'line',
data: newValue.map(item => item.h2o2),
data: newValue.map(item => item.h2o2.toFixed(2)),
symbol: 'circle',
symbolSize: 2,
lineStyle: {
@ -84,7 +81,7 @@ watch(
{
name: 'H2O2饱和度',
type: 'line',
data: newValue.map(item => item.rs),
data: newValue.map(item => item.rs.toFixed(2)),
symbol: 'circle',
symbolSize: 2,
lineStyle: {

2
src/stores/homeStore.ts

@ -57,7 +57,7 @@ export const useHomeStore = defineStore('home', () => {
if (allData.value[index]) {
allData.value[index].data.push(item)
// data中的数据只保留最后30条
if (allData.value[index].data.length > 30) {
if (allData.value[index].data.length > 200) {
allData.value[index].data.shift()
}
}

Loading…
Cancel
Save