Карточка пользователя

This commit is contained in:
iriska-gri committed 2024-04-09 14:23:13 +03:00
1 parent 5f4ea62005
commit b1694eb124
14 files changed
+196 -266

No files matched your search

@@ -12,7 +12,6 @@
<info-user-card
:author=author
:opendialog = open
:loging="author.login"
@update:opendialog="open = $event"
/>
</div>
@@ -1,4 +1,4 @@
Для отрисовки карточки, необходимы поля от пользователя
# H1 Для отрисовки карточки, необходимы поля от пользователя
department
fio
@@ -8,6 +8,25 @@ tel
room
login
Использовать серриализатор InfoUserCardSerializer из userauth для сбора
Пример
```
class PagesSerializer(serializers.ModelSerializer):
user = serializers.SerializerMethodField('get_user')
pages = serializers.CharField(source='pages.page')
fullPath = serializers.CharField(source='pages.fullPath')
ico = serializers.CharField(source='pages.ico')
class Meta:
model = CountVisitor
fields = ['user', 'pages', 'fullPath', 'ico', 'visitdate', 'count']
def get_user(self, obj):
return InfoUserCardSerializer(obj.user.user).data
```
`
const basicInformation = () => [
{title: 'Отдел:', info: department},
{title: 'ФИО:', info: fio},
@@ -19,4 +38,5 @@ login
{title: 'Телефон: ', info: tel},
{title: 'Комната: ', info: room},
{title: 'Логин: ', info: login},
]
]
`
@@ -8,8 +8,6 @@
<v-card height="480">
<v-card-title class="pl-6">
Информация
</v-card-title>
<v-divider/>
<v-card-text>
@@ -22,7 +20,7 @@
cover
min-height="222px"
max-height="222px"
:src="checkremote(`${spravURL}${userlinks.login}.jpg`)"
:src="checkremote(`${spravURL}${author.login}.jpg`)"
/>
</v-col>
@@ -79,25 +77,21 @@
</template>
<script>
import { ref, computed, watch } from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
import {checkremote} from '@/utils/universal_functions'
import { computed } from 'vue'
import { checkremote } from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
export default {
name: "InfoUserCard",
props: {
opendialog: {
type: Boolean,
default: false
},
loging: {
type: String,
default: ''
},
author: {
type: Object,
default: {}
@@ -105,24 +99,12 @@ export default {
},
setup (props, {emit}) {
const userlinks = ref([])
const infouser = () => {
axiosApiInstance.get('api/accounts/getuser/?userlogin='+props.loging).then(res => {
userlinks.value=res.data
})}
const mydialog = computed({
get: () => props.opendialog,
set: (value) => emit('update:opendialog', value)
})
watch(()=>props.opendialog,(newValue,oldValue)=>{
if(newValue){
infouser()
}
}, {deep:true})
const basicInformation = () => [
{title: 'Отдел:', info: props.author.department},
{title: 'ФИО:', info: props.author.fio},
@@ -138,8 +120,6 @@ export default {
return {
mydialog,
userlinks,
infouser,
spravURL,
checkremote,
basicInformation,
+1 -9
View File
@@ -144,7 +144,6 @@ export default {
},
setup(){
const t_baseCriteria = ref([])
const t_daily = ref('')
const idpos = ref('')
const namepos = ref('')
@@ -179,12 +178,6 @@ export default {
const burl = baseURL.slice(0,-1)
function proba(){
axiosApiInstance.get('api/feedback/feedbackdata/')
.then(data => {
t_baseCriteria.value = data.data.results
})
}
const onPickFile = (ex) => {
const sdata = new FormData()
@@ -208,8 +201,7 @@ export default {
onMounted(() => {
dailyfun(),
proba()
dailyfun()
})
return {t_daily,
+74 -137
View File
@@ -1,103 +1,69 @@
<template>
<v-row>
<v-col class="flex-column d-flex">
<v-row class="flex-grow-0 mhight">
<v-col class=" flex-column d-flex">
<v-card class="ml-2 mt-2" width="500" >
<v-card-title class="text-wrap pb-3">
Ежедневная статистика по сотрудникам
</v-card-title>
<v-row class="flex-grow-0 align-self-end">
<v-col class="d-flex">
<v-card-subtitle class="mt-2 align-self-end">
1. Скачать файл ежедневной статистики {{info}}
</v-card-subtitle>
<v-icon
class="pt-2 pl-2"
icon="mdi-file-excel"
color="green-darken-3"
@click="excelOp('excround')"
>
</v-icon>
</v-col>
</v-row>
<v-row>
<v-card-subtitle class="align-self-center ml-3">
2. Загрузить данные на сервер
</v-card-subtitle>
<v-col class="pr-0">
<v-file-input
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
density="compact"
label="Прикрепить файл"
hide-details
class="mr-2 pb-2"
/>
</v-col>
<v-col class="flex-grow-0 align-self-center pl-0 pr-6">
<v-icon
icon="mdi-chevron-double-right"
color="blue-grey-darken-2"
@click="onPickFile('roundfilse')"
/>
</v-col>
</v-row>
</v-card>
</v-col>
<v-col class=" flex-column d-flex">
</v-col>
<v-col></v-col>
<v-col></v-col>
<v-col></v-col>
<v-col></v-col>
<!-- <v-alert
width = "500"
position="fixed"
class="bottom-alert"
:type='info=="Файл загружен"?"success":"error"'
:title='info=="Файл загружен"?"Успех!":"Упс!"'
:text="info"
v-model="alert"
:color='info=="Файл загружен"?"teal-darken-2":"red-darken-2"'
closable
></v-alert> -->
</v-row>
</v-col>
</v-row>
<v-row no-gutters class="gap ma-3 flex-column">
<v-col lg=2 class='w100 d-flex flex-column'>
<v-row no-gutters class="gap">
<v-col lg=4>
<v-card class="h-100">
<v-card-title>
Ежедневная статистика по сотрудникам
</v-card-title>
<v-row no-gutters class="gap">
<v-col class="flex-grow-0">
<v-card-subtitle class="mt-2 align-self-end">
1. Скачать файл ежедневной статистики
</v-card-subtitle>
</v-col>
<v-col class="flex-grow-0">
<v-icon
icon="mdi-file-excel"
color="green-darken-3"
@click="excelOp('excround')"
/>
</v-col>
</v-row>
<v-row no-gutters class="gap mt-5">
<v-col class="flex-grow-0">
<v-card-subtitle class="mt-3 align-self-end">
2. Загрузить данные на сервер
</v-card-subtitle>
</v-col>
<v-col >
<v-file-input
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
density="compact"
label="Прикрепить файл"
hide-details
/>
</v-col>
<v-col class="flex-grow-0 pr-2">
<v-icon
icon="mdi-chevron-double-right"
color="blue-grey-darken-2"
@click="onPickFile('roundfilse')"
/>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-col>
</v-row>
</template>
<script>
import { ref } from 'vue'
import { baseURL } from '@/utils/axios-api'
import {getfromserver} from '@/utils/universal_functions'
import { axiosApiInstance } from '@/utils/axios-api'
import { useAlertStore } from '@/store/useAlertStore'
export default {
setup(){
const dailyfiles = ref([])
const visiting = ref({})
const info = ref('')
const t_dailyRound = ref('')
const feedalert = useAlertStore().alert
const excelOp = (ex) => {
axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => {
@@ -105,70 +71,41 @@ export default {
link.href = baseURL+result.data.path
link.click()
link.remove()
})
})
}
const onPickFile = (ex) => {
const sdata = new FormData()
sdata.append('dailyfiles', dailyfiles.value[0])
axiosApiInstance.post(`api/general_vacation/dailyroundup/?excel=${ex}`, sdata).then(result => {
info.value = result.data['mess']
})
showInfo.value = true
dailyfiles.value = []
feedalert.alert = true
textFromAlert()
}
textFromAlert(result.data['mess'])
})
dailyfiles.value = []
}
const textFromAlert = () => {
if (info.value=="Файл загружен") {
feedalert.text = "Файл загружен"
feedalert.ico = "mdi-check"
feedalert.color="green-darken-4"
}
else {
feedalert.text = "Ошибка загрузки"
feedalert.ico = "mdi-alert-circle-outline"
feedalert.color="pink-accent-4"
}
}
const detailRound = () => {
axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`)
.then(data => {
t_dailyRound.value = data.data
})
}
const showInfo = ref(false)
const textFromAlert = (info) => {
feedalert.alert = true
if (info == "Файл загружен") {
feedalert.text = "Файл загружен"
feedalert.ico = "mdi-check"
feedalert.color ="green-darken-4"
}
else {
feedalert.text = "Ошибка загрузки"
feedalert.ico = "mdi-alert-circle-outline"
feedalert.color="pink-accent-4"
}
}
return {
visiting,
excelOp,
baseURL,
dailyfiles,
onPickFile,
info,
detailRound,
t_dailyRound,
showInfo,
}
feedalert
}
}
}
</script>
+1 -3
View File
@@ -82,9 +82,7 @@ export function pagecounter(){
clearAxios.post(`${baseURL}api/watcher/counter/`, postdata)
.then(result => {
appStore.countvisitor = result.data
appStore.countvisitor = result.data
})
+1 -1
View File
@@ -170,7 +170,7 @@ 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