(false)
const changeParametres = () => {
const lamelles = Math.floor(form_state.height / parametric.height.step)
lamelles_count.value = lamelles
fence_section.value = form_state.length * 0.001
+
for (const key in form_state) {
if (parametric.hasOwnProperty(key) && parametric[key].max) {
if (form_state[key] > parametric[key].max) {
@@ -46,30 +58,31 @@ const changeParametres = () => {
}
}
}
+
form_state.total_length_mm = form_state.total_length * 1000
if (auto_section_width.value) {
- // form_state.length
- // if (form_state.total_length_mm % form_state.length) {
let w = parametric.length.max
while (((form_state.total_length_mm % w) > 0) && w > (parametric.length.min + parametric.length.step * 10)) {
w -= parametric.length.step
}
form_state.length = w
- // }
-
}
if (form_state.total_length_mm < form_state.length) {
form_state.length = form_state.total_length_mm
}
- form_state.full_sections = Math.ceil(form_state.total_length_mm / form_state.length)
- if (form_state.total_length_mm % form_state.length) {
- form_state.extra_section = (form_state.total_length_mm % form_state.length).toFixed(0)
+
+ const t_f = (form_state.total_length_mm - form_state.fence_length)
+ const i_f = (form_state.length - form_state.fence_length)
+ form_state.full_sections = Math.floor(t_f / i_f)
+ if (t_f % i_f) {
+ form_state.extra_section = Math.round(t_f % i_f)
} else {
form_state.extra_section = 0
}
- if (form_state.extra_section < parametric.length.min) {
- console.log('eh')
+ form_refs.total_length.value.setCustomValidity('')
+ if (form_state.extra_section && form_state.extra_section < parametric.length.min) {
+ form_refs.total_length.value.setCustomValidity('Расчет невозможен')
}
}
@@ -100,6 +113,7 @@ const autoSectionWidth = () => {
const predefLamelleColors = ['#474B4E', '#705335', '#FDF4E3', '#2F4538']
const predefPillarColors = ['#474B4E', '#6A5D4D', '#F4F4F4', '#2F4538']
+watch(form_state, changeParametres, { deep: true })
watch(form_state, changeParametres, { deep: true })
const calc_text = computed(() => {
@@ -124,7 +138,7 @@ const toggleModal = () => {
+ :disabled="auto_section_width" :ref="form_refs.length" />
@@ -132,7 +146,8 @@ const toggleModal = () => {
-
+
@@ -160,7 +175,7 @@ const toggleModal = () => {
+ v-model="form_state.total_length" :ref="form_refs.total_length" />
@@ -169,9 +184,8 @@ const toggleModal = () => {
-
+
-
\ No newline at end of file