[WIP] Добавил текс формы Данных обследования

This commit is contained in:
megavrilinvv
2023-05-23 11:26:19 +03:00
parent 98342521a6
commit 4f0ef2ab8c
3 changed files with 43 additions and 5 deletions

View File

@@ -13,18 +13,19 @@
q-checkbox.text-smm.font-medium(v-model="data.results.checked" label="Без особенностей" size="36px")
.textarea.flex.w-full
base-input.w-full(
v-model="data.results.text",
v-model="modelValue",
type="textarea",
outlined,
resize="vertical",
placeholder="Введите данные..."
)
.font-medium.text-smm(v-else) {{data.results?.text}}
.font-medium.text-smm(v-else) {{displayedValue}}
</template>
<script>
import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue";
import BaseInput from "@/components/base/BaseInput.vue";
import { mapState } from "vuex";
export default {
name: "DiseaseForm",
@@ -34,7 +35,29 @@ export default {
fillInspection: Boolean,
},
data() {
return { change: false };
return { change: false, modelValue: null };
},
computed: {
...mapState({
protocolData: (state) => state.medical.protocolData,
}),
state() {
return this.protocolData[this.data.state];
},
findedListItem() {
if (this.data.results?.text && this.modelValue)
return this.data.results?.text === this.modelValue;
return null;
},
reference() {
if (this.findedListItem && this.findedListItem?.text)
return this.findedListItem?.text;
return this.data.results?.text;
},
displayedValue() {
if (this.findedListItem?.text) return this.findedListItem?.text;
return this.modelValue;
},
},
methods: {
openCard() {
@@ -45,10 +68,22 @@ export default {
},
},
watch: {
state: {
immediate: true,
handler(value) {
if (!this.fillInspection) this.modelValue = value;
},
},
fillInspection: {
immediate: true,
handler(newVal) {
if (newVal) this.change = false;
if (newVal) {
this.change = true;
this.modelValue = null;
} else {
this.change = false;
this.modelValue = this.state;
}
},
},
},