fix [P-01]: загрузка тех кто на работе

This commit is contained in:
Nukeap committed 2025-02-11 15:18:44 +03:00
1 parent 9dd90589a0
commit e1f47848d0
4 files changed
+258 -313

No files matched your search

+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "front", "name": "front",
"version": "0.0.85", "version": "0.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "front", "name": "front",
"version": "0.0.85", "version": "0.1.0",
"dependencies": { "dependencies": {
"@ckeditor/ckeditor5-build-classic": "^44.1.0", "@ckeditor/ckeditor5-build-classic": "^44.1.0",
"@ckeditor/ckeditor5-dev-translations": "^43.0.1", "@ckeditor/ckeditor5-dev-translations": "^43.0.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "front", "name": "front",
"version": "0.0.85", "version": "0.1.0",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
+167 -212
View File
@@ -1,237 +1,192 @@
<template> <template>
<div class="d-flex h-100 "> <div class="d-flex h-100">
<v-card v-if="t_daily.length > 0" class="h-100 w-100 d-flex flex-column">
<v-card <v-row v-for="x in t_daily" :key="x" v-show="x.position != 6">
v-if="t_daily.length > 0" <v-divider />
class="h-100 w-100 d-flex flex-column" <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-row <v-card-title
v-for="x in t_daily" class="statstyle py-0 text-xl-overline text-lg-subtitle-1 text-md-h5 font-weight-bold bg-black_and_white"
:key="x" >
v-show="x.position!=6" {{ x.position__name }}
> </v-card-title>
<v-divider/> <v-card-text
<v-col> @click="detailRound(x.position, x.position__name)"
<v-card class="numstyle mt-2 py-0 font-weight-bold cursor-pointer bg-black_and_white"
class="ma-2 d-flex flex-column" >
height="100" <vue3-autocounter
elevation="0" ref="counter"
> :startAmount="0"
<v-card class="h-100 text-center text-black_grey bg-black_and_white"> :endAmount="Number(x.user__count)"
<v-card-title :duration="2"
class="statstyle py-0 />
text-xl-overline </v-card-text>
text-lg-subtitle-1 </v-card>
text-md-h5 font-weight-bold bg-black_and_white"> </v-card>
{{x.position__name}} </v-col>
</v-card-title> </v-row>
<v-card-text </v-card>
@click="detailRound(x.position, x.position__name)" <v-card
class="numstyle mt-2 py-0 font-weight-bold cursor-pointer bg-black_and_white" v-else
> class="h-100 w-100 d-flex justify-center flex-column"
:image="`${burl}/media/default/didjlenta.jpg`"
<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 flex-column"
:image="`${burl}/media/default/didjlenta.jpg`">
<v-row class="flex-grow-0">
<v-col class="py-0">
<v-switch
v-if="accountStore.user.is_staff"
v-model="changeData"
class="pl-3 d-flex justify-end"
color="white"
@click="changeData=!changeData">
</v-switch>
</v-col>
</v-row>
<v-row class="ma-3">
<v-card-text class="d-flex flex-column align-self-center " v-if="changeData">
<v-file-input
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
density="compact"
hide-details
class="pt-2 ml-0 text-white"
/>
<v-btn
class="align-self-center"
icon="mdi-google-play text-white"
size="x-large"
variant="text"
color="teal-darken-4"
:disabled="dailyfiles==0?true:false"
@click="onPickFile('roundfilse')"
/>
</v-card-text>
<v-card-text v-else class="w-100">
<v-row
class="text-white text-center text-lg-h5 h-100"
align-content="center"
justify="center"
> >
Данные не загружены <v-row class="flex-grow-0">
</v-row> <v-col class="py-0">
<v-switch
</v-card-text> v-if="accountStore.user.is_staff"
v-model="changeData"
</v-row> class="pl-3 d-flex justify-end"
color="white"
@click="changeData = !changeData"
>
</v-switch>
</v-card> </v-col>
</v-row>
<div class="text-center"> <v-row class="ma-3">
<v-card-text class="d-flex flex-column align-self-center" v-if="changeData">
<v-dialog <v-file-input
v-model="dialogDetailRound" accept=".xlsx"
width="500" v-model="dailyfiles"
> variant="underlined"
<dialog-search density="compact"
:idpos=idpos hide-details
:namepos=namepos class="pt-2 ml-0 text-white"
@searchClose="dialogDetailRound=!dialogDetailRound" />
/>
</v-dialog>
</div>
<v-btn
class="align-self-center"
icon="mdi-google-play text-white"
size="x-large"
variant="text"
color="teal-darken-4"
:disabled="dailyfiles == 0 ? true : false"
@click="onPickFile('roundfilse')"
/>
</v-card-text>
<v-card-text v-else class="w-100">
<v-row
class="text-white text-center text-lg-h5 h-100"
align-content="center"
justify="center"
>
Данные не загружены
</v-row>
</v-card-text>
</v-row>
</v-card>
<div class="text-center">
<v-dialog v-model="dialogDetailRound" width="500">
<dialog-search
:idpos="idpos"
:namepos="namepos"
@searchClose="dialogDetailRound = !dialogDetailRound"
/>
</v-dialog>
</div> </div>
</div>
</template> </template>
<script> <script>
import { ref, onMounted,watch } from 'vue' import { ref, onMounted } from 'vue';
import { axiosApiInstance } from '@/utils/axios-api' import { axiosApiInstance } from '@/utils/axios-api';
import {checkremote} from '@/utils/universal_functions' import { checkremote } from '@/utils/universal_functions';
import { spravURL } from '@/utils/axios-api' import { spravURL } from '@/utils/axios-api';
import DialogSearch from './dialog-search.vue' import DialogSearch from './dialog-search.vue';
import { baseURL } from '@/utils/axios-api' import { baseURL } from '@/utils/axios-api';
import {useAccountStore} from '@/store/AccountStore' import { useAccountStore } from '@/store/AccountStore';
export default { export default {
components: {
DialogSearch,
},
components: { setup() {
DialogSearch const t_daily = ref('');
}, const idpos = ref('');
const namepos = 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 result = ref({});
const changeData = ref(false);
const accountStore = useAccountStore();
setup(){ const getcard = async (idus) => {
const t_daily = ref('') menuGetUserDialog.value = true;
const idpos = ref('') iduser.value = idus;
const namepos = 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 result = ref({})
const changeData = ref(false)
const accountStore = useAccountStore()
const detailRound = (pos, name) => {
idpos.value = pos;
namepos.value = name;
dialogDetailRound.value = !dialogDetailRound.value;
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`).then((data) => {
t_dailyRound.value = data.data;
const getcard = async (idus) => { result.value = JSON.parse(JSON.stringify(data.data.daily));
menuGetUserDialog.value = true });
iduser.value = idus };
}
const detailRound = (pos, name) => { const burl = baseURL.slice(0, -1);
idpos.value=pos
namepos.value=name
dialogDetailRound.value=!dialogDetailRound.value
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`).then(data => {
t_dailyRound.value = data.data
result.value=JSON.parse(JSON.stringify(data.data.daily)) const onPickFile = (ex) => {
const sdata = new FormData();
sdata.append('dailyfiles', dailyfiles.value);
axiosApiInstance
.post(`api/general_vacation/dailyroundup/?excel=${ex}`, 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;
const burl = baseURL.slice(0,-1) });
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
dailyfun()
})
dailyfiles.value = ''
}
function dailyfun(){
axiosApiInstance.get('api/general_vacation/dailyload/')
.then(data => {
t_daily.value = data.data.daily
})
}
// bgimage()
onMounted(() => {
dailyfun()
})
return {t_daily,
detailRound,
dialogDetailRound,
t_dailyRound,
dailyfiles,
onPickFile,
info,
checkremote,
searchname,
spravURL,
menuGetUserDialog,
iduser,
getcard,
result,
idpos,
namepos,
changeData,
baseURL,
burl,
accountStore
}
} }
// bgimage()
} onMounted(() => {
dailyfun();
});
return {
t_daily,
detailRound,
dialogDetailRound,
t_dailyRound,
dailyfiles,
onPickFile,
info,
checkremote,
searchname,
spravURL,
menuGetUserDialog,
iduser,
getcard,
result,
idpos,
namepos,
changeData,
baseURL,
burl,
accountStore,
};
},
};
</script> </script>
<style> <style>
.fiction .v-input__control { .fiction .v-input__control {
display: none; display: none;
} }
</style> </style>
+88 -98
View File
@@ -1,119 +1,109 @@
<template> <template>
<v-row no-gutters class="gap ma-3 flex-column"> <v-row no-gutters class="gap ma-3 flex-column">
<v-col lg=2 class='w100 d-flex 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-row no-gutters class="gap">
<v-col lg=4> <v-col class="flex-grow-0">
<v-card class="h-100"> <v-card-subtitle class="mt-2 align-self-end">
<v-card-title> 1. Скачать файл ежедневной статистики
Ежедневная статистика по сотрудникам </v-card-subtitle>
</v-card-title> </v-col>
<v-row no-gutters class="gap"> <v-col class="flex-grow-0">
<v-col class="flex-grow-0"> <v-icon icon="mdi-file-excel" color="green-darken-3" @click="excelOp('excround')" />
<v-card-subtitle class="mt-2 align-self-end"> </v-col>
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-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-col>
</v-row> </v-row>
</v-col>
</v-row>
</template> </template>
<script> <script>
import { ref } from 'vue' import { ref } from 'vue';
import { baseURL } from '@/utils/axios-api' import { baseURL } from '@/utils/axios-api';
import { axiosApiInstance } from '@/utils/axios-api' import { axiosApiInstance } from '@/utils/axios-api';
import { useAlertStore } from '@/store/useAlertStore' import { useAlertStore } from '@/store/useAlertStore';
export default { export default {
setup() {
const dailyfiles = ref([]);
const feedalert = useAlertStore().alert;
setup(){ const excelOp = (ex) => {
axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then((result) => {
let link = document.createElement('a');
link.href = baseURL + result.data.path;
link.click();
link.remove();
});
};
const dailyfiles = ref([]) const onPickFile = (ex) => {
const feedalert = useAlertStore().alert const sdata = new FormData();
sdata.append('dailyfiles', dailyfiles.value);
const excelOp = (ex) => { axiosApiInstance
axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => { .post(`api/general_vacation/dailyroundup/?excel=${ex}`, sdata)
let link = document.createElement("a") .then((result) => {
link.href = baseURL+result.data.path textFromAlert(result.data['mess']);
link.click() });
link.remove() dailyfiles.value = [];
}) };
}
const onPickFile = (ex) => { const textFromAlert = (info) => {
const sdata = new FormData() feedalert.alert = true;
sdata.append('dailyfiles', dailyfiles.value[0]) if (info == 'Файл загружен') {
feedalert.text = 'Файл загружен';
axiosApiInstance.post(`api/general_vacation/dailyroundup/?excel=${ex}`, sdata).then(result => { feedalert.ico = 'mdi-check';
textFromAlert(result.data['mess']) feedalert.color = 'green-darken-4';
}) } else {
dailyfiles.value = [] feedalert.text = 'Ошибка загрузки';
} feedalert.ico = 'mdi-alert-circle-outline';
feedalert.color = 'pink-accent-4';
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 { return {
excelOp, excelOp,
baseURL, baseURL,
dailyfiles, dailyfiles,
onPickFile, onPickFile,
feedalert feedalert,
} };
} },
};
}
</script> </script>
<style> <style>
.mhight { .mhight {
height: 150px; height: 150px;
} }
</style> </style>