[WIP] Добавил возможность просмотра фото
This commit is contained in:
@@ -2,19 +2,35 @@
|
||||
medical-form-wrapper(
|
||||
:title="`${value?.year} год`",
|
||||
:is-edit="isEdit",
|
||||
:openEdit="openEdit",
|
||||
:cancel="cancelEdit"
|
||||
:open-edit="openEdit",
|
||||
:cancel="cancelEdit",
|
||||
:delete-item="deleteCard",
|
||||
:save="saveСhanges",
|
||||
:is-check-change="isCheckChange"
|
||||
)
|
||||
.flex.w-full.gap-x-4
|
||||
.flex.h-fit.flex-col.gap-y-2.p-2.rounded(
|
||||
v-if="value.pictures.length || isEdit"
|
||||
:style="{backgroundColor: 'var(--bg-light-grey)'}"
|
||||
base-modal-showing-picture(
|
||||
v-model="isShowsPicture",
|
||||
:picture="value.pictures.find((el) => el.id === pictureId)?.photo",
|
||||
)
|
||||
.flex.gap-x-2(v-if="value.pictures.length")
|
||||
.flex.relative.h-10.w-10(v-for="picture in value.pictures")
|
||||
img.h-10.w-10.rounded(:src="picture.photo")
|
||||
.flex.flex-col.gap-y-2.p-2.rounded(
|
||||
v-if="value.pictures.length || isEdit",
|
||||
:style="{backgroundColor: 'var(--bg-light-grey)'}",
|
||||
)
|
||||
.flex.gap-2.w-full(v-if="value.pictures.length")
|
||||
.photo.flex.relative(
|
||||
v-for="(picture, index) in value.pictures",
|
||||
:style="{width: isEdit ? '40px' : '104px', height: isEdit ? '40px' : '104px'}",
|
||||
)
|
||||
.photo-viewing.flex.absolute.rounded.cursor-pointer.w-full.h-full.items-center.justify-center(
|
||||
v-if="!isEdit",
|
||||
@click="() => showPicture(picture.id)"
|
||||
)
|
||||
img(src="@/assets/icons/whiteEye.svg" alt="eye")
|
||||
img.h-full.w-full.rounded(:src="picture.photo")
|
||||
q-btn.absolute(
|
||||
@click="() => deletePicture(picture)",
|
||||
v-if="isEdit",
|
||||
@click="() => deletePicture(picture.id)",
|
||||
round,
|
||||
dense,
|
||||
size="16px",
|
||||
@@ -26,7 +42,10 @@
|
||||
size="8px",
|
||||
:style="{color: 'var(--default-white)'}"
|
||||
)
|
||||
.download.flex.cursor-pointer.relative.items-center.justify-center.rounded(:style="{height: '93px'}")
|
||||
.download.flex.cursor-pointer.relative.items-center.justify-center.rounded(
|
||||
v-if="isEdit",
|
||||
:style="{ height: '93px' }",
|
||||
)
|
||||
base-input.w-full.h-full(
|
||||
@update:model-value="(e) => addNewFiles(e)",
|
||||
doc,
|
||||
@@ -37,14 +56,24 @@
|
||||
multiple
|
||||
)
|
||||
label.absolute.w-fit.h-fit(for="download")
|
||||
q-icon(name="app:download" size="24px")
|
||||
q-icon(
|
||||
name="app:download",
|
||||
size="24px"
|
||||
)
|
||||
.flex.w-full.flex-col.gap-y-2
|
||||
.flex.font-semibold.text-sm(:style="{color: 'var(--font-grey-color)'}") Комментарий врача
|
||||
.flex.flex-col.comments.rounded.py-3.pl-4.pr-2.h-130px
|
||||
.flex.flex-col.w-full.overflow-y-auto
|
||||
.flex(v-for="(comment, index) in value.comments")
|
||||
.flex.flex-col.rounded.h-full(
|
||||
:class="{'comments': isEdit}",
|
||||
:style="{padding: isEdit ? '12px 8px 12px 16px' : '0 0 0 12px'}"
|
||||
)
|
||||
.flex.flex-col.w-full
|
||||
.flex.items-center.gap-x-2(v-for="(comment, index) in value.comments")
|
||||
.flex.w-1.h-1.rounded-full(
|
||||
v-if="!isEdit",
|
||||
:style="{backgroundColor: 'var(--font-dark-blue-color)'}")
|
||||
q-input.comment.w-full(
|
||||
:ref="`comment-${index}`"
|
||||
:ref="`comment-${index}`",
|
||||
:readonly="!isEdit",
|
||||
v-model="comment.text",
|
||||
borderless,
|
||||
dense,
|
||||
@@ -55,23 +84,36 @@
|
||||
|
||||
<script>
|
||||
import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue";
|
||||
import { v_model } from "@/shared/mixins/v-model";
|
||||
import BaseInput from "@/components/base/BaseInput";
|
||||
import BaseModalShowingPicture from "@/components/base/BaseModalShowingPicture.vue";
|
||||
import { mapActions } from "vuex";
|
||||
import { v_model } from "@/shared/mixins/v-model";
|
||||
|
||||
export default {
|
||||
name: "HealthStateForm",
|
||||
components: { MedicalFormWrapper, BaseInput },
|
||||
components: { MedicalFormWrapper, BaseModalShowingPicture, BaseInput },
|
||||
data() {
|
||||
return {
|
||||
isEdit: false,
|
||||
isCheckChange: true,
|
||||
isShowsPicture: false,
|
||||
pictureId: "",
|
||||
};
|
||||
},
|
||||
mixins: [v_model],
|
||||
methods: {
|
||||
deletePicture(picture) {
|
||||
this.value.pictures = this.value.pictures.filter(
|
||||
(el) => el.photo !== picture.photo
|
||||
);
|
||||
...mapActions({
|
||||
deleteItemData: "deleteItemData",
|
||||
}),
|
||||
showPicture(id) {
|
||||
this.pictureId = id;
|
||||
this.isShowsPicture = true;
|
||||
},
|
||||
deleteCard() {
|
||||
this.deleteItemData({ stateKey: "healthState", itemId: this.value.id });
|
||||
},
|
||||
deletePicture(id) {
|
||||
this.value.pictures = this.value.pictures.filter((el) => el.id !== id);
|
||||
},
|
||||
addNewFiles(e) {
|
||||
Object.values(e).forEach((file) => {
|
||||
@@ -80,6 +122,7 @@ export default {
|
||||
this.value.pictures.push({
|
||||
photo: e.target.result,
|
||||
file: file,
|
||||
id: Math.random(),
|
||||
});
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
@@ -91,6 +134,9 @@ export default {
|
||||
cancelEdit() {
|
||||
this.isEdit = false;
|
||||
},
|
||||
saveСhanges() {
|
||||
this.isEdit = false;
|
||||
},
|
||||
switchСomment(event, index, comment) {
|
||||
if (event.code === "Enter") {
|
||||
event.target.blur();
|
||||
@@ -114,6 +160,13 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="sass" scoped>
|
||||
.photo-viewing
|
||||
display: none
|
||||
background-color: var(--font-dark-blue-color-1)
|
||||
color: var(--default-white)
|
||||
.photo
|
||||
&:hover .photo-viewing
|
||||
display: flex
|
||||
.download
|
||||
width: 216px
|
||||
border: 1px dashed var(--font-grey-color)
|
||||
|
||||
Reference in New Issue
Block a user