ветка

This commit is contained in:
iriska-gri committed 2023-11-02 12:14:25 +03:00
1 parent 2df9a3e6e6
commit bca102a060
8 files changed
+299 -303

No files matched your search

BIN
View File
Binary file not shown.
+274 -3
View File
@@ -1,12 +1,283 @@
<template>
<div>
hello
</div>
<div class="d-flex h-100">
<v-card
v-if="t_daily.length > 0"
class="h-100 w-100 d-flex flex-column"
>
<v-row
v-for="x in t_daily"
:key="x"
v-show="x.position!=6"
>
<v-divider/>
<v-col>
<v-card
class="ma-2 d-flex flex-column"
height="100"
elevation="0"
>
<v-card class="h-100 text-center text-black_grey bg-black_and_white">
<v-card-title class="statstyle py-0 text-overline font-weight-bold bg-black_and_white">
{{x.position__name}}
</v-card-title>
<v-card-text
@click="detailRound(x.position)"
class="numstyle mt-2 py-0 font-weight-bold pointer bg-black_and_white"
>
<vue3-autocounter
ref='counter'
:startAmount='0'
:endAmount='Number(x.user__count)'
:duration='2'
/>
</v-card-text>
</v-card>
</v-card>
</v-col>
</v-row>
</v-card>
<v-card
v-else class="h-100 w-100 d-flex justify-center "
>
<v-card-text class="align-self-center flex-column mt-8">
<v-row>
<v-col>
<v-file-input
v-bind="props"
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
density="compact"
label="Выберите файл"
hide-details
/>
</v-col>
</v-row>
<v-row>
<v-col class="text-center">
<v-btn
icon="mdi-google-play"
size="x-large"
variant="text"
color="teal-darken-4"
:disabled="dailyfiles==0?true:false"
@click="onPickFile"
/>
</v-col>
</v-row>
</v-card-text>
</v-card>
<div class="text-center">
<v-dialog
v-model="dialogDetailRound"
width="500"
>
<v-card class="bg-white pa-3 px-0" width="550"
height="600">
<v-card
class="mx-auto overflow-auto mx-0 px-3"
width="550"
height="600"
flat
>
<v-card-title class="fixed-bar bg-white">
<v-row class="bggrad">
<v-col class="text-center text-black_and_white">
{{t_dailyRound.position}}
</v-col>
</v-row>
<v-row>
<v-col class="pa-0 mb-3">
<!-- <my-helper :pretext="t_dailyRound"/> -->
<v-textarea
v-model="searchname"
clearable
prepend-inner-icon="mdi-magnify"
hide-details
class="mx-0"
label="Поиск"
rows="1"
no-resize
/>
</v-col>
</v-row>
</v-card-title>
<div
v-for="(x, key) in t_dailyRound.daily"
:key="key"
class="px-3" >
<v-list class="py-0">
<v-list-subheader>{{key}} </v-list-subheader>
</v-list>
<v-card
v-for="item in x"
:key="item"
class="bg-transparent"
density="compact"
:prepend-avatar="checkremote(`${spravURL}${item.login}.jpg`)"
:title="item.fio"
:subtitle="item.post"
variant="text"
@click="getcard(item.login)"
>
</v-card>
</div>
</v-card>
<v-divider/>
<v-card-actions class="align-self-end pb-0">
<v-btn
color="more_details_btn"
variant="text"
@click="dialogDetailRound=!dialogDetailRound"
>
Закрыть
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog
v-model="menuGetUserDialog"
persistent width="800">
<Card-users
:menuGetUserDialog="menuGetUserDialog"
:loging="iduser"
@menusClose="menuGetUserDialog = false" />
</v-dialog>
</div>
</div>
</template>
<script>
import { ref, onMounted,watch } from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
import CardUsers from '@/components/cardUsers.vue'
export default {
components: {
CardUsers
},
setup(){
const t_daily = ref('')
const idpos = ref('')
const dialogDetailRound = ref(false)
const t_dailyRound = ref('')
const dailyfiles = ref('')
const info = ref({})
const searchname = ref('')
const menuGetUserDialog = ref(false)
const iduser = ref('')
const getcard = async (idus) => {
menuGetUserDialog.value = true
iduser.value = idus
}
const detailRound = (pos) => {
idpos.value=pos
dialogDetailRound.value=!dialogDetailRound.value
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`).then(data => {
t_dailyRound.value = data.data
})
}
function proba(){
axiosApiInstance.get('api/feedback/feedbackdata/')
.then(data => {
t_baseCriteria.value = data.data.results
})
}
const onPickFile = () => {
const sdata = new FormData()
sdata.append('dailyfiles', dailyfiles.value[0])
axiosApiInstance.post(`api/general_vacation/dailyroundup/`, sdata).then(result => {
info.value = result.data
dailyfun()
})
dailyfiles.value = ''
}
function dailyfun(){
axiosApiInstance.get('api/general_vacation/dailyload/')
.then(data => {
t_daily.value = data.data.daily
})
}
watch(()=> searchname.value,(newValue,oldValue)=>{
console.log(newValue,'newValue', oldValue,'oldValue');
if(newValue){
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}&searchname=${newValue}`)
.then(data => {
console.log(data.data);
t_dailyRound.value = data.data
})
}
else {
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}`)
.then(data => {
console.log(data.data, '-----------------');
t_dailyRound.value = data.data
})
}
}, {deep:true})
onMounted(() => {
dailyfun(),
proba()
})
return {t_daily,
detailRound,
dialogDetailRound,
t_dailyRound,
dailyfiles,
onPickFile,
info,
checkremote,
searchname,
spravURL,
menuGetUserDialog,
iduser,
getcard
}
}
}
</script>
+6 -1
View File
@@ -63,7 +63,12 @@ export function pagecounter(){
const router = useRouter()
const accountStore = useAccountStore()
const appStore = useAppStore()
let postdata = {user__id: "user" in accountStore && "id" in accountStore.user? accountStore.user.id: null, page: router.currentRoute.value.meta.title}
console.log(router.currentRoute.value.fullPath, '-------------ttt------------------');
let postdata = {user__id: "user" in accountStore &&"id" in accountStore.user? accountStore.user.id: null,
page: router.currentRoute.value.meta.title,
fullPath: router.currentRoute.value.fullPath
}
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata)
.then(result => {
+8 -294
View File
@@ -27,69 +27,8 @@
</v-col>
<v-col class="flex-column d-flex flex-grow-0 px-0" lg="2">
<v-row class="flex-grow-1 ma-0 mx-1">
<v-col class="pt-0">
<!-- <digital-letna/> -->
<v-card v-if="t_daily.length > 0" class="h-100 flex-column" >
<v-row v-for="x in t_daily" :key="x" v-show="x.position!=6">
<v-col>
<v-card
class="ma-2 d-flex flex-column"
height="100"
elevation="0"
>
<v-card class="h-100 text-center text-black_grey bg-black_and_white">
<v-card-title class="statstyle py-0 text-overline font-weight-bold bg-black_and_white">
{{x.position__name}}
</v-card-title>
<v-card-text
@click="detailRound(x.position)"
class="numstyle mt-2 py-0 font-weight-bold pointer bg-black_and_white"
>
<vue3-autocounter
ref='counter'
:startAmount='0'
:endAmount='Number(x.user__count)'
:duration='2'
/>
</v-card-text>
</v-card>
</v-card>
</v-col>
<v-divider/>
</v-row>
</v-card>
<v-card
v-else class="h-100 d-flex justify-center "
>
<v-card-text class="align-self-center flex-column mt-8">
<v-row>
<v-col>
<v-file-input
v-bind="props"
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
density="compact"
label="Выберите файл"
hide-details
/>
</v-col>
</v-row>
<v-row>
<v-col class="text-center">
<v-btn
icon="mdi-google-play"
size="x-large"
variant="text"
color="teal-darken-4"
:disabled="dailyfiles==0?true:false"
@click="onPickFile"
/>
</v-col>
</v-row>
</v-card-text>
</v-card>
<v-col class="pt-0 flex-column ">
<digital-letna/>
</v-col>
</v-row>
<v-row class="flex-grow-0 ma-0 mx-1">
@@ -108,6 +47,7 @@
block
variant="outlined"
class="ma-1"
to="/news"
>
Wiki
</v-btn>
@@ -132,12 +72,6 @@
</v-card>
</v-col>
</v-row>
<!-- <div class="flex-grow-1 flex-column bg-red overflow-auto"> -->
<!-- <News-list-home/> -->
<!-- </div> -->
<!-- <News-list v-if="accountStore.cod2user"/> -->
</v-card>
@@ -149,120 +83,20 @@
</v-col>
</v-row>
<div class="text-center">
<v-dialog
v-model="dialogDetailRound"
width="500"
>
<v-card class="bg-white pa-3 px-0" width="550"
height="600">
<v-card
class="mx-auto overflow-auto mx-0 px-3"
width="550"
height="600"
flat
>
<v-card-title class="fixed-bar bg-white">
<!-- <v-toolbar class="bg-teal-lighten-2 flex-column d-flex"> -->
<v-row class="bggrad">
<v-col class="text-center text-black_and_white">
{{t_dailyRound.position}}
</v-col>
</v-row>
<v-row >
<v-col class="pa-0 mb-3">
<v-textarea
v-model="searchname"
clearable
prepend-inner-icon="mdi-magnify"
hide-details
class="mx-0"
label="Поиск"
rows="1"
no-resize
/>
</v-col>
</v-row>
<!-- <v-divider class="mt-4"/> -->
</v-card-title>
<div
v-for="(x, key) in t_dailyRound.daily"
:key="key"
class="px-3" >
<v-list class="py-0">
<v-list-subheader>{{key}} </v-list-subheader>
</v-list>
<v-card
v-for="item in x"
:key="item"
class="bg-transparent"
density="compact"
:prepend-avatar="checkremote(`${spravURL}${item.login}.jpg`)"
:title="item.fio"
:subtitle="item.post"
variant="text"
@click="getcard(item.login)"
>
</v-card>
<!-- @click="getcard" -->
</div>
</v-card>
<v-divider/>
<v-card-actions class="align-self-end pb-0">
<v-btn
color="more_details_btn"
variant="text"
@click="dialogDetailRound=!dialogDetailRound"
>
Закрыть
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog
v-model="menuGetUserDialog"
persistent width="800">
<Card-users
:menuGetUserDialog="menuGetUserDialog"
:loging="iduser"
@menusClose="menuGetUserDialog = false" />
</v-dialog>
</div>
</v-container>
</template>
<script>
import { ref, onMounted,watch, computed } from 'vue'
import {useAppStore} from '@/store/app'
import {useAccountStore} from '@/store/AccountStore'
import {pagecounter} from '@/utils/universal_functions'
import NewsList from '@/components/news-list.vue'
import CarouselList from '@/components/carousel-list.vue'
import CarouselNumbers from '@/components/carousel-numbers.vue'
import { axiosApiInstance } from '@/utils/axios-api'
import CalendarFull from '@/components/UI/Calendar-full.vue'
import NewsListHome from '@/components/news-list-home.vue'
import { spravURL } from '@/utils/axios-api'
import {checkremote, bgimage} from '@/utils/universal_functions'
import CardUsers from '@/components/cardUsers.vue'
import LoadRound from '@/components/load-round.vue'
import DigitalLetna from '@/components/digital-letna.vue'
@@ -274,144 +108,24 @@
CarouselNumbers,
CalendarFull,
NewsListHome,
CardUsers,
LoadRound,
DigitalLetna
},
setup(){
const t_baseCriteria = ref([])
const t_daily = ref('')
const t_dailyRound = ref('')
const dialogDetailRound = ref(false)
const searchname = ref('')
const idpos = ref('')
const menuGetUserDialog = ref(false)
const iduser = ref('')
const dialoground = ref(false)
const dailyfiles = ref('')
const info = ref({})
onMounted(() => {
proba(),
dailyfun()
})
const appStore = useAppStore()
pagecounter()
const model= null
const accountStore = useAccountStore()
watch(()=> searchname.value,(newValue,oldValue)=>{
console.log(newValue,'newValue', oldValue,'oldValue');
if(newValue){
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}&searchname=${newValue}`)
.then(data => {
console.log(data.data);
t_dailyRound.value = data.data
})
}
else {
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}`)
.then(data => {
console.log(data.data, '-----------------');
t_dailyRound.value = data.data
})
}
}, {deep:true})
function proba(){
axiosApiInstance.get('api/feedback/feedbackdata/')
.then(data => {
t_baseCriteria.value = data.data.results
})
}
function dailyfun(){
axiosApiInstance.get('api/general_vacation/dailyload/')
.then(data => {
t_daily.value = data.data.daily
})
}
const detailRound = (pos) => {
idpos.value=pos
dialogDetailRound.value=!dialogDetailRound.value
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`)
.then(data => {
t_dailyRound.value = data.data
})
}
const getcard = async (idus) => {
menuGetUserDialog.value = true
iduser.value = idus
}
const imageLenta=computed(()=> {
return new URL(`/src/assets/bg-for-number-carousel.png`, import.meta.url).href;
})
const onPickFile = () => {
const sdata = new FormData()
sdata.append('dailyfiles', dailyfiles.value[0])
axiosApiInstance.post(`api/general_vacation/dailyroundup/`, sdata).then(result => {
info.value = result.data
dailyfun()
})
dailyfiles.value = ''
}
return {
accountStore,
model,
appStore,
proba,
t_daily,
t_dailyRound,
detailRound,
dialogDetailRound,
checkremote,
bgimage,
spravURL,
searchname,
menuGetUserDialog,
getcard,
iduser,
imageLenta,
dialoground,
dailyfiles,
onPickFile
appStore
}
}
}
}
</script>
<style lang="scss">
.v-picker-title, .v-picker__header, .v-picker__actions {
+4 -1
View File
@@ -5,13 +5,16 @@
<script>
import LoadRound from '@/components/load-round.vue'
import {pagecounter} from '@/utils/universal_functions'
export default {
components: {
LoadRound
},
setup(){
pagecounter()
}
}
</script>
+2 -1
View File
@@ -293,6 +293,7 @@ class DailyloadAPIView(APIView):
df = pd.merge(df_user, df_daily, left_on= 'login', right_on="login")
result={}
print(dailyr, '33333333333333333333333333333333333333333333333')
pos=dailyr[0][1]
if request.GET.__contains__('id'):
@@ -308,7 +309,7 @@ class DailyloadAPIView(APIView):
result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post']})
else:
result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post']}]
print(result, '111111111111111111111')
daily = result
+2 -1
View File
@@ -8,6 +8,7 @@ class CountVisitor(models.Model):
visitdate = models.DateField()
user = models.ForeignKey(User, null=True, blank=True, on_delete=models.PROTECT)
count = models.IntegerField(default=0)
fullPath = models.CharField(max_length=255)
def __str__(self):
return str(self.page)
@@ -17,7 +18,7 @@ class CountVisitor(models.Model):
class Meta:
constraints = [
models.UniqueConstraint(fields=['page', 'user', 'visitdate'], name='unique appversion')
models.UniqueConstraint(fields=['page', 'user', 'visitdate', 'fullPath'], name='unique appversion')
]
+3 -2
View File
@@ -37,10 +37,11 @@ class Counter(ListAPIView):
def post(self, request):
print('hernjaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
if request.data['user__id'] is not None:
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),page=request.data['page'], visitdate=date.today())
watch,create = CountVisitor.objects.get_or_create(user = User(id=request.data['user__id']),page=request.data['page'], visitdate=date.today(), fullPath=request.data['fullPath'])
else:
watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, page=request.data['page'], visitdate=date.today())
watch,create = CountVisitor.objects.get_or_create(user__id__isnull=True, page=request.data['page'], visitdate=date.today(), fullPath=request.data['fullPath'])
watch.count+=1
watch.save()