trainplan 完成度字段
This commit is contained in:
parent
3b3d698494
commit
c0963f0056
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.2.8 on 2020-12-30 21:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0372_train_trainplan'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='trainplan',
|
||||
name='completion',
|
||||
field=models.FloatField(default=0, verbose_name='完成度'),
|
||||
),
|
||||
]
|
|
@ -802,6 +802,7 @@ class TrainPlan(models.Model):
|
|||
deletemark = models.IntegerField(default=1)
|
||||
createby = models.ForeignKey(User, on_delete=models.CASCADE, related_name='trainplan_createby')
|
||||
updateby = models.ForeignKey(User, on_delete=models.CASCADE, related_name='trainplan_updateby', null=True, blank=True)
|
||||
completion = models.FloatField('完成度',default=0)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.year)+'年'+str(self.month)+'月计划'
|
||||
|
|
|
@ -511,3 +511,9 @@ def updateAqzs():
|
|||
obj = Safecert(**updated_values)
|
||||
obj.save()
|
||||
|
||||
@shared_task
|
||||
def call_trainplan_manager():
|
||||
first_day,first_day_of_next_month = gettime()
|
||||
year = first_day.year
|
||||
month = first_day.month
|
||||
pass
|
|
@ -34,7 +34,7 @@
|
|||
<script>
|
||||
$(function(){
|
||||
var option = $('#main').attr('value')
|
||||
$('#pxjhtable').datagrid({url:'api/trainplan',queryParams:{a:'listall'}});
|
||||
$('#pxjhtable').datagrid({url:'api/trainplan/',queryParams:{a:'listall'}});
|
||||
setYears();
|
||||
$("#year").combobox()
|
||||
})
|
||||
|
@ -89,6 +89,15 @@
|
|||
{ field: 'period', title: '预计学时', width: 60 },
|
||||
{ field: 'group__groupname', title: '培训对象', width: 100 },
|
||||
{ field: 'manager__name', title: '负责人', width: 80 },
|
||||
{ field: 'completion', title: '完成度', width: 160,formatter: function (value, row, index) {
|
||||
var htmlstr='<div class="easyui-progressbar progressbar easyui-fluid" style="width: 100%; height: 20px;">'
|
||||
+'<div class="progressbar-text" style="width: 100% height: 20px; line-height: 20px;">'+ value + '%</div> '
|
||||
+ '<div class="progressbar-value" style="width:'+value+'%; height: 20px; line-height: 20px;">'
|
||||
+ '<div class="progressbar-text" style="width: 100%; height: 20px; line-height: 20px;">'+value+'%</div>'
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
return htmlstr;
|
||||
} },
|
||||
|
||||
]]
|
||||
});
|
||||
|
|
|
@ -6132,7 +6132,7 @@ def apitrainplan(req):
|
|||
objs = objs.filter(year=req.GET.get('year'))
|
||||
total = objs.count()
|
||||
startnum, endnum = fenye(req)
|
||||
objs = objs[startnum:endnum].values('id', 'purpose', 'year', 'month', 'manager__name', 'group__groupname', 'period')
|
||||
objs = objs[startnum:endnum].values('id', 'purpose', 'year', 'month', 'manager__name', 'group__groupname', 'period', 'completion')
|
||||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
elif a == 'add':
|
||||
data = json.loads(req.body.decode('utf-8'))
|
||||
|
@ -6163,13 +6163,14 @@ def apitrainplan(req):
|
|||
return JsonResponse({"code": 1})
|
||||
elif a == 'detail':
|
||||
id = req.GET.get('id')
|
||||
obj = TrainPlan.objects.filter(id=id).values('id', 'purpose', 'year', 'month', 'manager__name', 'group__groupname', 'period', 'manager', 'group')[0]
|
||||
obj = TrainPlan.objects.filter(id=id).values('id', 'purpose', 'year', 'month', 'manager__name', 'group__groupname', 'period', 'manager', 'group', 'completion')[0]
|
||||
return HttpResponse(json.dumps(obj, cls=MyEncoder), content_type="application/json")
|
||||
elif a == 'del':
|
||||
id = req.GET.get('id')
|
||||
obj = TrainPlan.objects.get(id=id)
|
||||
if User.objects.get(userid=userid).issuper == 1 or userid == obj.createby :
|
||||
TrainPlan.objects.get(id=id).delete()
|
||||
obj.deletemark=0
|
||||
obj.save()
|
||||
return JsonResponse({"code": 1})
|
||||
else:
|
||||
return JsonResponse({"code": 0, "msg":'无权限删除'})
|
||||
|
|
Loading…
Reference in New Issue