P-58
This commit is contained in:
1 parent
48a66002ef
commit
4690dc2fd2
5 files changed
+276
-113
No files matched your search
@@ -120,8 +120,8 @@ export default {
|
|||||||
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
||||||
const calendarForMy = ref([]);
|
const calendarForMy = ref([]);
|
||||||
const eventFromCalendar = ref({})
|
const eventFromCalendar = ref({})
|
||||||
const idEvent = ref(null)
|
// const idEvent = ref(null)
|
||||||
// const idEvent = ref(1)
|
const idEvent = ref(2)
|
||||||
|
|
||||||
const getMonth = (month) => {
|
const getMonth = (month) => {
|
||||||
MyMonth.value = month + 1;
|
MyMonth.value = month + 1;
|
||||||
|
|||||||
@@ -32,15 +32,15 @@ export default {
|
|||||||
},
|
},
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
chek.value = newValue;
|
chek.value = newValue;
|
||||||
newValue == true
|
if(newValue == true)
|
||||||
? (propsDateEvent.value.date_end = new Date(
|
(propsDateEvent.value.date_end = new Date(
|
||||||
new Date(propsDateEvent.value.date_start).setHours(23, 59, 0)
|
new Date(propsDateEvent.value.date_end).setHours(23, 59, 0)
|
||||||
)) &&
|
)) &&
|
||||||
(propsDateEvent.value.date_start = new Date(
|
(propsDateEvent.value.date_start = new Date(
|
||||||
new Date(propsDateEvent.value.date_start).setHours(0, 0, 0)
|
new Date(propsDateEvent.value.date_start).setHours(0, 0, 0)
|
||||||
))
|
))
|
||||||
: (propsDateEvent.value.date_end = new Date())&&(propsDateEvent.value.date_start = new Date())
|
// : (propsDateEvent.value.date_end = new Date())&&(propsDateEvent.value.date_start = new Date())
|
||||||
|
emit('chekUp', newValue)
|
||||||
console.log(propsDateEvent.value.date_start, 'propsDateEvent.value.date_start');
|
console.log(propsDateEvent.value.date_start, 'propsDateEvent.value.date_start');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,208 @@
|
|||||||
|
<template>
|
||||||
|
<v-col lg="3" :class="`order-${order[0]}`">
|
||||||
|
<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="modelDate"
|
||||||
|
:value="formatComa(modelDate)"
|
||||||
|
density="compact"
|
||||||
|
no-resize
|
||||||
|
row-height="25"
|
||||||
|
rows="1"
|
||||||
|
variant="outlined"
|
||||||
|
v-bind="props"
|
||||||
|
readonly
|
||||||
|
hide-details
|
||||||
|
>
|
||||||
|
<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="modelDate"
|
||||||
|
show-adjacent-months
|
||||||
|
hide-header
|
||||||
|
border
|
||||||
|
no-time
|
||||||
|
:max="order[0] == 2 ? new Date(propsDateEvent.date_end) : false"
|
||||||
|
:min="
|
||||||
|
order[0] == 2
|
||||||
|
? false
|
||||||
|
: new Date(
|
||||||
|
new Date(propsDateEvent.date_start).setDate(
|
||||||
|
new Date(propsDateEvent.date_start).getDate() - 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
"
|
||||||
|
></v-date-picker>
|
||||||
|
</v-locale-provider>
|
||||||
|
</v-menu>
|
||||||
|
</v-col>
|
||||||
|
<v-col class="flex-grow-0" :class="`order-${order[1]}`">
|
||||||
|
<v-textarea
|
||||||
|
density="compact"
|
||||||
|
no-resize
|
||||||
|
row-height="25"
|
||||||
|
width="75"
|
||||||
|
rows="1"
|
||||||
|
readonly
|
||||||
|
variant="outlined"
|
||||||
|
v-model="timeEvent"
|
||||||
|
:active="menutime"
|
||||||
|
:focus="menutime"
|
||||||
|
hide-details
|
||||||
|
:disabled="chek"
|
||||||
|
>
|
||||||
|
</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-col>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { formatComa, formatDash } from "@/utils/universal_functions";
|
||||||
|
import { ref, computed } from "vue";
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
dateEvent: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
|
||||||
|
order: {
|
||||||
|
type: Array,
|
||||||
|
default: [0, 0],
|
||||||
|
},
|
||||||
|
|
||||||
|
chek: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const menudate = ref(false);
|
||||||
|
const menutime = ref(false);
|
||||||
|
|
||||||
|
const propsDateEvent = computed({
|
||||||
|
get: () => props.dateEvent,
|
||||||
|
set: (value) => emit("update:dateEvent", value),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const modelDate = computed({
|
||||||
|
get() {
|
||||||
|
let date =
|
||||||
|
props.order[0] == 2
|
||||||
|
? new Date(propsDateEvent.value.date_start)
|
||||||
|
: new Date(propsDateEvent.value.date_end);
|
||||||
|
|
||||||
|
return date;
|
||||||
|
},
|
||||||
|
set(newValue) {
|
||||||
|
console.log(newValue, 'datas')
|
||||||
|
if(props.chek) {
|
||||||
|
if (props.order[0] == 4) {
|
||||||
|
propsDateEvent.value.date_end = new Date(newValue.setHours(23,59))
|
||||||
|
}
|
||||||
|
if (props.order[0] == 2) {
|
||||||
|
propsDateEvent.value.date_start = new Date(newValue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// if (
|
||||||
|
// new Date(formatDash(newValue) + "T" + timeEvent.value) >=
|
||||||
|
// propsDateEvent.value.date_start
|
||||||
|
// ) {
|
||||||
|
// if (props.order[0] == 4)
|
||||||
|
// propsDateEvent.value.date_end = new Date(
|
||||||
|
// formatDash(newValue) + "T" + timeEvent.value
|
||||||
|
// );
|
||||||
|
// } else {
|
||||||
|
// if (props.order[0] == 4)
|
||||||
|
// propsDateEvent.value.date_end = propsDateEvent.value.date_start;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (props.order[0] == 2)
|
||||||
|
// propsDateEvent.value.date_start = new Date(
|
||||||
|
// formatDash(newValue) + "T" + timeEvent.value
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const timeEvent = computed({
|
||||||
|
get() {
|
||||||
|
let time =
|
||||||
|
props.order[0] == 2
|
||||||
|
? propsDateEvent.value.date_start
|
||||||
|
: propsDateEvent.value.date_end;
|
||||||
|
|
||||||
|
return `${new Date(time).getHours()}:${String(
|
||||||
|
new Date(time).getMinutes()
|
||||||
|
).padStart(2, "0")}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
set(newValue) {
|
||||||
|
if (
|
||||||
|
new Date(formatDash(modelDate.value) + "T" + newValue) >=
|
||||||
|
propsDateEvent.value.date_start
|
||||||
|
) {
|
||||||
|
if (props.order[0] == 4)
|
||||||
|
propsDateEvent.value.date_end = new Date(
|
||||||
|
formatDash(modelDate.value) + "T" + newValue
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (props.order[0] == 4)
|
||||||
|
propsDateEvent.value.date_end = propsDateEvent.value.date_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.order[0] == 2)
|
||||||
|
propsDateEvent.value.date_start = new Date(
|
||||||
|
formatDash(modelDate.value) + "T" + newValue
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
propsDateEvent,
|
||||||
|
modelDate,
|
||||||
|
menudate,
|
||||||
|
menutime,
|
||||||
|
formatComa,
|
||||||
|
timeEvent,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
v-bind="props"
|
v-bind="props"
|
||||||
readonly
|
readonly
|
||||||
hide-details
|
hide-details
|
||||||
:disabled="disbleTime"
|
|
||||||
>
|
>
|
||||||
<template v-slot:prepend-inner>
|
<template v-slot:prepend-inner>
|
||||||
<v-icon
|
<v-icon
|
||||||
@@ -39,17 +38,17 @@
|
|||||||
hide-header
|
hide-header
|
||||||
border
|
border
|
||||||
no-time
|
no-time
|
||||||
:max="order[0] == 2 ? new Date(propsDateEvent.date_end) : false"
|
:max="order[0] == 2 ? new Date(limitation) : false"
|
||||||
:min="
|
:min="
|
||||||
order[0] == 2
|
order[0] == 2
|
||||||
? false
|
? false
|
||||||
: new Date(
|
: new Date(
|
||||||
new Date(propsDateEvent.date_start).setDate(
|
new Date(limitation).setDate(
|
||||||
new Date(propsDateEvent.date_start).getDate() - 1
|
new Date(limitation).getDate() - 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
></v-date-picker>
|
/>
|
||||||
</v-locale-provider>
|
</v-locale-provider>
|
||||||
</v-menu>
|
</v-menu>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -66,7 +65,7 @@
|
|||||||
:active="menutime"
|
:active="menutime"
|
||||||
:focus="menutime"
|
:focus="menutime"
|
||||||
hide-details
|
hide-details
|
||||||
:disabled="disbleTime"
|
:disabled="chek"
|
||||||
>
|
>
|
||||||
</v-textarea>
|
</v-textarea>
|
||||||
<v-menu
|
<v-menu
|
||||||
@@ -86,143 +85,79 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { formatComa, formatDash } from "@/utils/universal_functions";
|
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed } from "vue";
|
||||||
|
import { formatComa, formatDash } from "@/utils/universal_functions";
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
dateEvent: {
|
dateEvent: {
|
||||||
type: Object,
|
type: String,
|
||||||
default: () => {},
|
default: "",
|
||||||
|
},
|
||||||
|
|
||||||
|
limitation: {
|
||||||
|
type: String,
|
||||||
|
default: "",
|
||||||
},
|
},
|
||||||
|
|
||||||
order: {
|
order: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: [0, 0],
|
default: [0, 0],
|
||||||
},
|
},
|
||||||
|
chek: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const menudate = ref(false);
|
const menudate = ref(false);
|
||||||
const menutime = ref(false);
|
const menutime = ref(false);
|
||||||
const disbleTime = ref(false);
|
|
||||||
|
|
||||||
const propsDateEvent = computed({
|
const propsDateEvent = computed({
|
||||||
get: () => props.dateEvent,
|
get: () => props.dateEvent,
|
||||||
set: (value) => emit("update:dateEvent", value),
|
set: (value) => emit("update:dateEvent", value),
|
||||||
});
|
});
|
||||||
|
|
||||||
const minEnd = (val) => {
|
|
||||||
// console.log(val, '111')
|
|
||||||
// console.log( new Date(formatDash(modelDate.value) + "T" + val) >
|
|
||||||
// propsDateEvent.value.date_start);
|
|
||||||
// console.log( new Date(formatDash(modelDate.value) + "T" + val),
|
|
||||||
// propsDateEvent.value.date_start);
|
|
||||||
if (
|
|
||||||
new Date(formatDash(modelDate.value) + "T" + val) >
|
|
||||||
propsDateEvent.value.date_start
|
|
||||||
) {
|
|
||||||
if (props.order[0] == 4)
|
|
||||||
propsDateEvent.value.date_end = new Date(
|
|
||||||
formatDash(modelDate.value) + "T" + val
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (props.order[0] == 4)
|
|
||||||
propsDateEvent.value.date_end = propsDateEvent.value.date_start
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const modelDate = computed({
|
const modelDate = computed({
|
||||||
get() {
|
get() {
|
||||||
let date =
|
return new Date(propsDateEvent.value);
|
||||||
props.order[0] == 2
|
|
||||||
? new Date(propsDateEvent.value.date_start)
|
|
||||||
: new Date(propsDateEvent.value.date_end);
|
|
||||||
|
|
||||||
let clockStart = `${new Date(
|
|
||||||
propsDateEvent.value.date_start
|
|
||||||
).getHours()}:${String(
|
|
||||||
new Date(propsDateEvent.value.date_start).getMinutes()
|
|
||||||
).padStart(2, "0")}`;
|
|
||||||
let clockEnd = `${new Date(
|
|
||||||
propsDateEvent.value.date_end
|
|
||||||
).getHours()}:${String(
|
|
||||||
new Date(propsDateEvent.value.date_end).getMinutes()
|
|
||||||
).padStart(2, "0")}`;
|
|
||||||
|
|
||||||
disbleTime.value =
|
|
||||||
clockStart == "0:00" &&
|
|
||||||
clockEnd == "23:59" &&
|
|
||||||
formatDash(propsDateEvent.value.date_start) ==
|
|
||||||
formatDash(propsDateEvent.value.date_end)
|
|
||||||
? true
|
|
||||||
: false;
|
|
||||||
|
|
||||||
return date;
|
|
||||||
},
|
},
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
|
creatwdDate(newValue, timeEvent.value);
|
||||||
|
|
||||||
if (
|
|
||||||
new Date(formatDash(newValue) + "T" + timeEvent.value) >
|
|
||||||
propsDateEvent.value.date_start
|
|
||||||
) {
|
|
||||||
if (props.order[0] == 4)
|
|
||||||
propsDateEvent.value.date_end = new Date(
|
|
||||||
formatDash(newValue) + "T" + timeEvent.value
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (props.order[0] == 4)
|
|
||||||
propsDateEvent.value.date_end = propsDateEvent.value.date_start
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (props.order[0] == 2)
|
|
||||||
propsDateEvent.value.date_start = new Date(
|
|
||||||
formatDash(newValue) + "T" + timeEvent.value
|
|
||||||
);
|
|
||||||
// if (props.order[0] == 4)
|
|
||||||
// propsDateEvent.value.date_end = new Date(
|
|
||||||
// formatDash(newValue) + "T" + timeEvent.value
|
|
||||||
// );
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const timeEvent = computed({
|
const timeEvent = computed({
|
||||||
get() {
|
get() {
|
||||||
let time =
|
return `${new Date(propsDateEvent.value).getHours()}:${String(
|
||||||
props.order[0] == 2
|
new Date(propsDateEvent.value).getMinutes()
|
||||||
? propsDateEvent.value.date_start
|
|
||||||
: propsDateEvent.value.date_end;
|
|
||||||
|
|
||||||
return `${new Date(time).getHours()}:${String(
|
|
||||||
new Date(time).getMinutes()
|
|
||||||
).padStart(2, "0")}`;
|
).padStart(2, "0")}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
|
creatwdDate(modelDate.value, newValue);
|
||||||
minEnd(newValue)
|
|
||||||
|
|
||||||
if (props.order[0] == 2)
|
|
||||||
propsDateEvent.value.date_start = new Date(
|
|
||||||
formatDash(modelDate.value) + "T" + newValue
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const creatwdDate = (date, time) => {
|
||||||
|
if (props.order[0] == 4) {
|
||||||
|
props.limitation;
|
||||||
|
propsDateEvent.value =
|
||||||
|
new Date(formatDash(date) + "T" + time) >= props.limitation
|
||||||
|
? new Date(formatDash(date) + "T" + time)
|
||||||
|
: props.limitation;
|
||||||
|
} else {
|
||||||
|
propsDateEvent.value = new Date(formatDash(date) + "T" + time);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
propsDateEvent,
|
propsDateEvent,
|
||||||
modelDate,
|
|
||||||
menudate,
|
menudate,
|
||||||
menutime,
|
menutime,
|
||||||
|
modelDate,
|
||||||
formatComa,
|
formatComa,
|
||||||
timeEvent,
|
timeEvent,
|
||||||
disbleTime,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -90,24 +90,40 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
<v-col class="d-flex flex-column">
|
<v-col class="d-flex flex-column">
|
||||||
<v-row no-gutters class="gap">
|
<v-row no-gutters class="gap">
|
||||||
<time-select
|
<!-- <time-select
|
||||||
|
:chek ="allDay"
|
||||||
:dateEvent="propsEvent.event"
|
:dateEvent="propsEvent.event"
|
||||||
@update:dateEvent="propsEvent.event = $event"
|
@update:dateEvent="propsEvent.event = $event"
|
||||||
:order="[2, 1]"
|
:order="[2, 1]"
|
||||||
/>
|
/> -->
|
||||||
|
<time-select
|
||||||
|
:chek ="allDay"
|
||||||
|
:order="[2, 1]"
|
||||||
|
:dateEvent=propsEvent.event.date_start
|
||||||
|
:limitation = propsEvent.event.date_end
|
||||||
|
@update:dateEvent="propsEvent.event.date_start = $event"
|
||||||
|
/>
|
||||||
<v-col class="order-3 flex-grow-0">
|
<v-col class="order-3 flex-grow-0">
|
||||||
<v-icon icon="mdi-minus pt-4" color="grey-darken-1" />
|
<v-icon icon="mdi-minus pt-4" color="grey-darken-1" />
|
||||||
</v-col>
|
</v-col>
|
||||||
<!-- @update:dateEvent="propsEvent.event.date_start = $event" -->
|
|
||||||
<time-select
|
<time-select
|
||||||
|
:chek ="allDay"
|
||||||
|
:order="[4, 5]"
|
||||||
|
:dateEvent=propsEvent.event.date_end
|
||||||
|
:limitation = propsEvent.event.date_start
|
||||||
|
@update:dateEvent="propsEvent.event.date_end = $event"
|
||||||
|
/>
|
||||||
|
<!-- @update:dateEvent="propsEvent.event.date_start = $event" -->
|
||||||
|
<!-- <time-select
|
||||||
|
:chek ="allDay"
|
||||||
:dateEvent="propsEvent.event"
|
:dateEvent="propsEvent.event"
|
||||||
:order="[4, 5]"
|
:order="[4, 5]"
|
||||||
@update:dateEvent="propsEvent.event = $event"
|
@update:dateEvent="propsEvent.event = $event"
|
||||||
/>
|
/> -->
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row no-gutters>
|
<v-row no-gutters>
|
||||||
<period-events
|
<period-events
|
||||||
|
@chekUp ="allDay = $event"
|
||||||
:dateEventStart="propsEvent.event"
|
:dateEventStart="propsEvent.event"
|
||||||
@update:dateEventStart="propsEvent.event = $event"
|
@update:dateEventStart="propsEvent.event = $event"
|
||||||
/>
|
/>
|
||||||
@@ -192,6 +208,9 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
|
|
||||||
|
const allDay = ref(false)
|
||||||
|
|
||||||
const propsEvent = computed({
|
const propsEvent = computed({
|
||||||
get: () => props.eventCalendar,
|
get: () => props.eventCalendar,
|
||||||
set: (value) => emit("update:eventCalendar", value),
|
set: (value) => emit("update:eventCalendar", value),
|
||||||
@@ -413,7 +432,8 @@ export default {
|
|||||||
postFiles,
|
postFiles,
|
||||||
postData,
|
postData,
|
||||||
rules,
|
rules,
|
||||||
delEvent
|
delEvent,
|
||||||
|
allDay
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user