Модели плюс 38_доделка
This commit is contained in:
1 parent
1a4dfda02e
commit
0231d2970d
11 files changed
+480
-309
No files matched your search
@@ -1,3 +1,47 @@
|
||||
from django.db import models
|
||||
|
||||
from accounts.models import *
|
||||
# Create your models here.
|
||||
from django.conf import settings
|
||||
from enum import Enum
|
||||
from ckeditor_uploader.fields import RichTextUploadingField
|
||||
|
||||
class CalendarEventsName(models.Model):
|
||||
name=models.CharField(max_length=300, verbose_name='Название Календаря')
|
||||
|
||||
class EnumChoice(Enum):
|
||||
@classmethod
|
||||
def get_choices(cls):
|
||||
return [(enum_.name, enum_.value) for enum_ in cls]
|
||||
|
||||
class FrequencyEvents(EnumChoice):
|
||||
daily = "Ежедневно"
|
||||
weekly = "Еженедельно"
|
||||
monthly = "Ежемесячно"
|
||||
annually = "Ежегодно"
|
||||
twice_a_year = "Два раза в год"
|
||||
|
||||
class CalendarEvents(models.Model):
|
||||
name=models.CharField(max_length=300, verbose_name='Название события')
|
||||
description = RichTextUploadingField(null=True, blank= True, verbose_name='Описание события')
|
||||
cdate =models.DateTimeField(default=datetime.now, verbose_name='Дата создания')
|
||||
enddate = models.DateTimeField(null=True, blank= True, default=datetime.now().replace(hour=23,minute=0,second=0,microsecond=0) + timedelta(days=7), verbose_name='Дата снятия с публикации')
|
||||
frequency = models.CharField(verbose_name='Периодичность', max_length=255, db_index=True, choices=FrequencyEvents.get_choices())
|
||||
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор события')
|
||||
docfile = models.FileField(upload_to='documents/%Y/%m/%d')
|
||||
place = models.CharField(max_length=500, verbose_name='Место проведения события')
|
||||
calendarname = models.ForeignKey(CalendarEventsName, on_delete=models.PROTECT, related_name='get_calendar_events_name', verbose_name='Название для календаря')
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Календарь событий"
|
||||
verbose_name_plural = "Календарь событий"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.name)
|
||||
|
||||
class ParticipantsEvent(models.Model):
|
||||
participant = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Участник события')
|
||||
event = models.ForeignKey(CalendarEvents, on_delete=models.PROTECT, related_name='get_calendar_events', verbose_name='Событие')
|
||||
|
||||
|
||||
|
||||
@@ -65,5 +65,6 @@ urlpatterns = [
|
||||
path('api/feedback/', include('feedback.urls')),
|
||||
path('api/general_vacation/', include('general_vacation.urls')),
|
||||
path('api/about_inspection/', include('about_inspection.urls')),
|
||||
path('api/calendar_of_events/', include('calendar_of_events.urls')),
|
||||
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
@@ -2,7 +2,11 @@
|
||||
<v-card max-width='400' density="compact" class="bg-transparent">
|
||||
<v-card-text class="pb-0">Оставлено комментариев</v-card-text>
|
||||
<v-card-subtitle>Последний комментарий оставлен {{formaComaTime(comment.time_create)}}</v-card-subtitle>
|
||||
<v-card-title>{{comment.comment}}</v-card-title>
|
||||
|
||||
<v-card-text class="text-caption">
|
||||
{{comment.comment}}
|
||||
</v-card-text>
|
||||
<!-- <v-card-title class="text-wrap"></v-card-title> -->
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,287 +1,281 @@
|
||||
<template>
|
||||
<pattern-card
|
||||
:title="'Рейтинг посещаемости страниц портала'"
|
||||
:ico="'mdi-chart-bar'"
|
||||
>
|
||||
<template v-slot:filling>
|
||||
<v-data-table-virtual
|
||||
:headers="headers"
|
||||
:items="tabledata"
|
||||
height="400"
|
||||
class="mytable"
|
||||
item-value="name"
|
||||
@update:sortBy=customSort
|
||||
v-model:sort-by="sortBy"
|
||||
density="compact"
|
||||
<pattern-card
|
||||
:title="'Рейтинг посещаемости страниц портала'"
|
||||
:ico="'mdi-chart-bar'"
|
||||
>
|
||||
<template v-slot:header.name>
|
||||
<!-- v-model:sort-by="sortBy" -->
|
||||
<v-switch
|
||||
:label="untot"
|
||||
false-value='уникальные'
|
||||
true-value='всего'
|
||||
hide-details
|
||||
v-model="untot"
|
||||
class="myleft ml-n4"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
<template v-slot:item.name="{ value }">
|
||||
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-2">
|
||||
{{ value }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item.now="{ value, item }">
|
||||
<span class="font-weight-medium text-subtitle-2 ">
|
||||
<v-tooltip
|
||||
v-if="value>0"
|
||||
location="bottom"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span v-bind="props" :class="'untot'=='уникальные'?getColorTooday1(value):getColorTooday2(value) " class="cursor-help font-weight-medium text-subtitle-1 " >
|
||||
{{value}}
|
||||
</span>
|
||||
</template>
|
||||
<v-row
|
||||
no-gutters
|
||||
>
|
||||
<v-col>
|
||||
<v-row
|
||||
no-gutters v-for="n in item.now.unic"
|
||||
:key="n"
|
||||
>
|
||||
<v-col >
|
||||
{{n}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-tooltip>
|
||||
|
||||
</span>
|
||||
|
||||
</template>
|
||||
<template v-slot:item.period="{ value, item }">
|
||||
<span class="font-weight-medium text-subtitle-2">
|
||||
<v-tooltip
|
||||
v-if="value>0"
|
||||
location="bottom"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span v-bind="props" :class="'untot'=='уникальные'?getColorPeriod1(value):getColorPeriod2(value)" class="cursor-help font-weight-medium text-subtitle-1" >
|
||||
{{value}}
|
||||
<!-- {{modelrating?val.now.unique.length:val.now.countall}} -->
|
||||
</span>
|
||||
</template>
|
||||
<v-row
|
||||
no-gutters
|
||||
>
|
||||
<v-col>
|
||||
<v-row
|
||||
no-gutters v-for="n in item.period.unic"
|
||||
:key="n"
|
||||
>
|
||||
<v-col>
|
||||
{{n}}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-tooltip>
|
||||
|
||||
</span>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
</v-data-table-virtual>
|
||||
|
||||
<template v-slot:filling>
|
||||
<v-data-table-virtual
|
||||
:headers="headers"
|
||||
:items="tabledata"
|
||||
height="400"
|
||||
class="mytable"
|
||||
item-value="name"
|
||||
@update:sortBy="customSort"
|
||||
v-model:sort-by="sortBy"
|
||||
density="compact"
|
||||
>
|
||||
<template v-slot:header.name>
|
||||
<v-switch
|
||||
:label="untot"
|
||||
false-value="уникальные"
|
||||
true-value="всего"
|
||||
hide-details
|
||||
v-model="untot"
|
||||
class="myleft ml-n4"
|
||||
/>
|
||||
</template>
|
||||
</pattern-card>
|
||||
<template v-slot:item.name="{ value }">
|
||||
<span class="font-weight-medium cursor-default text-grey-darken-3 myleft text-subtitle-2"
|
||||
>
|
||||
{{ value }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item.now="{ value, item }">
|
||||
<span class="font-weight-medium text-subtitle-2">
|
||||
<v-tooltip v-if="value > 0" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<span
|
||||
v-bind="props"
|
||||
:class="
|
||||
'untot' == 'уникальные'
|
||||
? getColorTooday1(value)
|
||||
: getColorTooday2(value)
|
||||
"
|
||||
class="cursor-help font-weight-medium text-subtitle-1"
|
||||
>
|
||||
{{ value }}
|
||||
</span>
|
||||
</template>
|
||||
<v-row no-gutters>
|
||||
<v-col>
|
||||
<v-row no-gutters v-for="n in item.now.unic" :key="n">
|
||||
<v-col>
|
||||
{{ n }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:item.period="{ value, item }">
|
||||
<span class="font-weight-medium text-subtitle-2">
|
||||
<v-tooltip v-if="value > 0" location="bottom">
|
||||
<template v-slot:activator="{ props }">
|
||||
<span
|
||||
v-bind="props"
|
||||
:class="
|
||||
'untot' == 'уникальные'
|
||||
? getColorPeriod1(value)
|
||||
: getColorPeriod2(value)
|
||||
"
|
||||
class="cursor-help font-weight-medium text-subtitle-1"
|
||||
>
|
||||
{{ value }}
|
||||
</span>
|
||||
</template>
|
||||
<v-row no-gutters>
|
||||
<v-col>
|
||||
<v-row no-gutters v-for="n in item.period.unic" :key="n">
|
||||
<v-col>
|
||||
{{ n }}
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
</v-data-table-virtual>
|
||||
</template>
|
||||
</pattern-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref, watch } from 'vue'
|
||||
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
|
||||
import TooltipText from '@/components/UI/tooltip-text.vue'
|
||||
import {splitname, formatDash} from '@/utils/universal_functions'
|
||||
import { ref, watch } from "vue";
|
||||
import PatternCard from "@/components/UI/aboutportal/pattern-card.vue";
|
||||
import TooltipText from "@/components/UI/tooltip-text.vue";
|
||||
import { splitname, formatDash } from "@/utils/universal_functions";
|
||||
|
||||
export default {
|
||||
components: { TooltipText, PatternCard },
|
||||
|
||||
components: { TooltipText, PatternCard },
|
||||
|
||||
props: {
|
||||
pages_count: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
|
||||
}
|
||||
props: {
|
||||
pages_count: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
|
||||
setup(props) {
|
||||
|
||||
const sortBy = ref([
|
||||
{
|
||||
"key": "now",
|
||||
"order": "desc"
|
||||
}
|
||||
])
|
||||
setup(props) {
|
||||
const sortBy = ref([
|
||||
{
|
||||
key: "now",
|
||||
order: "desc",
|
||||
},
|
||||
]);
|
||||
|
||||
const untot=ref('уникальные')
|
||||
let headers = ref([
|
||||
{ title: '', align: 'start', key: 'name' },
|
||||
{ title: 'сегодня', align: 'center', key: 'now',
|
||||
value: item => `${untot.value=='уникальные'?item.now.unic.size:item.now.total}`,
|
||||
},
|
||||
{ title: 'за период', align: 'center', key: 'period',
|
||||
value: item => `${untot.value=='уникальные'?item.period.unic.size:item.period.total}` },
|
||||
])
|
||||
const untot = ref("уникальные");
|
||||
let headers = ref([
|
||||
{ title: "", align: "start", key: "name" },
|
||||
{
|
||||
title: "сегодня",
|
||||
align: "center",
|
||||
key: "now",
|
||||
value: (item) =>
|
||||
`${
|
||||
untot.value == "уникальные" ? item.now.unic.size : item.now.total
|
||||
}`,
|
||||
},
|
||||
{
|
||||
title: "за период",
|
||||
align: "center",
|
||||
key: "period",
|
||||
value: (item) =>
|
||||
`${
|
||||
untot.value == "уникальные"
|
||||
? item.period.unic.size
|
||||
: item.period.total
|
||||
}`,
|
||||
},
|
||||
]);
|
||||
|
||||
const datas = ()=>{
|
||||
|
||||
let data = []
|
||||
props.pages_count.forEach((e) => {
|
||||
|
||||
let ind = data.findIndex(el=>el.name==e.pages)
|
||||
if(ind==-1){
|
||||
let ob = {name:e.pages, now:{unic:new Set(),total:0}, period:{unic:new Set(),total:0}}
|
||||
if (e.visitdate == formatDash(new Date())){
|
||||
ob.now.unic.add(splitname(e.user))
|
||||
ob.now.total = e.count
|
||||
|
||||
}
|
||||
ob.period.unic.add(splitname(e.user))
|
||||
ob.period.total = e.count
|
||||
data.push(ob)
|
||||
}
|
||||
else{
|
||||
if (e.visitdate == formatDash(new Date())){
|
||||
data[ind].now.unic.add(splitname(e.user))
|
||||
data[ind].now.total +=e.count
|
||||
}
|
||||
|
||||
data[ind].period.unic.add(splitname(e.user))
|
||||
data[ind].period.total +=e.count
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const modelrating = ref(false)
|
||||
|
||||
const getColorTooday1 = (pages) => {
|
||||
if (pages > 10) return 'text-green'
|
||||
else if (pages > 5) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const getColorPeriod1 = (pages) => {
|
||||
|
||||
if (pages > 30) return 'text-green'
|
||||
else if (pages > 15) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const getColorTooday2 = (pages) => {
|
||||
if (pages > 50) return 'text-green'
|
||||
else if (pages > 25) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const getColorPeriod2 = (pages) => {
|
||||
|
||||
if (pages > 100) return 'text-green'
|
||||
else if (pages > 50) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const getColorNow = (pages) => {
|
||||
if (pages > 10) return 'text-green'
|
||||
else if (pages > 5) return 'text-orange'
|
||||
else return 'text-red'
|
||||
}
|
||||
|
||||
const customSort= ()=> {
|
||||
let arr=tabledata.value
|
||||
|
||||
if (sortBy.value!==undefined && sortBy.value.length>0){
|
||||
let factor=sortBy.value[0].order=='desc'?[-1,1]:[1,-1]
|
||||
if (untot.value=='уникальные'){
|
||||
arr.sort((a,b)=>{
|
||||
|
||||
if (a[sortBy.value[0].key].unic.size>b[sortBy.value[0].key].unic.size) return factor[0]
|
||||
if (a[sortBy.value[0].key].unic.size<b[sortBy.value[0].key].unic.size) return factor[1]
|
||||
return 0 })
|
||||
}else{
|
||||
arr.sort((a,b)=>{
|
||||
|
||||
if (a[sortBy.value[0].key].total>b[sortBy.value[0].key].total) return factor[0]
|
||||
if (a[sortBy.value[0].key].total<b[sortBy.value[0].key].total) return factor[1]
|
||||
return 0 })
|
||||
const datas = () => {
|
||||
let data = [];
|
||||
props.pages_count.forEach((e) => {
|
||||
let ind = data.findIndex((el) => el.name == e.pages);
|
||||
if (ind == -1) {
|
||||
let ob = {
|
||||
name: e.pages,
|
||||
now: { unic: new Set(), total: 0 },
|
||||
period: { unic: new Set(), total: 0 },
|
||||
};
|
||||
if (e.visitdate == formatDash(new Date())) {
|
||||
ob.now.unic.add(splitname(e.user));
|
||||
ob.now.total = e.count;
|
||||
}
|
||||
ob.period.unic.add(splitname(e.user));
|
||||
ob.period.total = e.count;
|
||||
data.push(ob);
|
||||
} else {
|
||||
if (e.visitdate == formatDash(new Date())) {
|
||||
data[ind].now.unic.add(splitname(e.user));
|
||||
data[ind].now.total += e.count;
|
||||
}
|
||||
|
||||
data[ind].period.unic.add(splitname(e.user));
|
||||
data[ind].period.total += e.count;
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
const modelrating = ref(false);
|
||||
|
||||
const getColorTooday1 = (pages) => {
|
||||
if (pages > 10) return "text-green";
|
||||
else if (pages > 5) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const getColorPeriod1 = (pages) => {
|
||||
if (pages > 30) return "text-green";
|
||||
else if (pages > 15) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const getColorTooday2 = (pages) => {
|
||||
if (pages > 50) return "text-green";
|
||||
else if (pages > 25) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const getColorPeriod2 = (pages) => {
|
||||
if (pages > 100) return "text-green";
|
||||
else if (pages > 50) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const getColorNow = (pages) => {
|
||||
if (pages > 10) return "text-green";
|
||||
else if (pages > 5) return "text-orange";
|
||||
else return "text-red";
|
||||
};
|
||||
|
||||
const customSort = () => {
|
||||
let arr = tabledata.value;
|
||||
|
||||
if (sortBy.value !== undefined && sortBy.value.length > 0) {
|
||||
let factor = sortBy.value[0].order == "desc" ? [-1, 1] : [1, -1];
|
||||
if (untot.value == "уникальные") {
|
||||
arr.sort((a, b) => {
|
||||
if (
|
||||
a[sortBy.value[0].key].unic.size >
|
||||
b[sortBy.value[0].key].unic.size
|
||||
)
|
||||
return factor[0];
|
||||
if (
|
||||
a[sortBy.value[0].key].unic.size <
|
||||
b[sortBy.value[0].key].unic.size
|
||||
)
|
||||
return factor[1];
|
||||
return 0;
|
||||
});
|
||||
} else {
|
||||
arr.sort((a, b) => {
|
||||
if (a[sortBy.value[0].key].total > b[sortBy.value[0].key].total)
|
||||
return factor[0];
|
||||
if (a[sortBy.value[0].key].total < b[sortBy.value[0].key].total)
|
||||
return factor[1];
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
tabledata.value=arr
|
||||
|
||||
|
||||
}
|
||||
const tabledata = ref(datas())
|
||||
watch(()=>props.pages_count,(newValue)=>{
|
||||
if (newValue!==[]){
|
||||
tabledata.value=datas()
|
||||
customSort()
|
||||
}
|
||||
tabledata.value = arr;
|
||||
};
|
||||
const tabledata = ref(datas());
|
||||
watch(
|
||||
() => props.pages_count,
|
||||
(newValue) => {
|
||||
if (newValue !== []) {
|
||||
tabledata.value = datas();
|
||||
customSort();
|
||||
}
|
||||
})
|
||||
// tabledata.value=datas.value
|
||||
return {
|
||||
tabledata,
|
||||
sortBy,
|
||||
customSort,
|
||||
untot,
|
||||
modelrating,
|
||||
getColorTooday1,
|
||||
getColorPeriod1,
|
||||
getColorTooday2,
|
||||
getColorPeriod2,
|
||||
getColorNow,
|
||||
headers,
|
||||
datas
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
// tabledata.value=datas.value
|
||||
return {
|
||||
tabledata,
|
||||
sortBy,
|
||||
customSort,
|
||||
untot,
|
||||
modelrating,
|
||||
getColorTooday1,
|
||||
getColorPeriod1,
|
||||
getColorTooday2,
|
||||
getColorPeriod2,
|
||||
getColorNow,
|
||||
headers,
|
||||
datas,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.v-table {
|
||||
flex: 1!important;
|
||||
|
||||
.v-table {
|
||||
flex: 1 !important;
|
||||
}
|
||||
|
||||
.mytable tr {
|
||||
font-size: 13px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.mytable i{
|
||||
font-size: 10px;
|
||||
.mytable i {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
|
||||
.myleft {
|
||||
float: left;
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -1,10 +1,33 @@
|
||||
<template>
|
||||
<div>
|
||||
<pre>
|
||||
{{events}}
|
||||
</pre>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
import {useICalReader} from '@/utils/universal_functions'
|
||||
import { baseURL, axiosApiInstance } from '@/utils/axios-api'
|
||||
import { ref } from 'vue';
|
||||
|
||||
const burl = baseURL.slice(0,-1)
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const { events } = useICalReader(`${burl}/media/ical/calendar.ics`)
|
||||
|
||||
return {
|
||||
events
|
||||
}
|
||||
// const { icsContent, fetchICalFile } = useICalReader(`${burl}/media/ical/calendar.ics`)
|
||||
|
||||
// return {
|
||||
// icsContent, fetchICalFile
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -214,7 +214,8 @@
|
||||
|
||||
<v-row class="flex-grow-0" v-if="accountStore.user.is_staff">
|
||||
<v-col>
|
||||
<v-list nav density active-class="noneoutline">
|
||||
<default-portal-menu-list :rail=rail />
|
||||
<!-- <v-list nav density="compact" active-class="noneoutline">
|
||||
<default-portal-menu-list :aMenuItem="supperuser"/>
|
||||
<div v-if="getDevelopment()">
|
||||
|
||||
@@ -223,7 +224,7 @@
|
||||
|
||||
|
||||
|
||||
</v-list>
|
||||
</v-list> -->
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="flex-grow-0">
|
||||
@@ -299,6 +300,7 @@ import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
|
||||
import PageCounter from '@/components/UI/defaultportal/page-counter.vue'
|
||||
import DefaultPortalMenuList from '@/layouts/default/DefaultPortalMenuList.vue'
|
||||
import {getDevelopment} from '@/utils/universal_functions'
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
@@ -357,15 +359,6 @@ export default {
|
||||
|
||||
// 'https://materialdesignicons.com/cdn/1.6.50-dev/'
|
||||
|
||||
const supperuser = [
|
||||
|
||||
{
|
||||
name: 'Панель администратора',
|
||||
ico: 'mdi-wrench',
|
||||
link: baseURL+'admin'
|
||||
|
||||
},
|
||||
]
|
||||
|
||||
const oRasrab = [
|
||||
{
|
||||
@@ -447,7 +440,11 @@ export default {
|
||||
ico: 'mdi-city',
|
||||
path: "/inspection"
|
||||
},
|
||||
|
||||
{
|
||||
name: 'ical',
|
||||
ico: 'mdi-calendar',
|
||||
path: "/ical"
|
||||
},
|
||||
|
||||
// {
|
||||
// name: 'К празднику',
|
||||
@@ -485,7 +482,7 @@ export default {
|
||||
// feedalert,
|
||||
alert,
|
||||
burl,
|
||||
supperuser,
|
||||
|
||||
closeinfo,
|
||||
baseURL,
|
||||
getDevelopment
|
||||
|
||||
@@ -1,40 +1,88 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-list-item
|
||||
v-for="(x, key) in aMenuItem"
|
||||
:key="key"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
:href="x.link"
|
||||
:target="x.link?'_blank':''"
|
||||
slim
|
||||
class="text-blue-grey-lighten-1"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" size="x_small"/>
|
||||
<v-tooltip
|
||||
v-if="rail"
|
||||
activator="parent"
|
||||
location="top"
|
||||
>
|
||||
{{ x.name }}
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</div>
|
||||
<div>
|
||||
<v-list nav density="compact" class="text-blue-grey-lighten-1">
|
||||
<div v-for="(list, key) in aMenuItem" :key="key">
|
||||
<div v-if="showProm(key)">
|
||||
<v-list-item
|
||||
v-for="x in list"
|
||||
:key="x"
|
||||
:title="x.name"
|
||||
:value="x.name"
|
||||
:href="x.link"
|
||||
:target="x.link ? '_blank' : ''"
|
||||
slim
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<v-icon :icon="x.ico" size="x_small" />
|
||||
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||
</v-tooltip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</div>
|
||||
</div>
|
||||
</v-list>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { baseURL } from "@/utils/axios-api";
|
||||
import { getDevelopment } from "@/utils/universal_functions";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
aMenuItem: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
props: {
|
||||
rail: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
|
||||
setup() {
|
||||
const gittlink = () => {
|
||||
const link =
|
||||
baseURL == "http://127.0.0.1:8000/"
|
||||
? "http://sulaco.nodered.ru:5223/COD2/PORTAL_COD2/projects"
|
||||
: "http://maestro.cod2.regions.tax.nalog.ru:3333/COD2/PORTAL_COD2/projects/22";
|
||||
return link;
|
||||
};
|
||||
const aMenuItem = {
|
||||
prom: [
|
||||
{
|
||||
name: "Панель администратора",
|
||||
ico: "mdi-wrench",
|
||||
link: baseURL + "admin",
|
||||
},
|
||||
}
|
||||
}
|
||||
],
|
||||
my: [
|
||||
{
|
||||
name: "Gitt",
|
||||
ico: "mdi-github",
|
||||
link: gittlink(),
|
||||
},
|
||||
{
|
||||
name: "Swagger",
|
||||
ico: "mdi-puzzle",
|
||||
link: "http://127.0.0.1:8000/swagger/",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const showProm = (data) => {
|
||||
let show = true;
|
||||
|
||||
if (data == "my" && getDevelopment() == false) {
|
||||
show = false;
|
||||
}
|
||||
|
||||
return show;
|
||||
};
|
||||
|
||||
return {
|
||||
aMenuItem,
|
||||
getDevelopment,
|
||||
showProm,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<style></style>
|
||||
@@ -136,6 +136,15 @@ const routes = [
|
||||
ico: "mdi-city"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/ical',
|
||||
name: 'UsersInfoPage',
|
||||
component: () => import('@/components/calendar_of_events/load-ical.vue'),
|
||||
meta:{
|
||||
title:"Для работы над календарем",
|
||||
ico: "mdi-account"
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -5,7 +5,9 @@ import { baseURL } from '@/utils/axios-api'
|
||||
import { axiosApiInstance, clearAxios } from '@/utils/axios-api'
|
||||
import { useRouter } from 'vue-router'
|
||||
import moment from 'moment'
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
import ical from 'ical.js'
|
||||
|
||||
|
||||
export function formatComa(date) {
|
||||
@@ -92,3 +94,54 @@ export function pagecounter(){
|
||||
return process.env.NODE_ENV == 'development'?true:false
|
||||
}
|
||||
|
||||
export function useICalReader(url) {
|
||||
///
|
||||
const events = ref([])
|
||||
|
||||
const loadICalFile = async () => {
|
||||
try {
|
||||
const response = await fetch(url)
|
||||
const data = await response.text()
|
||||
const jcalData = ical.parse(data)
|
||||
const comp = new ical.Component(jcalData)
|
||||
const vevents = comp.getAllSubcomponents('vevent')
|
||||
const eventsData = vevents.map(vevent => ({
|
||||
vevent: vevent
|
||||
// summary: vevent.getFirstPropertyValue('summary'),
|
||||
// start: vevent.getFirstPropertyValue('dtstart'),
|
||||
// end: vevent.getFirstPropertyValue('dtend')
|
||||
}))
|
||||
events.value = eventsData
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadICalFile()
|
||||
})
|
||||
|
||||
return {
|
||||
events
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// export function useICalReader(filePath) {
|
||||
// const icsContent = ref('')
|
||||
|
||||
// const fetchICalFile = async () => {
|
||||
// try {
|
||||
// const response = await fetch(filePath)
|
||||
// if (!response.ok) {
|
||||
// throw new Error('Ошибка при загрузке файла')
|
||||
// }
|
||||
// const data = await response.text()
|
||||
// icsContent.value = data
|
||||
// } catch (error) {
|
||||
// console.error('Ошибка при чтении файла:', error)
|
||||
// }
|
||||
// }
|
||||
|
||||
// return { icsContent, fetchICalFile }
|
||||
// }
|
||||
@@ -172,7 +172,6 @@ export default {
|
||||
const getInspectionDirections = () => {
|
||||
axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => {
|
||||
directionworks.value = res.data
|
||||
console.log(directionworks.value)
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -170,7 +170,6 @@ setup(){
|
||||
|
||||
let periodusers = new Set([])
|
||||
let brdata = {}
|
||||
console.log(alldata.value.staff, 'alldata.value.periodalldata.value.periodalldata.value.periodalldata.value.period')
|
||||
let filtr = alldata.value.period
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user