Сохранение

This commit is contained in:
iriska-gri committed 2023-11-07 14:58:39 +03:00
1 parent 1bf6c58216
commit 2e7c29c065
4 files changed
+46 -27

No files matched your search

BIN
View File
Binary file not shown.
+39 -21
View File
@@ -44,7 +44,7 @@
<v-row>
<v-col>
<v-file-input
v-bind="props"
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
@@ -90,12 +90,12 @@ flat
<v-row class="bggrad">
<v-col class="text-center text-black_and_white">
{{t_dailyRound.position}}
<!-- {{result[0].pos}} -->
</v-col>
</v-row>
<v-row>
<v-col class="pa-0 mb-3">
<!-- <my-helper :pretext="t_dailyRound"/> -->
<!-- <my-helper :pretext="t_dailyRound[0]"/> -->
<v-textarea
v-model="searchname"
clearable
@@ -115,7 +115,7 @@ flat
<div
v-for="(x, key) in t_dailyRound.daily"
v-for="(x, key) in result"
:key="key"
class="px-3" >
@@ -191,12 +191,14 @@ export default {
const t_daily = ref('')
const idpos = ref('')
const dialogDetailRound = ref(false)
const t_dailyRound = ref('')
const dailyfiles = ref('')
const t_dailyRound = ref({})
const dailyfiles = ref([])
const info = ref({})
const searchname = ref('')
const menuGetUserDialog = ref(false)
const iduser = ref('')
const result = ref({})
const getcard = async (idus) => {
menuGetUserDialog.value = true
@@ -207,7 +209,11 @@ export default {
idpos.value=pos
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))
})
}
@@ -232,27 +238,38 @@ export default {
axiosApiInstance.get('api/general_vacation/dailyload/')
.then(data => {
t_daily.value = data.data.daily
t_daily.value = data.data
})
}
watch(()=> searchname.value,(newValue,oldValue)=>{
if(newValue){
const filterItems = (query) => {
result.value={}
Object.keys(t_dailyRound.value).map(el1 => {
let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase()))
if(myarr.length>0)
{
result.value[el1] = myarr
}
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}&searchname=${newValue}`)
.then(data => {
t_dailyRound.value = data.data
})
}
)
}
watch(()=> searchname.value,(newValue,oldValue)=>{
if(newValue){
filterItems(newValue)
}
else {
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${idpos.value}`)
.then(data => {
t_dailyRound.value = data.data
})
result.value = JSON.parse(JSON.stringify(t_dailyRound.value))
}
}, {deep:true})
@@ -275,7 +292,8 @@ export default {
spravURL,
menuGetUserDialog,
iduser,
getcard
getcard,
result
}
}
+7 -6
View File
@@ -292,11 +292,12 @@ class DailyloadAPIView(APIView):
df_user = pd.DataFrame.from_records(user)
df_daily = pd.DataFrame.from_records(dailyr)
df_daily.columns = ["login", "pos", "idpos"]
df = pd.merge(df_user, df_daily, left_on= 'login', right_on="login")
result={}
pos=dailyr[0][1]
if request.GET.__contains__('id'):
df=df.loc[df['idpos']==int(request.GET.get("id"))]
@@ -308,20 +309,20 @@ class DailyloadAPIView(APIView):
for index, row in df.iterrows ():
if row['department'] in result.keys():
result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post']})
result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']})
else:
result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post']}]
result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}]
daily = result
else:
pos=''
daily = DailyRoundUp.objects.values('position__name', 'position').filter(todaysDate=date.today()).annotate(Count('user'))
except Exception as e:
pos=''
daily=""
return Response({'daily':daily, 'position':pos})
return Response(daily)
class SearchUserAPIView(APIView):
def post(self, request):
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB