diff --git a/src/views/admin/feedingconfig/components/feeding-config-form.vue b/src/views/admin/feedingconfig/components/feeding-config-form.vue index 31703b2..cd41234 100644 --- a/src/views/admin/feedingconfig/components/feeding-config-form.vue +++ b/src/views/admin/feedingconfig/components/feeding-config-form.vue @@ -29,52 +29,72 @@ - - +
+ + 分钟 +
校准
- - +
+ + +
- - +
+ + % +
- - +
+ + % +
高速
- - +
+ + % +
- - +
+ + % +
- - +
+ + 分钟 +
低速
- - +
+ + % +
- - +
+ + % +
- - +
+ + 分钟 +
@@ -84,20 +104,28 @@
监控
- - +
+ + +
- - +
+ + % +
- - +
+ + +
- - +
+ + % +
抖动
@@ -236,6 +264,49 @@ watch( } ) +watch( + () => [formData.calibrateVolumePercent, formData.calibrateDuration], + ([volume, duration]) => { + if (duration > 0) { + formData.calibrateTheorySpeed = Number((volume / duration * 60).toFixed(2)) + } else { + formData.calibrateTheorySpeed = 0 + } + } +) + +// 新增:高速理论时长自动计算 +watch( + () => [formData.highSpeedVolumePercent, formData.highSpeedPercent], + ([volume, percent]) => { + if (percent > 0) { + formData.highSpeedTheoryTime = Number((volume / percent).toFixed(2)) + } else { + formData.highSpeedTheoryTime = 0 + } + } +) + +// 新增:低速理论时长自动计算 +watch( + () => [formData.lowSpeedVolumePercent, formData.lowSpeedPercent], + ([volume, percent]) => { + if (percent > 0) { + formData.lowSpeedTheoryTime = Number((volume / percent).toFixed(2)) + } else { + formData.lowSpeedTheoryTime = 0 + } + } +) + +// 新增:总理论时长自动计算 +watch( + () => [formData.calibrateDuration, formData.highSpeedTheoryTime, formData.lowSpeedTheoryTime], + ([calibrateDuration, highSpeedTheoryTime, lowSpeedTheoryTime]) => { + formData.totalTheoryTime = Number(((calibrateDuration / 60) + highSpeedTheoryTime + lowSpeedTheoryTime).toFixed(2)) + } +) + function resetForm() { formRef.value?.resetFields() Object.assign(formData, { @@ -295,6 +366,14 @@ async function open(row?: any) { async function handleSubmit() { if (!formRef.value) return + + // 新增:补料占总量百分比之和校验 + const sum = Number(formData.calibrateVolumePercent) + Number(formData.highSpeedVolumePercent) + Number(formData.lowSpeedVolumePercent) + if (sum !== 100) { + ElMessage.warning('补料占总量百分比之和必须等于100!') + return + } + await formRef.value.validate(async (valid: boolean) => { if (!valid) return loading.value = true @@ -335,7 +414,7 @@ defineExpose({ open }) diff --git a/src/views/admin/feedingconfig/index.vue b/src/views/admin/feedingconfig/index.vue index e9e32fb..1aaae75 100644 --- a/src/views/admin/feedingconfig/index.vue +++ b/src/views/admin/feedingconfig/index.vue @@ -53,7 +53,7 @@ 三段式 - + @@ -101,7 +101,7 @@
- + @@ -198,7 +198,7 @@ const handleEdit = (row: FeedingConfigGetPageOutput) => { } const handleDelete = (row: FeedingConfigGetPageOutput) => { - ElMessageBox.confirm('确认要删除该策略吗?', '提示', { + ElMessageBox.confirm('确认要删除该泵速策略吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'