Merge branch 'ASTRA-78' into 'master'
WIP Добавил max и min параметры для инпута See merge request andrusyakka/urban-couscous!370
This commit is contained in:
@@ -52,7 +52,7 @@ import { v_model } from "@/shared/mixins/v-model";
|
||||
import BaseInputContainer from "@/components/base/BaseInputContainer.vue";
|
||||
|
||||
export default {
|
||||
name: "BaseNumberInput",
|
||||
name: "BaseInputNumber",
|
||||
components: { BaseInput, BaseInputContainer },
|
||||
mixins: [v_model],
|
||||
data() {
|
||||
@@ -65,6 +65,15 @@ export default {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
min: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
reverseValue: Boolean,
|
||||
multiple: Boolean,
|
||||
circle: Boolean,
|
||||
doc: Boolean,
|
||||
@@ -128,14 +137,26 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
increment() {
|
||||
this.value = Number.parseFloat(Number(this.value) + this.step).toFixed(
|
||||
this.rounding
|
||||
);
|
||||
if (this.value < this.max) {
|
||||
this.value = Number.parseFloat(Number(this.value) + this.step).toFixed(
|
||||
this.rounding
|
||||
);
|
||||
} else {
|
||||
if (this.reverseValue) {
|
||||
this.value = this.min;
|
||||
}
|
||||
}
|
||||
},
|
||||
decrement() {
|
||||
this.value = Number.parseFloat(this.value - this.step).toFixed(
|
||||
this.rounding
|
||||
);
|
||||
if (this.min < this.value) {
|
||||
this.value = Number.parseFloat(this.value - this.step).toFixed(
|
||||
this.rounding
|
||||
);
|
||||
} else {
|
||||
if (this.reverseValue) {
|
||||
this.value = this.max;
|
||||
}
|
||||
}
|
||||
},
|
||||
fastIncrement() {
|
||||
this.intervalId = setInterval(() => this.increment(), 100);
|
||||
@@ -3,9 +3,12 @@
|
||||
.thermometry-wrapper.grid.gap-x-20.gap-y-5
|
||||
.flex.flex-col.gap-y-4.items-start(v-if="isEdit" v-for="(thermometry, key) in protocol[data.key]")
|
||||
span.font-semibold.text-smm {{ data.config.temperature[key].title }}
|
||||
base-number-input.w-full(
|
||||
base-input-number.w-full(
|
||||
v-model="thermometry.temperature",
|
||||
:step="1",
|
||||
:min="1",
|
||||
:max="100",
|
||||
reverse-value
|
||||
label="Температура",
|
||||
outlined,
|
||||
shadow-text="º"
|
||||
@@ -52,12 +55,12 @@
|
||||
<script>
|
||||
import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue";
|
||||
import BaseInput from "@/components/base/BaseInput.vue";
|
||||
import BaseNumberInput from "@/components/base/BaseNumberInput.vue";
|
||||
import BaseInputNumber from "@/components/base/BaseInputNumber.vue";
|
||||
import { mapState } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "ThermometryForm",
|
||||
components: { MedicalFormWrapper, BaseInput, BaseNumberInput },
|
||||
components: { MedicalFormWrapper, BaseInput, BaseInputNumber },
|
||||
props: {
|
||||
data: Object,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user