calc test

This commit is contained in:
Kseninia Mikhaylova 2024-06-13 13:31:03 +03:00
parent 2e43a43478
commit 2e458a8905
1 changed files with 25 additions and 21 deletions

View File

@ -9,23 +9,26 @@ const lamelle_color = useState<ralTypes>('lamelle_color', () => '1002')
const section_count = useState('section_count', () => 1) const section_count = useState('section_count', () => 1)
const extra_section = useState('extra_section', () => 0) const extra_section = useState('extra_section', () => 0)
const parametric = { const parametric_state = useState('parametric', () => {
length: { return {
min: 1000, length: {
max: 2400, min: 1000,
step: 1, max: 2400,
}, step: 1,
total_length: { },
min: 1, total_length: {
max: undefined, min: 1,
step: 0.1, max: undefined,
}, step: 0.1,
height: { },
min: 675, height: {
max: 2400, min: 675,
step: 115, max: 2400,
step: 115,
}
} }
} })
const parametric = parametric_state.value
const form_state = reactive({ const form_state = reactive({
length: fence_section.value * 1000, length: fence_section.value * 1000,
fence_length: 100, fence_length: 100,
@ -35,11 +38,6 @@ const form_state = reactive({
full_sections: 1, full_sections: 1,
extra_section: 0 extra_section: 0
}) })
const form_errors = reactive({
length: false,
height: false,
total_length: false,
})
const form_refs = { const form_refs = {
length: ref(), length: ref(),
height: ref(), height: ref(),
@ -89,6 +87,12 @@ const changeParametres = () => {
if (form_state.extra_section && form_state.extra_section < parametric.length.min) { if (form_state.extra_section && form_state.extra_section < parametric.length.min) {
form_refs.total_length.value.setCustomValidity('Расчет невозможен') form_refs.total_length.value.setCustomValidity('Расчет невозможен')
} }
setTimeout(() => {
if (form_state.total_length < parametric.total_length.min) {
form_state.total_length = parametric.total_length.min
form_state.length = parametric.length.min
}
}, 300)
} }
} }