Поиск
This commit is contained in:
1 parent
7cafcacc1f
commit
78f52780be
3 files changed
+27
-24
No files matched your search
Binary file not shown.
@@ -266,13 +266,23 @@ import {checkremote} from '@/utils/universal_functions'
|
||||
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(newValue);
|
||||
// t_daily.value = data.data.daily
|
||||
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})
|
||||
|
||||
|
||||
|
||||
@@ -281,39 +281,32 @@ class DailyRoundUpAPIView(APIView):
|
||||
|
||||
class DailyloadAPIView(APIView):
|
||||
def get(self, request):
|
||||
user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname')
|
||||
user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'department', 'fio', 'post')
|
||||
dailyr = DailyRoundUp.objects.filter(todaysDate=date.today()).values_list('user', 'position__name', 'position')
|
||||
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")
|
||||
print(df, 'df_user---------------------------')
|
||||
# print(df_daily , 'df_daily---------------------------')
|
||||
|
||||
result={}
|
||||
pos=dailyr[0][1]
|
||||
|
||||
if request.GET.__contains__('id'):
|
||||
|
||||
|
||||
daily = DailyRoundUp.objects.filter(position=request.GET.get("id"),todaysDate=date.today()).values_list('user', 'position__name')
|
||||
|
||||
df=df.loc[df['idpos']==int(request.GET.get("id"))]
|
||||
if request.GET.__contains__('searchname'):
|
||||
# daily1 = DictEmployee.objects.using('user_directory').filter(login__in=[x[0] for x in daily])
|
||||
# daily1 = daily1.filter(fio__icontains=request.GET.get("searchname"))
|
||||
u= DictEmployee.objects.using('user_directory').values('familyname').filter(fio__icontains=request.GET.get("searchname"))
|
||||
print(daily, '-----------------------------')
|
||||
else:
|
||||
u=DictEmployee.objects.using('user_directory').filter(login__in=[x[0] for x in daily])
|
||||
print('1111111111111111111111111111111111111111111')
|
||||
pos=daily[0][1]
|
||||
|
||||
result = {}
|
||||
|
||||
|
||||
for x in u:
|
||||
if x.department in result.keys():
|
||||
result[x.department].append({'login':x.login,'fio':x.fio, 'post':x.post})
|
||||
df = df.loc[df["fio"].str.contains(request.GET.get("searchname"))]
|
||||
|
||||
|
||||
|
||||
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']})
|
||||
else:
|
||||
result[x.department]=[{'login':x.login,'fio':x.fio, 'post':x.post}]
|
||||
result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post']}]
|
||||
print(result, '111111111111111111111')
|
||||
daily = result
|
||||
|
||||
else:
|
||||
pos=''
|
||||
daily = DailyRoundUp.objects.values('position__name', 'position').filter(todaysDate=date.today()).annotate(Count('user'))
|
||||
|
||||
Reference in new issue
Block a user