Merge branch 'ASTRA-78' into 'master'
WIP Добавил базовый компонент для числового инпута See merge request andrusyakka/urban-couscous!368
This commit is contained in:
169
src/components/base/BaseNumberInput.vue
Normal file
169
src/components/base/BaseNumberInput.vue
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
<template lang="pug">
|
||||||
|
base-input-container.gap-y-2(:label="label", :style="{width: width + 'px' }")
|
||||||
|
q-input(
|
||||||
|
v-model="value",
|
||||||
|
:name="name",
|
||||||
|
:multiple="multiple"
|
||||||
|
:class="{'circle': circle, 'font-input': true, 'doc': doc}",
|
||||||
|
:input-style="{ color: textColor, borderColor: borderColor, resize: resize}",
|
||||||
|
:borderless="borderless",
|
||||||
|
:placeholder="placeholder",
|
||||||
|
:outlined="outlined",
|
||||||
|
:dense="dense",
|
||||||
|
:type="type",
|
||||||
|
:readonly="readonly",
|
||||||
|
:disable="disabled",
|
||||||
|
:filled="filled",
|
||||||
|
:bg-color="filled || standout ? '' : 'white'",
|
||||||
|
:rules="rule",
|
||||||
|
:lazy-rules="lazyRule",
|
||||||
|
:item-aligned="itemAligned",
|
||||||
|
:no-error-icon="noErrorIcon",
|
||||||
|
:mask="mask",
|
||||||
|
:maxlength="maxLength",
|
||||||
|
:autogrow="autogrow",
|
||||||
|
:square="square",
|
||||||
|
:standout="standout"
|
||||||
|
:accept="accept",
|
||||||
|
:debounce="debounce",
|
||||||
|
:shadow-text="shadowText"
|
||||||
|
hide-bottom-space
|
||||||
|
)
|
||||||
|
.flex.flex-col.mb-1
|
||||||
|
q-icon.cursor-pointer.-rotate-90.arrow(
|
||||||
|
name="arrow_forward_ios",
|
||||||
|
size="15px",
|
||||||
|
@click="increment",
|
||||||
|
@mousedown="fastIncrement",
|
||||||
|
@mouseup="deleteInterval"
|
||||||
|
)
|
||||||
|
q-icon.cursor-pointer.-rotate-90.arrow(
|
||||||
|
name="arrow_back_ios",
|
||||||
|
size="15px",
|
||||||
|
@click="decrement",
|
||||||
|
@mousedown="fastDecrement",
|
||||||
|
@mouseup="deleteInterval"
|
||||||
|
)
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseInput from "@/components/base/BaseInput";
|
||||||
|
import { v_model } from "@/shared/mixins/v-model";
|
||||||
|
import BaseInputContainer from "@/components/base/BaseInputContainer.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "BaseNumberInput",
|
||||||
|
components: { BaseInput, BaseInputContainer },
|
||||||
|
mixins: [v_model],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
intervalId: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
step: {
|
||||||
|
type: Number,
|
||||||
|
default: 1,
|
||||||
|
},
|
||||||
|
multiple: Boolean,
|
||||||
|
circle: Boolean,
|
||||||
|
doc: Boolean,
|
||||||
|
dense: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
outlined: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
square: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
filled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
borderless: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
autogrow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
default: "text",
|
||||||
|
},
|
||||||
|
standout: {
|
||||||
|
type: [Boolean, String],
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
accept: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
resize: {
|
||||||
|
type: String,
|
||||||
|
default: "none",
|
||||||
|
},
|
||||||
|
shadowText: String,
|
||||||
|
mask: String,
|
||||||
|
debounce: [String, Number],
|
||||||
|
width: Number,
|
||||||
|
maxLength: Number,
|
||||||
|
textColor: String,
|
||||||
|
borderColor: String,
|
||||||
|
rule: Array,
|
||||||
|
lazyRule: [Boolean, String],
|
||||||
|
noErrorIcon: Boolean,
|
||||||
|
itemAligned: Boolean,
|
||||||
|
modelValue: [String, Date, Number],
|
||||||
|
placeholder: String,
|
||||||
|
disabled: Boolean,
|
||||||
|
label: String,
|
||||||
|
readonly: Boolean,
|
||||||
|
iconLeft: Boolean,
|
||||||
|
name: String,
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
increment() {
|
||||||
|
this.value = Number.parseFloat(Number(this.value) + this.step).toFixed(
|
||||||
|
this.rounding
|
||||||
|
);
|
||||||
|
},
|
||||||
|
decrement() {
|
||||||
|
this.value = Number.parseFloat(this.value - this.step).toFixed(
|
||||||
|
this.rounding
|
||||||
|
);
|
||||||
|
},
|
||||||
|
fastIncrement() {
|
||||||
|
this.intervalId = setInterval(() => this.increment(), 100);
|
||||||
|
},
|
||||||
|
fastDecrement() {
|
||||||
|
this.intervalId = setInterval(() => this.decrement(), 100);
|
||||||
|
},
|
||||||
|
deleteInterval() {
|
||||||
|
clearInterval(this.intervalId);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
rounding() {
|
||||||
|
return String(this.step).split(".")[1]?.length || 0;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass">
|
||||||
|
.q-field .q-field__control-container
|
||||||
|
display: flex
|
||||||
|
align-items: center
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.arrow
|
||||||
|
color: var(--font-grey-color)
|
||||||
|
&:hover
|
||||||
|
color: var(--font-dark-blue-color)
|
||||||
|
</style>
|
||||||
@@ -3,12 +3,11 @@
|
|||||||
.thermometry-wrapper.grid.gap-x-20.gap-y-5
|
.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]")
|
.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 }}
|
span.font-semibold.text-smm {{ data.config.temperature[key].title }}
|
||||||
base-input.w-full(
|
base-number-input.w-full(
|
||||||
v-model="thermometry.temperature",
|
v-model="thermometry.temperature",
|
||||||
type="number"
|
:step="1",
|
||||||
label="Температура"
|
label="Температура",
|
||||||
outlined
|
outlined,
|
||||||
text-color="black"
|
|
||||||
shadow-text="º"
|
shadow-text="º"
|
||||||
placeholder="0º"
|
placeholder="0º"
|
||||||
)
|
)
|
||||||
@@ -19,7 +18,6 @@
|
|||||||
outlined
|
outlined
|
||||||
text-color="black"
|
text-color="black"
|
||||||
placeholder="Введите диагноз..."
|
placeholder="Введите диагноз..."
|
||||||
max="40"
|
|
||||||
)
|
)
|
||||||
.results-wrapper.flex.flex-col.rounded.w-full.px-4.py-2
|
.results-wrapper.flex.flex-col.rounded.w-full.px-4.py-2
|
||||||
.result.flex.w-full.justify-between.items-center.h-9(v-for="result in data.config.results")
|
.result.flex.w-full.justify-between.items-center.h-9(v-for="result in data.config.results")
|
||||||
@@ -54,11 +52,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue";
|
import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue";
|
||||||
import BaseInput from "@/components/base/BaseInput.vue";
|
import BaseInput from "@/components/base/BaseInput.vue";
|
||||||
|
import BaseNumberInput from "@/components/base/BaseNumberInput.vue";
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ThermometryForm",
|
name: "ThermometryForm",
|
||||||
components: { MedicalFormWrapper, BaseInput },
|
components: { MedicalFormWrapper, BaseInput, BaseNumberInput },
|
||||||
props: {
|
props: {
|
||||||
data: Object,
|
data: Object,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user