培训导出企业信息

This commit is contained in:
caoqianming 2019-09-17 22:33:38 +08:00
parent a6e67b8106
commit f8bb4c1ace
8 changed files with 41 additions and 6 deletions

View File

@ -80,7 +80,7 @@ def exportdoc(a,id):
elif a=='px': elif a=='px':
trainid = id trainid = id
a = Train.objects.filter(trainid=trainid) a = Train.objects.filter(trainid=trainid)
x = a.values('trainid','trainnum','state','trainplace','starttime','trainname','traintype__dickeyname','teacher','submituser__name','submittime','trainlevel__dicname','traincontent__dickeyname','manlevel__dickeyname','detailcontent','participantnum','knownum','duration','material')[0] x = a.values('trainid','trainnum','state','trainplace','starttime','trainname','traintype__dickeyname','teacher','submituser__name','submittime','trainlevel__dicname','traincontent__dickeyname','manlevel__dickeyname','detailcontent','participantnum','knownum','duration','material','pxxg','examtest__num','examtest__name')[0]
for key in x: for key in x:
if x[key] == None: if x[key] == None:
x[key] = '' x[key] = ''

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,19 @@
# Generated by Django 2.1.5 on 2019-09-17 17:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('safesite', '0264_auto_20190909_0916'),
]
operations = [
migrations.AddField(
model_name='train',
name='examtest',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='safesite.ExamTest'),
),
]

View File

@ -42,6 +42,7 @@ class Area(models.Model):
deletemark = models.IntegerField(default='1') deletemark = models.IntegerField(default='1')
usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE) usecomp = models.ForeignKey(Partment, on_delete=models.CASCADE)
risklevel = models.CharField(max_length=50,null=True,blank=True)#风险等级 risklevel = models.CharField(max_length=50,null=True,blank=True)#风险等级
qrcode = models.CharField(max_length=200,blank=True,null=True)#区域二维码
class User(models.Model): class User(models.Model):
userid = models.AutoField(primary_key=True) userid = models.AutoField(primary_key=True)
@ -628,6 +629,7 @@ class Train(models.Model):#培训表
pxxg = models.CharField(max_length=1000,null=True,blank=True) pxxg = models.CharField(max_length=1000,null=True,blank=True)
material = models.CharField(max_length=1000,null=True,blank=True) material = models.CharField(max_length=1000,null=True,blank=True)
checkqr = models.CharField(max_length=200,blank=True,null=True) checkqr = models.CharField(max_length=200,blank=True,null=True)
examtest = models.ForeignKey(ExamTest,on_delete=models.CASCADE,null=True,blank=True)
class Trainuser(models.Model):#培训人员记录 class Trainuser(models.Model):#培训人员记录
train = models.ForeignKey(Train, on_delete=models.CASCADE) train = models.ForeignKey(Train, on_delete=models.CASCADE)

View File

@ -67,7 +67,7 @@
<input id="pxxg" name="pxxg" class="easyui-textbox" style="width:480px;height:60px" data-options="label:'培训效果',multiline:true,"> <input id="pxxg" name="pxxg" class="easyui-textbox" style="width:480px;height:60px" data-options="label:'培训效果',multiline:true,">
</div> </div>
<div id="examtestdiv" style="margin-bottom:5px;display:none"> <div id="examtestdiv" style="margin-bottom:5px;display:none">
<input id="examtest" name="examtest" class="easyui-combobox" style="width:480px;" data-options="label:'关联考试',url:'api/examtest?a=listtrain'"> <input id="examtest" name="examtest" class="easyui-combobox" style="width:480px;" editable=false data-options="label:'关联考试',url:'api/examtest?a=listtrain'">
</div> </div>
<div id='filediv' style="margin-bottom:5px;display:none"> <div id='filediv' style="margin-bottom:5px;display:none">
<label>相关资料 </label><input type="file" id="file" name="" accept="*" style="margin-left: 20px" /> <label>相关资料 </label><input type="file" id="file" name="" accept="*" style="margin-left: 20px" />

View File

@ -41,7 +41,13 @@
<td colspan="2">具体内容:{{detailcontent}}</td> <td colspan="2">具体内容:{{detailcontent}}</td>
</tr> </tr>
<tr> <tr>
<td>掌握人数:{{knownum}}</td> <td colspan="2">掌握人数:{{knownum}}</td>
</tr>
<tr>
<td colspan="2">培训效果:{{pxxg}}</td>
</tr>
<tr>
<td colspan="2">关联考试:{{examtest__num}} {{examtest__name}}</td>
</tr> </tr>
</table> </table>
<div class="labeldiv">相关附件</div> <div class="labeldiv">相关附件</div>

View File

@ -268,7 +268,7 @@ def check_login(func):
#存储文件 #存储文件
def upfile(req): def upfile(req):
username = User.objects.get(userid=req.session['userid']).username username = User.objects.get(userid=req.session['userid']).username
file_name = time.strftime('%Y%m%d%H%M%S')+ '_' + req.FILES['upfile'].name file_name = (time.strftime('%Y%m%d%H%M%S')+ '_' + req.FILES['upfile'].name).replace('#','')
user_upload_folder = os.path.join('media', username) user_upload_folder = os.path.join('media', username)
if not os.path.exists(user_upload_folder): if not os.path.exists(user_upload_folder):
os.mkdir(user_upload_folder) os.mkdir(user_upload_folder)
@ -1318,7 +1318,7 @@ def accesstrain(req):
companyid = getcompany(userid) companyid = getcompany(userid)
#绑定考试 #绑定考试
if req.POST.get('examtest'): if req.POST.get('examtest'):
a.update(examtest=ExamTest.objects.get('examtest')) a.update(examtest=ExamTest.objects.get(id=req.POST.get('examtest')))
for i in Trainuser.objects.filter(train__trainid=trainid): for i in Trainuser.objects.filter(train__trainid=trainid):
objs = ExamTestDetail.objects.filter(examtest__id=req.POST.get('examtest'),user=i.participant) objs = ExamTestDetail.objects.filter(examtest__id=req.POST.get('examtest'),user=i.participant)
if objs.exists(): if objs.exists():
@ -2345,7 +2345,7 @@ def pxhandle(req):
elif req.GET.get('a')=='detail': elif req.GET.get('a')=='detail':
trainid = req.GET.get('trainid') trainid = req.GET.get('trainid')
a = Train.objects.filter(trainid=trainid) a = Train.objects.filter(trainid=trainid)
x = a.values('trainid','trainnum','state','trainplace','starttime','trainname','traintype__dickeyname','teacher','lecturer__name','submituser__name','submittime','trainlevel__dicname','traincontent__dickeyname','manlevel__dickeyname','detailcontent','participantnum','knownum','duration','material','checkqr')[0] x = a.values('trainid','trainnum','state','trainplace','starttime','trainname','traintype__dickeyname','teacher','lecturer__name','submituser__name','submittime','trainlevel__dicname','traincontent__dickeyname','manlevel__dickeyname','detailcontent','participantnum','knownum','duration','material','checkqr','examtest__num','examtest__name')[0]
for key in x: for key in x:
if x[key] == None: if x[key] == None:
x[key] = '' x[key] = ''
@ -3702,6 +3702,13 @@ def apitool(req):
i.zrr = Risk.objects.filter(riskact=i)[0].zrr i.zrr = Risk.objects.filter(riskact=i)[0].zrr
i.save() i.save()
return JsonResponse({"code":1}) return JsonResponse({"code":1})
elif a == 'correct_png':
objs = Trouble.objects.filter(Q(yhtp__contains='#')|Q(zghtp__contains='#'))
for i in objs:
i.yhtp = i.yhtp.replace('#','')
i.zghtp = i.zghtp.replace('#','')
i.save()
return JsonResponse({"code":1})
def apinotice(req): def apinotice(req):
@ -4573,6 +4580,7 @@ def apiexamtest(req):
obj.passscore = data['passscore'] obj.passscore = data['passscore']
obj.duration = data['duration'] obj.duration = data['duration']
obj.createuser = User.objects.get(userid=userid) obj.createuser = User.objects.get(userid=userid)
obj.qrcode = makeqr4('https://safeyun.ctcshe.com/miniprogram/examtest?id='+str(obj.id))
obj.save() obj.save()
ksry = data['participant'].split(',') ksry = data['participant'].split(',')
b = [] b = []