WIP Доделала модалку
This commit is contained in:
@@ -12,8 +12,9 @@
|
|||||||
:readonly="readonly",
|
:readonly="readonly",
|
||||||
:disable="disabled",
|
:disable="disabled",
|
||||||
:filled="filled",
|
:filled="filled",
|
||||||
|
mask="##.##.####"
|
||||||
:bg-color="filled || standout ? '' : 'white'",
|
:bg-color="filled || standout ? '' : 'white'",
|
||||||
:rules="rule",
|
:rules="[checkInput]",
|
||||||
:lazy-rules="lazyRule",
|
:lazy-rules="lazyRule",
|
||||||
:item-aligned="itemAligned",
|
:item-aligned="itemAligned",
|
||||||
:no-error-icon="noErrorIcon",
|
:no-error-icon="noErrorIcon",
|
||||||
@@ -23,7 +24,8 @@
|
|||||||
:standout="standout"
|
:standout="standout"
|
||||||
:accept="accept",
|
:accept="accept",
|
||||||
:debounce="debounce",
|
:debounce="debounce",
|
||||||
hide-bottom-space
|
hide-bottom-space,
|
||||||
|
lazy-rules
|
||||||
)
|
)
|
||||||
template(v-slot:append)
|
template(v-slot:append)
|
||||||
q-icon(
|
q-icon(
|
||||||
@@ -32,7 +34,11 @@
|
|||||||
size="16px"
|
size="16px"
|
||||||
)
|
)
|
||||||
q-popup-proxy(cover, transition-show="scale", transition-hide="scale")
|
q-popup-proxy(cover, transition-show="scale", transition-hide="scale")
|
||||||
q-date(v-model="value", mask="YYYY-MM-DD")
|
q-date(
|
||||||
|
v-model="value",
|
||||||
|
mask="DD.MM.YYYY",
|
||||||
|
minimal
|
||||||
|
)
|
||||||
.flex.items-center.justify-end
|
.flex.items-center.justify-end
|
||||||
q-btn(
|
q-btn(
|
||||||
v-close-popup,
|
v-close-popup,
|
||||||
@@ -45,7 +51,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseInputContainer from "@/components/base/BaseInputContainer.vue";
|
import BaseInputContainer from "@/components/base/BaseInputContainer.vue";
|
||||||
|
import * as moment from "moment/moment";
|
||||||
export default {
|
export default {
|
||||||
name: "BaseInputDate",
|
name: "BaseInputDate",
|
||||||
components: { BaseInputContainer },
|
components: { BaseInputContainer },
|
||||||
@@ -92,7 +98,6 @@ export default {
|
|||||||
maxLength: Number,
|
maxLength: Number,
|
||||||
textColor: String,
|
textColor: String,
|
||||||
borderColor: String,
|
borderColor: String,
|
||||||
rule: Array,
|
|
||||||
lazyRule: [Boolean, String],
|
lazyRule: [Boolean, String],
|
||||||
noErrorIcon: Boolean,
|
noErrorIcon: Boolean,
|
||||||
itemAligned: Boolean,
|
itemAligned: Boolean,
|
||||||
@@ -108,20 +113,35 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue
|
if (
|
||||||
? this.modelValue
|
moment(this.modelValue).isValid() &&
|
||||||
?.toISOString()
|
typeof this.modelValue === "object"
|
||||||
.split("T")[0]
|
)
|
||||||
.split("-")
|
return moment(this.modelValue).format("DD.MM.YYYY");
|
||||||
.reverse()
|
if (moment(this.convertFormat(this.modelValue)).isValid())
|
||||||
.join(".")
|
return this.modelValue;
|
||||||
: null;
|
return null;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$emit("update:modelValue", value ? new Date(value) : null);
|
this.$emit(
|
||||||
|
"update:modelValue",
|
||||||
|
moment(this.convertFormat(value)).isValid()
|
||||||
|
? new Date(moment(this.convertFormat(value)))
|
||||||
|
: null
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
convertFormat(date) {
|
||||||
|
return date && date?.length === 10
|
||||||
|
? date.split(".").reverse().join("-")
|
||||||
|
: null;
|
||||||
|
},
|
||||||
|
checkInput(val) {
|
||||||
|
return moment(this.convertFormat(val)).isValid();
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
:disable="disabled",
|
:disable="disabled",
|
||||||
:filled="filled",
|
:filled="filled",
|
||||||
:bg-color="filled || standout ? '' : 'white'",
|
:bg-color="filled || standout ? '' : 'white'",
|
||||||
:rules="rule",
|
:rules="[checkTime]",
|
||||||
:lazy-rules="lazyRule",
|
:lazy-rules="lazyRule",
|
||||||
:item-aligned="itemAligned",
|
:item-aligned="itemAligned",
|
||||||
:no-error-icon="noErrorIcon",
|
:no-error-icon="noErrorIcon",
|
||||||
@@ -112,10 +112,20 @@ export default {
|
|||||||
return this.modelValue ? this.modelValue : null;
|
return this.modelValue ? this.modelValue : null;
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.$emit("update:modelValue", value);
|
this.$emit("update:modelValue", this.checkTime(value) ? value : null);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
checkTime(val) {
|
||||||
|
return (
|
||||||
|
!!val &&
|
||||||
|
val.length === 5 &&
|
||||||
|
val?.slice(0, 2) < 24 &&
|
||||||
|
val?.slice(-2) < 60
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
img.teeth-icon(src="@/assets/icons/teeth.svg")
|
img.teeth-icon(src="@/assets/icons/teeth.svg")
|
||||||
.flex.items-center.gap-x-2
|
.flex.items-center.gap-x-2
|
||||||
base-avatar(:size="40")
|
base-avatar(:size="40")
|
||||||
img.object-cover(
|
img.object-cover.h-full(
|
||||||
v-if="protocolData.employee?.photo"
|
v-if="protocolData.employee?.photo"
|
||||||
:src="protocolData.employee?.photo"
|
:src="protocolData.employee?.photo"
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
type="date",
|
type="date",
|
||||||
textColor="var(--font-dark-blue-color)"
|
textColor="var(--font-dark-blue-color)"
|
||||||
outlined,
|
outlined,
|
||||||
disabled
|
|
||||||
)
|
)
|
||||||
base-input-time(
|
base-input-time(
|
||||||
v-model="protocolData.startTime"
|
v-model="protocolData.startTime"
|
||||||
@@ -19,7 +18,6 @@
|
|||||||
type="time",
|
type="time",
|
||||||
textColor="var(--font-dark-blue-color)",
|
textColor="var(--font-dark-blue-color)",
|
||||||
placeholder="Выберите время"
|
placeholder="Выберите время"
|
||||||
disabled
|
|
||||||
)
|
)
|
||||||
.flex.flex-col.gap-y-6px
|
.flex.flex-col.gap-y-6px
|
||||||
span.color-grey.line-height.text-sm.font-semibold Врач
|
span.color-grey.line-height.text-sm.font-semibold Врач
|
||||||
@@ -52,7 +50,7 @@
|
|||||||
label="Создать осмотр"
|
label="Создать осмотр"
|
||||||
:style="{width: '174px', height: '40px'}",
|
:style="{width: '174px', height: '40px'}",
|
||||||
padding="0",
|
padding="0",
|
||||||
@click="changeShownCreateModal(false)"
|
@click="saveProtocol"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -61,19 +59,25 @@ import BaseInput from "@/components/base/BaseInput.vue";
|
|||||||
import BaseAvatar from "@/components/base/BaseAvatar.vue";
|
import BaseAvatar from "@/components/base/BaseAvatar.vue";
|
||||||
import BaseInputDate from "@/components/base/BaseInputDate.vue";
|
import BaseInputDate from "@/components/base/BaseInputDate.vue";
|
||||||
import BaseInputTime from "@/components/base/BaseInputTime.vue";
|
import BaseInputTime from "@/components/base/BaseInputTime.vue";
|
||||||
import { mapGetters } from "vuex";
|
import * as moment from "moment/moment";
|
||||||
|
import { mapGetters, mapActions } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "MedicalProtocolCreateModal",
|
name: "MedicalProtocolCreateModal",
|
||||||
components: { BaseInput, BaseAvatar, BaseInputDate, BaseInputTime },
|
components: {
|
||||||
|
BaseInput,
|
||||||
|
BaseAvatar,
|
||||||
|
BaseInputDate,
|
||||||
|
BaseInputTime,
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
changeShownCreateModal: Function,
|
changeShownCreateModal: Function,
|
||||||
|
createInspection: Function,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
protocolData: {
|
protocolData: {
|
||||||
date: null,
|
date: new Date(),
|
||||||
startTime: "",
|
startTime: moment().format("HH:mm"),
|
||||||
endTime: "",
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -97,6 +101,28 @@ export default {
|
|||||||
return this.userData?.last_name + firstName + patronymic;
|
return this.userData?.last_name + firstName + patronymic;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions({
|
||||||
|
createProtocol: "createProtocol",
|
||||||
|
}),
|
||||||
|
saveProtocol() {
|
||||||
|
if (
|
||||||
|
!Object.keys(this.protocolData).every((key) => this.protocolData[key])
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let time = this.protocolData.startTime.split(":");
|
||||||
|
let start = moment(this.protocolData.date).hour(time[0]).minute(time[1]);
|
||||||
|
let createdProtocol = {
|
||||||
|
start: start.isValid() ? start.format() : null,
|
||||||
|
end: start.isValid() ? start.add(30, "m").format() : null,
|
||||||
|
status: null,
|
||||||
|
};
|
||||||
|
this.createProtocol(createdProtocol);
|
||||||
|
this.changeShownCreateModal(false);
|
||||||
|
this.createInspection();
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,10 @@
|
|||||||
v-model="showModal",
|
v-model="showModal",
|
||||||
title="Создание осмотра"
|
title="Создание осмотра"
|
||||||
)
|
)
|
||||||
medical-protocol-create-modal(:change-shown-create-modal="changeShownCreateModal")
|
medical-protocol-create-modal(
|
||||||
|
:change-shown-create-modal="changeShownCreateModal",
|
||||||
|
:create-inspection="createInspection"
|
||||||
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -47,6 +50,7 @@ import BaseAvatar from "@/components/base/BaseAvatar.vue";
|
|||||||
import MedicalProtocolCard from "@/pages/newMedicalCard/components/MedicalProtocolCard.vue";
|
import MedicalProtocolCard from "@/pages/newMedicalCard/components/MedicalProtocolCard.vue";
|
||||||
import BaseModal from "@/components/base/BaseModal.vue";
|
import BaseModal from "@/components/base/BaseModal.vue";
|
||||||
import MedicalProtocolCreateModal from "./MedicalProtocolCreateModal.vue";
|
import MedicalProtocolCreateModal from "./MedicalProtocolCreateModal.vue";
|
||||||
|
import { mapState } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "MedicalProtocolsList",
|
name: "MedicalProtocolsList",
|
||||||
components: {
|
components: {
|
||||||
@@ -65,11 +69,13 @@ export default {
|
|||||||
sorting: false,
|
sorting: false,
|
||||||
sortingYear: "",
|
sortingYear: "",
|
||||||
activeProtocolId: 1,
|
activeProtocolId: 1,
|
||||||
protocolsData: null,
|
|
||||||
showModal: false,
|
showModal: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
protocolsData: (state) => state.medical.protocolsData,
|
||||||
|
}),
|
||||||
sortingClass() {
|
sortingClass() {
|
||||||
return this.sorting
|
return this.sorting
|
||||||
? {
|
? {
|
||||||
@@ -130,9 +136,6 @@ export default {
|
|||||||
this.showModal = value;
|
this.showModal = value;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
this.protocolsData = this.$store.state.medical?.protocolsData;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export default createStore({
|
|||||||
? state.url + state.userData[key]
|
? state.url + state.userData[key]
|
||||||
: "";
|
: "";
|
||||||
});
|
});
|
||||||
|
data.job_title = "Ортодонт";
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -293,7 +293,6 @@ const actions = {
|
|||||||
commit("setBenefitData", res.results);
|
commit("setBenefitData", res.results);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getMedicalCardData({ commit }) {
|
getMedicalCardData({ commit }) {
|
||||||
fetchWrapper
|
fetchWrapper
|
||||||
.get(
|
.get(
|
||||||
@@ -337,6 +336,11 @@ const actions = {
|
|||||||
localStorage.removeItem("medicalId");
|
localStorage.removeItem("medicalId");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
createProtocol({ commit, rootGetters, state }, data) {
|
||||||
|
data.employee = rootGetters.getUserData;
|
||||||
|
data.id = state.protocolsData.length + 1;
|
||||||
|
commit("setProtocolsData", data);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
@@ -366,6 +370,9 @@ const mutations = {
|
|||||||
state.events = res.events;
|
state.events = res.events;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
setProtocolsData(state, data) {
|
||||||
|
state.protocolsData = [...state.protocolsData, data];
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
Reference in New Issue
Block a user