Календарь
This commit is contained in:
1 parent
a853ae29a8
commit
4579fdaaba
5 files changed
+36
-9
No files matched your search
BIN
Binary file not shown.
@@ -115,18 +115,33 @@ export default {
|
||||
function f_generalvacation() {
|
||||
axiosApiInstance.get('api/general_vacation/generalvacation/')
|
||||
.then(data => {
|
||||
|
||||
|
||||
for (let x in data.data) {
|
||||
console.log(data.data, 'data-----------------------');
|
||||
// if (x =="Отпуск") {
|
||||
|
||||
|
||||
data.data[x].map(e=>{
|
||||
let d = new Date(e.planned_date)
|
||||
|
||||
calendarOptions.events.push({ description: 'description for All Day Event', title: x, start: e.planned_date, end: new Date(d.setDate(d.getDate() + e.count_days)).toISOString().split('T')[0]})
|
||||
// data.data[x].map(e=>{
|
||||
// let d = new Date(e.planned_date)
|
||||
|
||||
// calendarOptions.events.push({ description: 'description for All Day Event', title: x, start: e.planned_date, end: new Date(d.setDate(d.getDate() + e.count_days)).toISOString().split('T')[0]})
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
// )
|
||||
// }
|
||||
if (x=="План-график") {
|
||||
data.data[x].map(e=>{
|
||||
|
||||
|
||||
calendarOptions.events.push({ description: 'description for All Day Event', title: e.name, start: e.start_work_period, end: e.end_work_period})
|
||||
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class GeneralVacation(models.Model):
|
||||
|
||||
class PlanCalendar(models.Model):
|
||||
name = models.CharField(verbose_name='Название', max_length=500, blank=True, db_index=True)
|
||||
start_work_period = models.DateField(verbose_name='Начало рабочего периода')
|
||||
start_work_period = models.DateField(auto_now_add=True, verbose_name='Начало рабочего периода')
|
||||
end_work_period = models.DateField(verbose_name='Конец рабочего периода')
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -5,4 +5,10 @@ class GeneralVacationSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = GeneralVacation
|
||||
fields ='__all__'
|
||||
|
||||
class PlanCalendarSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = PlanCalendar
|
||||
fields ='__all__'
|
||||
@@ -8,10 +8,16 @@ from rest_framework.views import APIView
|
||||
class GeneralVacationAPIView(APIView):
|
||||
def get(self, request):
|
||||
general = GeneralVacation.objects.all()
|
||||
plan = PlanCalendar.objects.all()
|
||||
|
||||
# Сериализуем извлечённый набор записей
|
||||
serializer_for_basecrit = GeneralVacationSerializer(
|
||||
instance=general, # Передаём набор записей
|
||||
many=True # Указываем, что на вход подаётся именно набор записей
|
||||
)
|
||||
return Response({"Отпуск": serializer_for_basecrit.data})
|
||||
|
||||
serializer_for_plan = PlanCalendarSerializer(
|
||||
instance=plan, # Передаём набор записей
|
||||
many=True # Указываем, что на вход подаётся именно набор записей
|
||||
)
|
||||
return Response({"Отпуск": serializer_for_basecrit.data, "План-график": serializer_for_plan.data})
|
||||
Reference in new issue
Block a user