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