P-47 Изменение времени
This commit is contained in:
1 parent
794e4a9b25
commit
d2b6e65d7f
4 files changed
+171
-104
No files matched your search
@@ -5,7 +5,7 @@
|
||||
:close-on-content-click="false"
|
||||
:max-width="800"
|
||||
offset-x
|
||||
>
|
||||
>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-icon
|
||||
v-bind="attrs"
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col lg="2">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
readonly
|
||||
variant="outlined"
|
||||
v-model="timeEvent"
|
||||
:active="menutime"
|
||||
:focus="menutime"
|
||||
|
||||
>
|
||||
|
||||
</v-textarea>
|
||||
<v-menu
|
||||
v-model="menutime"
|
||||
:close-on-content-click="false"
|
||||
activator="parent"
|
||||
transition="scale-transition"
|
||||
>
|
||||
|
||||
<v-time-picker
|
||||
v-if="menutime"
|
||||
v-model="timeEvent"
|
||||
full-width
|
||||
format="24hr"
|
||||
></v-time-picker>
|
||||
</v-menu>
|
||||
<!-- <v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="timeEvent"
|
||||
></v-textarea> -->
|
||||
</v-col>
|
||||
<v-col lg="3">
|
||||
<v-menu
|
||||
v-model="menudate"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="40"
|
||||
transition="scale-transition"
|
||||
offset-y
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-textarea
|
||||
v-model="myDate"
|
||||
:value="formatComa(myDate)"
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-bind="props"
|
||||
readonly
|
||||
>
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon
|
||||
v-bind="props"
|
||||
icon="mdi-calendar-today"
|
||||
color="cyan-darken-3"
|
||||
size="x-small"
|
||||
/>
|
||||
</template>
|
||||
</v-textarea>
|
||||
</template>
|
||||
<v-locale-provider locale="ru">
|
||||
<v-date-picker
|
||||
v-model="myDate"
|
||||
show-adjacent-months
|
||||
hide-header
|
||||
border
|
||||
no-time
|
||||
></v-date-picker>
|
||||
</v-locale-provider>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatComa, formatDash } from "@/utils/universal_functions";
|
||||
import { ref, computed } from "vue";
|
||||
export default {
|
||||
props: {
|
||||
date: {
|
||||
type: String,
|
||||
default: "2024-07-01",
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const menudate = ref(false);
|
||||
const menutime = ref(false);
|
||||
|
||||
const myDate = computed({
|
||||
get() {
|
||||
return new Date(props.date);
|
||||
},
|
||||
set(newValue) {
|
||||
// console.log( , 'newValue')
|
||||
emit(
|
||||
"update:date",
|
||||
new Date(formatDash(newValue) + "T" + timeEvent.value)
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
const timeEvent = computed({
|
||||
get() {
|
||||
return `${new Date(props.date).getHours()}:${String(
|
||||
new Date(props.date).getMinutes()
|
||||
).padStart(2, "0")}`;
|
||||
},
|
||||
|
||||
set(newValue) {
|
||||
emit(
|
||||
"update:date",
|
||||
new Date(formatDash(myDate.value) + "T" + newValue)
|
||||
);
|
||||
// console.log(formatDash(myDate.value))
|
||||
|
||||
// emit("update:date", newValue);
|
||||
// let timeParts = newValue.split(":");
|
||||
// let h = new Date(props.date).setHours(
|
||||
// parseInt(timeParts[0], 10),
|
||||
// parseInt(timeParts[1], 10)
|
||||
// );
|
||||
// emit("update:date", new Date(h));
|
||||
// console.log(newValue, new Date(h), '22222222222222222')
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
menudate,
|
||||
menutime,
|
||||
formatComa,
|
||||
timeEvent,
|
||||
myDate,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
@@ -160,7 +160,8 @@ export default {
|
||||
|
||||
newCalendar.value = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
calendarNewOrOld();
|
||||
|
||||
@@ -274,7 +275,9 @@ export default {
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.custom-tooltip {
|
||||
max-width: 350px; /* Установка максимальной ширины для подсказки */
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -85,88 +85,18 @@
|
||||
Дата и время
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col lg="2">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="timeEvent"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<v-col lg="3">
|
||||
<v-menu
|
||||
v-model="menudate"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="40"
|
||||
transition="scale-transition"
|
||||
offset-y
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-textarea
|
||||
v-model="dateEvent"
|
||||
:value="dateEvent"
|
||||
no-resize
|
||||
class="my-textarea"
|
||||
rows="1"
|
||||
hide-details
|
||||
style="width: 119px"
|
||||
variant="plain"
|
||||
density="compact"
|
||||
v-bind="props"
|
||||
>
|
||||
|
||||
<template v-slot:prepend-inner>
|
||||
|
||||
<time-select
|
||||
:date="propsEvent.event.date_start"
|
||||
@update:date ="propsEvent.event.date_start = $event"
|
||||
/>
|
||||
|
||||
<time-select
|
||||
:date="propsEvent.event.date_end"
|
||||
@update:date ="propsEvent.event.date_end = $event"
|
||||
/>
|
||||
|
||||
</template>
|
||||
</v-textarea>
|
||||
</template>
|
||||
<v-locale-provider locale="ru">
|
||||
<v-date-picker
|
||||
v-model="dateEvent"
|
||||
show-adjacent-months
|
||||
hide-header
|
||||
border
|
||||
no-time
|
||||
|
||||
/>
|
||||
</v-locale-provider>
|
||||
</v-menu>
|
||||
<!-- <v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="dateEvent"
|
||||
></v-textarea> -->
|
||||
</v-col>
|
||||
|
||||
<v-icon icon="mdi-minus" color="text_grey" class="pt-4" />
|
||||
|
||||
<v-col lg="3">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="dateEvent"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
<v-col lg="2">
|
||||
<v-textarea
|
||||
density="compact"
|
||||
no-resize
|
||||
row-height="25"
|
||||
rows="1"
|
||||
variant="outlined"
|
||||
v-model="dateEvent"
|
||||
></v-textarea>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row no-gutters>
|
||||
<v-col>
|
||||
<v-textarea
|
||||
@@ -201,12 +131,13 @@
|
||||
<script>
|
||||
import { computed, ref } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import DialogCreate from "./UI_calendar/dialogCreate.vue";
|
||||
import DialogCreate from "@/components/calendar_of_events/UI_calendar/dialogCreate.vue";
|
||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||
import { formatComa } from "@/utils/universal_functions";
|
||||
import TimeSelect from '@/components/calendar_of_events/UI_calendar/timeSelect.vue';
|
||||
|
||||
export default {
|
||||
components: { calendarCreateSelect, DialogCreate },
|
||||
components: { calendarCreateSelect, DialogCreate, TimeSelect },
|
||||
|
||||
props: {
|
||||
eventCalendar: {
|
||||
@@ -310,24 +241,7 @@ export default {
|
||||
console.log(idPart, "idPart");
|
||||
};
|
||||
|
||||
const timeEvent = computed({
|
||||
get() {
|
||||
return `${new Date(
|
||||
propsEvent.value.event.date_start
|
||||
).getHours()}:${String(
|
||||
new Date(propsEvent.value.event.date_start).getMinutes()
|
||||
).padStart(2, "0")}`;
|
||||
},
|
||||
|
||||
set(newValue) {
|
||||
let timeParts = newValue.split(":");
|
||||
let h = new Date(propsEvent.value.event.date_start).setHours(
|
||||
parseInt(timeParts[0], 10),
|
||||
parseInt(timeParts[1], 10)
|
||||
);
|
||||
propsEvent.value.event.date_start = new Date(h);
|
||||
},
|
||||
});
|
||||
|
||||
const dateEvent = computed({
|
||||
get() {
|
||||
@@ -336,8 +250,9 @@ export default {
|
||||
},
|
||||
|
||||
set(newValue) {
|
||||
let dateParts = newValue.split(".");
|
||||
|
||||
let dateParts = newValue.split(".");
|
||||
console.log(dateParts, timeEvent.value, '1111111111111111111111111111')
|
||||
// let d = new Date(propsEvent.value.event.date_start).setFullYear(parseInt(dateParts[2], 10), parseInt(dateParts[1], 10), parseInt(dateParts[0], 10))
|
||||
// let d = new Date(propsEvent.value.event.date_start).setDate(new Date(2024,01,01))
|
||||
// propsEvent.value.event.date_start = new Date(2024,01,01);
|
||||
@@ -357,7 +272,7 @@ export default {
|
||||
staff,
|
||||
newStaff,
|
||||
returnIdParticant,
|
||||
timeEvent,
|
||||
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user