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 calendarForMy = ref([]);
|
||||
const eventFromCalendar = ref({})
|
||||
const idEvent = ref(null)
|
||||
// const idEvent = ref(1)
|
||||
// const idEvent = ref(null)
|
||||
const idEvent = ref(2)
|
||||
|
||||
const getMonth = (month) => {
|
||||
MyMonth.value = month + 1;
|
||||
|
||||
@@ -32,15 +32,15 @@ export default {
|
||||
},
|
||||
set(newValue) {
|
||||
chek.value = newValue;
|
||||
newValue == true
|
||||
? (propsDateEvent.value.date_end = new Date(
|
||||
new Date(propsDateEvent.value.date_start).setHours(23, 59, 0)
|
||||
if(newValue == true)
|
||||
(propsDateEvent.value.date_end = new Date(
|
||||
new Date(propsDateEvent.value.date_end).setHours(23, 59, 0)
|
||||
)) &&
|
||||
(propsDateEvent.value.date_start = new Date(
|
||||
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');
|
||||
},
|
||||
|
||||
|
||||
@@ -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"
|
||||
readonly
|
||||
hide-details
|
||||
:disabled="disbleTime"
|
||||
>
|
||||
<template v-slot:prepend-inner>
|
||||
<v-icon
|
||||
@@ -39,17 +38,17 @@
|
||||
hide-header
|
||||
border
|
||||
no-time
|
||||
:max="order[0] == 2 ? new Date(propsDateEvent.date_end) : false"
|
||||
:max="order[0] == 2 ? new Date(limitation) : false"
|
||||
:min="
|
||||
order[0] == 2
|
||||
? false
|
||||
: new Date(
|
||||
new Date(propsDateEvent.date_start).setDate(
|
||||
new Date(propsDateEvent.date_start).getDate() - 1
|
||||
new Date(limitation).setDate(
|
||||
new Date(limitation).getDate() - 1
|
||||
)
|
||||
)
|
||||
"
|
||||
></v-date-picker>
|
||||
/>
|
||||
</v-locale-provider>
|
||||
</v-menu>
|
||||
</v-col>
|
||||
@@ -66,7 +65,7 @@
|
||||
:active="menutime"
|
||||
:focus="menutime"
|
||||
hide-details
|
||||
:disabled="disbleTime"
|
||||
:disabled="chek"
|
||||
>
|
||||
</v-textarea>
|
||||
<v-menu
|
||||
@@ -86,143 +85,79 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatComa, formatDash } from "@/utils/universal_functions";
|
||||
import { ref, computed } from "vue";
|
||||
import { formatComa, formatDash } from "@/utils/universal_functions";
|
||||
export default {
|
||||
props: {
|
||||
dateEvent: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
|
||||
limitation: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
|
||||
order: {
|
||||
type: Array,
|
||||
default: [0, 0],
|
||||
},
|
||||
chek: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
const menudate = ref(false);
|
||||
const menutime = ref(false);
|
||||
const disbleTime = ref(false);
|
||||
|
||||
const propsDateEvent = computed({
|
||||
get: () => props.dateEvent,
|
||||
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({
|
||||
get() {
|
||||
let date =
|
||||
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;
|
||||
return new Date(propsDateEvent.value);
|
||||
},
|
||||
set(newValue) {
|
||||
|
||||
|
||||
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
|
||||
// );
|
||||
creatwdDate(newValue, 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()
|
||||
return `${new Date(propsDateEvent.value).getHours()}:${String(
|
||||
new Date(propsDateEvent.value).getMinutes()
|
||||
).padStart(2, "0")}`;
|
||||
},
|
||||
|
||||
set(newValue) {
|
||||
|
||||
minEnd(newValue)
|
||||
|
||||
if (props.order[0] == 2)
|
||||
propsDateEvent.value.date_start = new Date(
|
||||
formatDash(modelDate.value) + "T" + newValue
|
||||
);
|
||||
creatwdDate(modelDate.value, 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 {
|
||||
propsDateEvent,
|
||||
modelDate,
|
||||
menudate,
|
||||
menutime,
|
||||
modelDate,
|
||||
formatComa,
|
||||
timeEvent,
|
||||
disbleTime,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -90,24 +90,40 @@
|
||||
</v-col>
|
||||
<v-col class="d-flex flex-column">
|
||||
<v-row no-gutters class="gap">
|
||||
<time-select
|
||||
<!-- <time-select
|
||||
:chek ="allDay"
|
||||
:dateEvent="propsEvent.event"
|
||||
@update:dateEvent="propsEvent.event = $event"
|
||||
: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-icon icon="mdi-minus pt-4" color="grey-darken-1" />
|
||||
</v-col>
|
||||
<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
|
||||
<!-- <time-select
|
||||
:chek ="allDay"
|
||||
:dateEvent="propsEvent.event"
|
||||
:order="[4, 5]"
|
||||
@update:dateEvent="propsEvent.event = $event"
|
||||
/>
|
||||
/> -->
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<period-events
|
||||
@chekUp ="allDay = $event"
|
||||
:dateEventStart="propsEvent.event"
|
||||
@update:dateEventStart="propsEvent.event = $event"
|
||||
/>
|
||||
@@ -192,6 +208,9 @@ export default {
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
const allDay = ref(false)
|
||||
|
||||
const propsEvent = computed({
|
||||
get: () => props.eventCalendar,
|
||||
set: (value) => emit("update:eventCalendar", value),
|
||||
@@ -413,7 +432,8 @@ export default {
|
||||
postFiles,
|
||||
postData,
|
||||
rules,
|
||||
delEvent
|
||||
delEvent,
|
||||
allDay
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user