Модели плюс 38_доделка
This commit is contained in:
1 parent
1a4dfda02e
commit
0231d2970d
11 files changed
+477
-306
No files matched your search
@@ -1,3 +1,47 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from accounts.models import *
|
||||||
# Create your models here.
|
# 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/feedback/', include('feedback.urls')),
|
||||||
path('api/general_vacation/', include('general_vacation.urls')),
|
path('api/general_vacation/', include('general_vacation.urls')),
|
||||||
path('api/about_inspection/', include('about_inspection.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)
|
] + 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 max-width='400' density="compact" class="bg-transparent">
|
||||||
<v-card-text class="pb-0">Оставлено комментариев</v-card-text>
|
<v-card-text class="pb-0">Оставлено комментариев</v-card-text>
|
||||||
<v-card-subtitle>Последний комментарий оставлен {{formaComaTime(comment.time_create)}}</v-card-subtitle>
|
<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>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,287 +1,281 @@
|
|||||||
<template>
|
<template>
|
||||||
<pattern-card
|
<pattern-card
|
||||||
:title="'Рейтинг посещаемости страниц портала'"
|
:title="'Рейтинг посещаемости страниц портала'"
|
||||||
:ico="'mdi-chart-bar'"
|
: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"
|
|
||||||
>
|
>
|
||||||
<template v-slot:header.name>
|
<template v-slot:filling>
|
||||||
<!-- v-model:sort-by="sortBy" -->
|
<v-data-table-virtual
|
||||||
<v-switch
|
:headers="headers"
|
||||||
:label="untot"
|
:items="tabledata"
|
||||||
false-value='уникальные'
|
height="400"
|
||||||
true-value='всего'
|
class="mytable"
|
||||||
hide-details
|
item-value="name"
|
||||||
v-model="untot"
|
@update:sortBy="customSort"
|
||||||
class="myleft ml-n4"
|
v-model:sort-by="sortBy"
|
||||||
|
density="compact"
|
||||||
/>
|
>
|
||||||
|
<template v-slot:header.name>
|
||||||
</template>
|
<v-switch
|
||||||
<template v-slot:item.name="{ value }">
|
:label="untot"
|
||||||
<span class="font-weight-medium text-grey-darken-3 myleft text-subtitle-2">
|
false-value="уникальные"
|
||||||
{{ value }}
|
true-value="всего"
|
||||||
</span>
|
hide-details
|
||||||
</template>
|
v-model="untot"
|
||||||
<template v-slot:item.now="{ value, item }">
|
class="myleft ml-n4"
|
||||||
<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>
|
</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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from "vue";
|
||||||
import PatternCard from '@/components/UI/aboutportal/pattern-card.vue'
|
import PatternCard from "@/components/UI/aboutportal/pattern-card.vue";
|
||||||
import TooltipText from '@/components/UI/tooltip-text.vue'
|
import TooltipText from "@/components/UI/tooltip-text.vue";
|
||||||
import {splitname, formatDash} from '@/utils/universal_functions'
|
import { splitname, formatDash } from "@/utils/universal_functions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
components: { TooltipText, PatternCard },
|
||||||
|
|
||||||
components: { TooltipText, PatternCard },
|
props: {
|
||||||
|
pages_count: {
|
||||||
props: {
|
type: Array,
|
||||||
pages_count: {
|
default: () => [],
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
setup(props) {
|
setup(props) {
|
||||||
|
const sortBy = ref([
|
||||||
|
{
|
||||||
|
key: "now",
|
||||||
|
order: "desc",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
const sortBy = ref([
|
const untot = ref("уникальные");
|
||||||
{
|
let headers = ref([
|
||||||
"key": "now",
|
{ title: "", align: "start", key: "name" },
|
||||||
"order": "desc"
|
{
|
||||||
}
|
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('уникальные')
|
const datas = () => {
|
||||||
let headers = ref([
|
let data = [];
|
||||||
{ title: '', align: 'start', key: 'name' },
|
props.pages_count.forEach((e) => {
|
||||||
{ title: 'сегодня', align: 'center', key: 'now',
|
let ind = data.findIndex((el) => el.name == e.pages);
|
||||||
value: item => `${untot.value=='уникальные'?item.now.unic.size:item.now.total}`,
|
if (ind == -1) {
|
||||||
},
|
let ob = {
|
||||||
{ title: 'за период', align: 'center', key: 'period',
|
name: e.pages,
|
||||||
value: item => `${untot.value=='уникальные'?item.period.unic.size:item.period.total}` },
|
now: { unic: new Set(), total: 0 },
|
||||||
])
|
period: { unic: new Set(), total: 0 },
|
||||||
|
};
|
||||||
const datas = ()=>{
|
if (e.visitdate == formatDash(new Date())) {
|
||||||
|
ob.now.unic.add(splitname(e.user));
|
||||||
let data = []
|
ob.now.total = e.count;
|
||||||
props.pages_count.forEach((e) => {
|
}
|
||||||
|
ob.period.unic.add(splitname(e.user));
|
||||||
let ind = data.findIndex(el=>el.name==e.pages)
|
ob.period.total = e.count;
|
||||||
if(ind==-1){
|
data.push(ob);
|
||||||
let ob = {name:e.pages, now:{unic:new Set(),total:0}, period:{unic:new Set(),total:0}}
|
} else {
|
||||||
if (e.visitdate == formatDash(new Date())){
|
if (e.visitdate == formatDash(new Date())) {
|
||||||
ob.now.unic.add(splitname(e.user))
|
data[ind].now.unic.add(splitname(e.user));
|
||||||
ob.now.total = e.count
|
data[ind].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 })
|
|
||||||
|
|
||||||
|
data[ind].period.unic.add(splitname(e.user));
|
||||||
|
data[ind].period.total += e.count;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
tabledata.value=arr
|
|
||||||
|
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
const modelrating = ref(false);
|
||||||
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
|
|
||||||
|
|
||||||
|
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=datas.value
|
||||||
|
return {
|
||||||
|
tabledata,
|
||||||
|
sortBy,
|
||||||
|
customSort,
|
||||||
|
untot,
|
||||||
|
modelrating,
|
||||||
|
getColorTooday1,
|
||||||
|
getColorPeriod1,
|
||||||
|
getColorTooday2,
|
||||||
|
getColorPeriod2,
|
||||||
|
getColorNow,
|
||||||
|
headers,
|
||||||
|
datas,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.v-table {
|
.v-table {
|
||||||
flex: 1!important;
|
flex: 1 !important;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mytable tr {
|
.mytable tr {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
.mytable i{
|
.mytable i {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.myleft {
|
.myleft {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,10 +1,33 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
|
<pre>
|
||||||
|
{{events}}
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -214,7 +214,8 @@
|
|||||||
|
|
||||||
<v-row class="flex-grow-0" v-if="accountStore.user.is_staff">
|
<v-row class="flex-grow-0" v-if="accountStore.user.is_staff">
|
||||||
<v-col>
|
<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"/>
|
<default-portal-menu-list :aMenuItem="supperuser"/>
|
||||||
<div v-if="getDevelopment()">
|
<div v-if="getDevelopment()">
|
||||||
|
|
||||||
@@ -223,7 +224,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
</v-list>
|
</v-list> -->
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row no-gutters class="flex-grow-0">
|
<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 PageCounter from '@/components/UI/defaultportal/page-counter.vue'
|
||||||
import DefaultPortalMenuList from '@/layouts/default/DefaultPortalMenuList.vue'
|
import DefaultPortalMenuList from '@/layouts/default/DefaultPortalMenuList.vue'
|
||||||
import {getDevelopment} from '@/utils/universal_functions'
|
import {getDevelopment} from '@/utils/universal_functions'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
@@ -357,15 +359,6 @@ export default {
|
|||||||
|
|
||||||
// 'https://materialdesignicons.com/cdn/1.6.50-dev/'
|
// 'https://materialdesignicons.com/cdn/1.6.50-dev/'
|
||||||
|
|
||||||
const supperuser = [
|
|
||||||
|
|
||||||
{
|
|
||||||
name: 'Панель администратора',
|
|
||||||
ico: 'mdi-wrench',
|
|
||||||
link: baseURL+'admin'
|
|
||||||
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const oRasrab = [
|
const oRasrab = [
|
||||||
{
|
{
|
||||||
@@ -447,7 +440,11 @@ export default {
|
|||||||
ico: 'mdi-city',
|
ico: 'mdi-city',
|
||||||
path: "/inspection"
|
path: "/inspection"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'ical',
|
||||||
|
ico: 'mdi-calendar',
|
||||||
|
path: "/ical"
|
||||||
|
},
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// name: 'К празднику',
|
// name: 'К празднику',
|
||||||
@@ -485,7 +482,7 @@ export default {
|
|||||||
// feedalert,
|
// feedalert,
|
||||||
alert,
|
alert,
|
||||||
burl,
|
burl,
|
||||||
supperuser,
|
|
||||||
closeinfo,
|
closeinfo,
|
||||||
baseURL,
|
baseURL,
|
||||||
getDevelopment
|
getDevelopment
|
||||||
|
|||||||
@@ -1,40 +1,88 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<v-list-item
|
<v-list nav density="compact" class="text-blue-grey-lighten-1">
|
||||||
v-for="(x, key) in aMenuItem"
|
<div v-for="(list, key) in aMenuItem" :key="key">
|
||||||
:key="key"
|
<div v-if="showProm(key)">
|
||||||
:title="x.name"
|
<v-list-item
|
||||||
:value="x.name"
|
v-for="x in list"
|
||||||
:href="x.link"
|
:key="x"
|
||||||
:target="x.link?'_blank':''"
|
:title="x.name"
|
||||||
slim
|
:value="x.name"
|
||||||
class="text-blue-grey-lighten-1"
|
:href="x.link"
|
||||||
>
|
:target="x.link ? '_blank' : ''"
|
||||||
<template v-slot:prepend>
|
slim
|
||||||
<v-icon :icon="x.ico" size="x_small"/>
|
>
|
||||||
<v-tooltip
|
<template v-slot:prepend>
|
||||||
v-if="rail"
|
<v-icon :icon="x.ico" size="x_small" />
|
||||||
activator="parent"
|
<v-tooltip v-if="rail" activator="parent" location="top">
|
||||||
location="top"
|
</v-tooltip>
|
||||||
>
|
</template>
|
||||||
{{ x.name }}
|
</v-list-item>
|
||||||
</v-tooltip>
|
</div>
|
||||||
</template>
|
</div>
|
||||||
</v-list-item>
|
</v-list>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { baseURL } from "@/utils/axios-api";
|
||||||
|
import { getDevelopment } from "@/utils/universal_functions";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
aMenuItem: {
|
rail: {
|
||||||
type: Array,
|
type: Boolean,
|
||||||
default: () => []
|
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>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -136,6 +136,15 @@ const routes = [
|
|||||||
ico: "mdi-city"
|
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 { axiosApiInstance, clearAxios } from '@/utils/axios-api'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
|
import { ref, onMounted } from 'vue'
|
||||||
|
|
||||||
|
import ical from 'ical.js'
|
||||||
|
|
||||||
|
|
||||||
export function formatComa(date) {
|
export function formatComa(date) {
|
||||||
@@ -92,3 +94,54 @@ export function pagecounter(){
|
|||||||
return process.env.NODE_ENV == 'development'?true:false
|
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 = () => {
|
const getInspectionDirections = () => {
|
||||||
axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => {
|
axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => {
|
||||||
directionworks.value = res.data
|
directionworks.value = res.data
|
||||||
console.log(directionworks.value)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ setup(){
|
|||||||
|
|
||||||
let periodusers = new Set([])
|
let periodusers = new Set([])
|
||||||
let brdata = {}
|
let brdata = {}
|
||||||
console.log(alldata.value.staff, 'alldata.value.periodalldata.value.periodalldata.value.periodalldata.value.period')
|
|
||||||
let filtr = alldata.value.period
|
let filtr = alldata.value.period
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user