P-51 доразобраться с валидацией
This commit is contained in:
1 parent
f6b370ec9c
commit
024af28517
5 files changed
+70
-46
No files matched your search
@@ -117,26 +117,16 @@ export default {
|
||||
|
||||
let objRule = JSON.parse(i.period);
|
||||
// console.log(objRule.origOptions, "распар правила");
|
||||
console.log(i, "i");
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
if (objRule != null) {
|
||||
let startnew =
|
||||
objRule.origOptions.dtstart.split("T")[1].split(":")[0] != 21 &&
|
||||
i.allday == false
|
||||
? new Date(objRule.origOptions.dtstart)
|
||||
: new Date(objRule.origOptions.dtstart.split("T")[0]);
|
||||
|
||||
|
||||
let startnew =
|
||||
(objRule.origOptions.dtstart.split('T')[1].split(':')[0] != 21 && i.allday == false)
|
||||
? new Date(objRule.origOptions.dtstart)
|
||||
: new Date(objRule.origOptions.dtstart.split('T')[0])
|
||||
|
||||
|
||||
|
||||
console.log(objRule.origOptions.dtstart.split('T')[1].split(':')[0] != 21 || i.allday == false , '1')
|
||||
|
||||
console.log(startnew,' startnew')
|
||||
|
||||
let rule = new RRule({
|
||||
...objRule.origOptions,
|
||||
|
||||
@@ -148,10 +138,7 @@ export default {
|
||||
});
|
||||
|
||||
let actRule = rule.all();
|
||||
console.log(
|
||||
actRule,
|
||||
"actRule-------------------------------------"
|
||||
);
|
||||
|
||||
let lastDateMonth = new Date(
|
||||
new Date(dayNextMonth.value).setDate(
|
||||
new Date(dayNextMonth.value).getDate() - 1
|
||||
@@ -329,30 +316,21 @@ export default {
|
||||
ev.rule.byweekday[ev.rule.byweekday.length - 1].weekday == 6
|
||||
? 0
|
||||
: ev.rule.byweekday[ev.rule.byweekday.length - 1].weekday + 1;
|
||||
|
||||
|
||||
if (day.date.getDay() == weeknumS && weeknumS != weeknumE) {
|
||||
return "rounded-e-lg";
|
||||
} else if (day.date.getDay() == weeknumE && weeknumS != weeknumE) {
|
||||
return "rounded-s-lg";
|
||||
} else if (
|
||||
day.date.getDay() != weeknumS &&
|
||||
day.date.getDay() != weeknumE
|
||||
) {
|
||||
return "rounded-sm";
|
||||
} else {
|
||||
return "";
|
||||
return "rounded-lg";
|
||||
}
|
||||
|
||||
// if (
|
||||
// zeroTime(day.date) != zeroTime(ev.start_event) &&
|
||||
// zeroTime(day.date) != zeroTime(ev.end)
|
||||
// ) {
|
||||
// return "rounded-sm";
|
||||
// } else if (
|
||||
// zeroTime(day.date) == zeroTime(ev.start_event) &&
|
||||
// zeroTime(day.date) == zeroTime(ev.end)
|
||||
// ) {
|
||||
// return "";
|
||||
// } else if (zeroTime(day.date) != zeroTime(ev.start_event)) {
|
||||
// return "rounded-s-lg";
|
||||
// } else if (zeroTime(day.date) == zeroTime(ev.start_event)) {
|
||||
// return "rounded-e-lg";
|
||||
// }
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<v-card min-height="436" class="pa-3">
|
||||
<v-card-title class="pr-0 pl-2 d-flex justify-space-between">
|
||||
{{ title }} {{newOrOld}}
|
||||
{{ title }} {{ newOrOld }}
|
||||
<v-icon
|
||||
icon="mdi-close cursor-pointer"
|
||||
size="small"
|
||||
@@ -11,19 +11,27 @@
|
||||
</v-card-title>
|
||||
<v-form ref="form_valid" @submit.prevent="transformation">
|
||||
<v-card-text class="d-flex px-3">
|
||||
<slot name="card_text"></slot>
|
||||
<slot name="card_text" ></slot>
|
||||
</v-card-text>
|
||||
<v-card-actions class="justify-end">
|
||||
<v-btn
|
||||
v-if="!newOrOld"
|
||||
v-if="!newOrOld"
|
||||
icon="mdi-delete"
|
||||
variant="tonal"
|
||||
rounded
|
||||
size="36px"
|
||||
|
||||
@click="$emit('delObject')"
|
||||
/>
|
||||
|
||||
<!-- <v-btn
|
||||
class="text-subtitle-1"
|
||||
elevation="0"
|
||||
width="150"
|
||||
@click="clearValidation"
|
||||
color="btn_gray"
|
||||
variant="flat"
|
||||
>резет</v-btn
|
||||
> -->
|
||||
<v-btn @click="clearFormValidation"></v-btn>
|
||||
<v-btn
|
||||
class="text-subtitle-1"
|
||||
elevation="0"
|
||||
@@ -46,12 +54,11 @@
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { ref, inject } from "vue";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -68,14 +75,32 @@ export default {
|
||||
|
||||
setup(props, { emit }) {
|
||||
const form_valid = ref(null);
|
||||
|
||||
const clearValidation =() => {
|
||||
if (form_valid.value) {
|
||||
form_valid.value.resetValidation()
|
||||
}
|
||||
}
|
||||
|
||||
const transformation = () => {
|
||||
emit("postData", form_valid.value.isValid);
|
||||
form_valid.value = null
|
||||
};
|
||||
|
||||
|
||||
const h = inject('h')
|
||||
|
||||
const clearFormValidation =() => {
|
||||
console.log(h())
|
||||
}
|
||||
|
||||
clearFormValidation()
|
||||
|
||||
|
||||
return {
|
||||
form_valid,
|
||||
transformation,
|
||||
clearValidation,
|
||||
clearFormValidation
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -127,6 +127,7 @@ export default {
|
||||
},
|
||||
|
||||
set(newValue) {
|
||||
|
||||
creatwdDate(modelDate.value, newValue);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -155,6 +155,7 @@ export default {
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
const rules = {
|
||||
|
||||
cl_name: [(val) => req(val)],
|
||||
cl_descr: [(val) => req(val)],
|
||||
};
|
||||
@@ -265,6 +266,7 @@ export default {
|
||||
};
|
||||
|
||||
const req = (val) => {
|
||||
|
||||
return !!val || "Поле обязательно";
|
||||
};
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<v-col class="text-body-2 text-text_grey pb-5" lg="2">
|
||||
Название
|
||||
</v-col>
|
||||
|
||||
<v-col>
|
||||
<v-textarea
|
||||
density="compact"
|
||||
@@ -188,7 +189,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, ref } from "vue";
|
||||
import { computed, ref, provide } from "vue";
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import DialogCreate from "@/components/calendar_of_events/UI_calendar/dialogCreate.vue";
|
||||
import calendarCreateSelect from "@/components/calendar_of_events/calendar-create-select.vue";
|
||||
@@ -216,6 +217,7 @@ export default {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
@@ -224,6 +226,18 @@ export default {
|
||||
set: (value) => emit("update:eventCalendar", value),
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const clearFormValidation = () => {
|
||||
|
||||
console.log('hi')
|
||||
// console.log(h)
|
||||
}
|
||||
|
||||
provide('h', clearFormValidation );
|
||||
|
||||
const repeatRules = [
|
||||
{ type: "Не повторять", rule: {}, id: 1 },
|
||||
{ type: "Каждый день", rule: { freq: 3 }, id: 2 },
|
||||
@@ -298,7 +312,9 @@ export default {
|
||||
|
||||
|
||||
const feedalert = useAlertStore().alert;
|
||||
|
||||
const req = (val) => {
|
||||
console.log(val, 'val')
|
||||
return !!val || "Поле обязательно";
|
||||
};
|
||||
|
||||
@@ -461,6 +477,7 @@ export default {
|
||||
const menudate = ref(false);
|
||||
|
||||
const postData = (validate) => {
|
||||
console.log(validate, ' перед отправкой формы')
|
||||
if (validate) {
|
||||
let postEvent = new FormData();
|
||||
postEvent.append(
|
||||
@@ -573,6 +590,7 @@ export default {
|
||||
returnPeriod,
|
||||
periodDisplayRule,
|
||||
what,
|
||||
clearFormValidation
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user