Поиск в кароточке

This commit is contained in:
iriska-gri committed 2023-11-07 15:35:46 +03:00
1 parent 2e7c29c065
commit 52b78f5fcb
3 files changed
+17 -12

No files matched your search

BIN
View File
Binary file not shown.
+10 -7
View File
@@ -90,12 +90,12 @@ flat
<v-row class="bggrad"> <v-row class="bggrad">
<v-col class="text-center text-black_and_white"> <v-col class="text-center text-black_and_white">
<!-- {{result[0].pos}} --> {{t_dailyRound.position}}
</v-col> </v-col>
</v-row> </v-row>
<v-row> <v-row>
<v-col class="pa-0 mb-3"> <v-col class="pa-0 mb-3">
<!-- <my-helper :pretext="t_dailyRound[0]"/> --> <!-- <my-helper :pretext="t_dailyRound.position"/> -->
<v-textarea <v-textarea
v-model="searchname" v-model="searchname"
clearable clearable
@@ -209,10 +209,11 @@ export default {
idpos.value=pos idpos.value=pos
dialogDetailRound.value=!dialogDetailRound.value dialogDetailRound.value=!dialogDetailRound.value
axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`).then(data => { axiosApiInstance.get(`api/general_vacation/dailyload/?id=${pos}`).then(data => {
console.log(data, '-------------------data');
t_dailyRound.value = data.data t_dailyRound.value = data.data
result.value=JSON.parse(JSON.stringify(data.data)) result.value=JSON.parse(JSON.stringify(data.data.daily))
}) })
} }
@@ -238,16 +239,18 @@ export default {
axiosApiInstance.get('api/general_vacation/dailyload/') axiosApiInstance.get('api/general_vacation/dailyload/')
.then(data => { .then(data => {
t_daily.value = data.data t_daily.value = data.data.daily
}) })
} }
const filterItems = (query) => { const filterItems = (query) => {
console.log(t_dailyRound.value['daily'], '----------t_dailyRound.value');
result.value={} result.value={}
Object.keys(t_dailyRound.value).map(el1 => { Object.keys(t_dailyRound.value['daily']).map(el1 => {
let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase())) let myarr = t_dailyRound.value['daily'][el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase()))
if(myarr.length>0) if(myarr.length>0)
{ {
@@ -268,7 +271,7 @@ export default {
} }
else { else {
result.value = JSON.parse(JSON.stringify(t_dailyRound.value)) result.value = JSON.parse(JSON.stringify(t_dailyRound.value['daily']))
} }
+7 -5
View File
@@ -297,10 +297,11 @@ class DailyloadAPIView(APIView):
result={} result={}
if request.GET.__contains__('id'): if request.GET.__contains__('id'):
df=df.loc[df['idpos']==int(request.GET.get("id"))] df=df.loc[df['idpos']==int(request.GET.get("id"))]
pos=df['pos'].unique()[0]
if request.GET.__contains__('searchname'): if request.GET.__contains__('searchname'):
df = df.loc[df["fio"].str.contains(request.GET.get("searchname"))] df = df.loc[df["fio"].str.contains(request.GET.get("searchname"))]
@@ -312,17 +313,18 @@ class DailyloadAPIView(APIView):
result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}) result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']})
else: else:
result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}] result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}]
daily = result daily = result
else: else:
pos=''
daily = DailyRoundUp.objects.values('position__name', 'position').filter(todaysDate=date.today()).annotate(Count('user')) daily = DailyRoundUp.objects.values('position__name', 'position').filter(todaysDate=date.today()).annotate(Count('user'))
except Exception as e: except Exception as e:
pos=''
daily="" daily=""
return Response(daily) return Response({'daily':daily, 'position':pos})
class SearchUserAPIView(APIView): class SearchUserAPIView(APIView):
def post(self, request): def post(self, request):