This commit is contained in:
parent
3e7002c37f
commit
113b7abf08
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 2.1.5 on 2019-09-19 14:09
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0269_auto_20190919_1409'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Groups',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=128, unique=True)),
|
||||
('password', models.CharField(max_length=256)),
|
||||
('groupname', models.CharField(max_length=128, unique=True)),
|
||||
('type', models.CharField(choices=[('real', '集团'), ('fictitious', '组合')], default='集团', max_length=32)),
|
||||
('createtime', models.DateTimeField(auto_now_add=True)),
|
||||
('members', models.ManyToManyField(to='safesite.Partment')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['-createtime'],
|
||||
'verbose_name_plural': '集团',
|
||||
'verbose_name': '集团',
|
||||
},
|
||||
),
|
||||
]
|
|
@ -17,7 +17,7 @@ def makeqr(data):
|
|||
filepath = os.path.join(upload_folder, data.split('=')[1]+'.png').replace('\\','/')
|
||||
img.save(filepath)
|
||||
return filepath
|
||||
def makeqr2(data):
|
||||
def makeqr_train(data):
|
||||
upload_folder = 'media/qr_train'
|
||||
if not os.path.exists(upload_folder):
|
||||
os.mkdir(upload_folder)
|
||||
|
@ -26,7 +26,7 @@ def makeqr2(data):
|
|||
img.save(filepath)
|
||||
return filepath
|
||||
|
||||
def makeqr3(data):
|
||||
def makeqr_riskact(data):
|
||||
upload_folder = 'media/qr_riskact'
|
||||
if not os.path.exists(upload_folder):
|
||||
os.mkdir(upload_folder)
|
||||
|
@ -35,7 +35,7 @@ def makeqr3(data):
|
|||
img.save(filepath)
|
||||
return filepath
|
||||
|
||||
def makeqr4(data):
|
||||
def makeqr_examtest(data):
|
||||
upload_folder = 'media/qr_examtest'
|
||||
if not os.path.exists(upload_folder):
|
||||
os.mkdir(upload_folder)
|
||||
|
|
|
@ -212,7 +212,7 @@ class Observe(models.Model):#行为观察
|
|||
lookplace = models.CharField(max_length=200)
|
||||
looktime = models.DateTimeField(default = timezone.now)
|
||||
looktime2 = models.DateTimeField(null=True,blank=True)
|
||||
#accompanyman = models.ManyToManyField(User,related_name='gcptr',null=True,blank=True)#陪同人员
|
||||
lookers = models.ManyToManyField(User,related_name='gcrs')#陪同人员
|
||||
lookpart = models.ForeignKey(Partment,related_name='gcbm',on_delete=models.CASCADE) #观察部门
|
||||
looker = models.ForeignKey(User,related_name='gcr',default='1', on_delete=models.CASCADE)#观察人
|
||||
lookeder = models.CharField(max_length=100,null=True,blank=True)#被观察对象
|
||||
|
|
|
@ -6,6 +6,12 @@
|
|||
</div>
|
||||
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
|
||||
<form id="gcff" method="post" name="gcff" enctype="multipart/form-data">
|
||||
<div style="margin-bottom:5px">
|
||||
<input class="easyui-textbox" id="lookersname" style="width:480px;height:60px" editable="false"
|
||||
data-options="label:'观察人',multiline:true,prompt:'请选择'" required=true>
|
||||
<input type="hidden" id="lookers" name="lookers" />
|
||||
<a id="chooserys" class='easyui-linkbutton' onclick="choseusers('lookers')" style="width:auto">选择</a>
|
||||
</div>
|
||||
<div style="margin-bottom:5px">
|
||||
<input id="lookeder" name="lookeder" class="easyui-textbox" style="width:480px"
|
||||
data-options="label:'被观察人员'" required=true>
|
||||
|
@ -68,6 +74,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function aaa(x) {
|
||||
if (x == "lookers") {
|
||||
$('#lookers').attr('value', top.$('#in').val());
|
||||
$('#lookersname').textbox('setValue', top.$('#in').attr('show'));
|
||||
}
|
||||
}
|
||||
function getunsafe() {
|
||||
obj = document.getElementsByName("unsafe");
|
||||
check_val = [];
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
console.log(res)
|
||||
$('#qyname').textbox('setValue',res.name);
|
||||
$('#qyorder').textbox('setValue',res.order)
|
||||
$('#qrcode').attr('src',res.qrcode)
|
||||
})
|
||||
function submitform() {
|
||||
var data = $('#qyff').serializeJSON()
|
||||
|
|
|
@ -14,7 +14,7 @@ from django.db.models import F,Count,Sum
|
|||
import requests
|
||||
from .tasks import send_wechatmsgs,send_wechatmsg,yjjs,gettime,yjjs_px,yjjs_yl,updateTzzs,updateAqzs,yjjs_gc,yjjs_ws
|
||||
from .export import exportdoc,exportxlsx,exportyjdoc,exportsimplexlsx,exportdoc2
|
||||
from .daoru import drusers,drequipments,drrisks,cal_riskact_level,cal_area_risk_level,makeqr,makeqr2,makeqr3,makeqr4
|
||||
from .daoru import drusers,drequipments,drrisks,cal_riskact_level,cal_area_risk_level,makeqr,makeqr_train,makeqr_riskact,makeqr_examtest,makeqr_area
|
||||
from django.forms.models import model_to_dict
|
||||
from .safespider import getTzzs,getAqzs
|
||||
from duibiao import calsim
|
||||
|
@ -1213,7 +1213,7 @@ def addtrain(req):
|
|||
a.duration=req.POST.get('duration')
|
||||
a.trainnum='PX'+time.strftime('%Y%m%d%H%M%S')
|
||||
a.save()
|
||||
a.checkqr = makeqr2('https://safeyun.ctcshe.com/miniprogram/checktrain?trainid='+str(a.trainid))
|
||||
a.checkqr = makeqr_train('https://safeyun.ctcshe.com/miniprogram/checktrain?trainid='+str(a.trainid))
|
||||
a.save()
|
||||
plist=req.POST.getlist('trainpart')
|
||||
ustr = req.POST.get('participant')
|
||||
|
@ -2542,6 +2542,10 @@ def gchandle(req):
|
|||
obj.usecomp = Partment.objects.get(partid=companyid)
|
||||
if 'lookimg' in gcdata:
|
||||
obj.lookimg = '?'.join(gcdata['lookimg'])
|
||||
ulist=gcdata['lookers'].split(',')
|
||||
for i in ulist:
|
||||
x=User.objects.get(userid=i)
|
||||
obj.lookers.add(x)
|
||||
obj.save()
|
||||
if 'unsafe' in gcdata:
|
||||
olist = gcdata['unsafe']
|
||||
|
@ -3620,7 +3624,7 @@ def apitool(req):
|
|||
return JsonResponse({'code':1,'clist':clist})
|
||||
elif a == 'correct_train_qr':
|
||||
for i in Train.objects.all():
|
||||
i.checkqr = makeqr2('https://safeyun.ctcshe.com/miniprogram/checktrain?trainid='+str(i.trainid))
|
||||
i.checkqr = makeqr_train('https://safeyun.ctcshe.com/miniprogram/checktrain?trainid='+str(i.trainid))
|
||||
i.save()
|
||||
return JsonResponse({'code':1})
|
||||
elif a == 'correct_teacher':
|
||||
|
@ -3631,12 +3635,17 @@ def apitool(req):
|
|||
return JsonResponse({'code':1})
|
||||
elif a == 'correct_riskact_qr':
|
||||
for i in RiskAct.objects.all():
|
||||
i.qrcode = makeqr3('https://safeyun.ctcshe.com/miniprogram/riskact?id='+str(i.id))
|
||||
i.qrcode = makeqr_riskact('https://safeyun.ctcshe.com/miniprogram/riskact?id='+str(i.id))
|
||||
i.save()
|
||||
return JsonResponse({'code':1})
|
||||
elif a == 'correct_examtest_qr':
|
||||
for i in ExamTest.objects.all():
|
||||
i.qrcode = makeqr3('https://safeyun.ctcshe.com/miniprogram/examtest?id='+str(i.id))
|
||||
i.qrcode = makeqr_examtest('https://safeyun.ctcshe.com/miniprogram/examtest?id='+str(i.id))
|
||||
i.save()
|
||||
return JsonResponse({'code':1})
|
||||
elif a == 'correct_area_qr':
|
||||
for i in Area.objects.all():
|
||||
i.qrcode = makeqr_area('https://safeyun.ctcshe.com/miniprogram/area?id='+str(i.id))
|
||||
i.save()
|
||||
return JsonResponse({'code':1})
|
||||
elif a == 'correct_risk':
|
||||
|
@ -4506,7 +4515,7 @@ def apiexamtest(req):
|
|||
obj.duration = data['duration']
|
||||
obj.createuser = User.objects.get(userid=userid)
|
||||
obj.save()
|
||||
obj.qrcode = makeqr4('https://safeyun.ctcshe.com/miniprogram/examtest?id='+str(obj.id))
|
||||
obj.qrcode = makeqr_examtest('https://safeyun.ctcshe.com/miniprogram/examtest?id='+str(obj.id))
|
||||
obj.save()
|
||||
ksry = data['participant'].split(',')
|
||||
b = []
|
||||
|
@ -4584,7 +4593,7 @@ def apiexamtest(req):
|
|||
obj.passscore = data['passscore']
|
||||
obj.duration = data['duration']
|
||||
obj.createuser = User.objects.get(userid=userid)
|
||||
obj.qrcode = makeqr4('https://safeyun.ctcshe.com/miniprogram/examtest?id='+str(obj.id))
|
||||
obj.qrcode = makeqr_examtest('https://safeyun.ctcshe.com/miniprogram/examtest?id='+str(obj.id))
|
||||
obj.save()
|
||||
ksry = data['participant'].split(',')
|
||||
b = []
|
||||
|
@ -4857,7 +4866,8 @@ def apiarea(req):
|
|||
return JsonResponse({"code":0})
|
||||
map = data['map']
|
||||
order = data['order']
|
||||
Area.objects.create(name = name,order=order,belongmap=Map.objects.get(id=map),usecomp=Partment.objects.get(partid=companyid))
|
||||
obj = Area.objects.create(name = name,order=order,belongmap=Map.objects.get(id=map),usecomp=Partment.objects.get(partid=companyid))
|
||||
makeqr_area('https://safeyun.ctcshe.com/miniprogram/area?id='+str(obj.id))
|
||||
return JsonResponse({"code":1})
|
||||
elif a == 'del':
|
||||
if User.objects.get(userid=userid).issuper==1:
|
||||
|
@ -4866,7 +4876,7 @@ def apiarea(req):
|
|||
else:
|
||||
return JsonResponse({"code":0})
|
||||
elif a == 'detail':
|
||||
obj = Area.objects.filter(deletemark=1,id=req.GET.get('id')).values('id','name','polygon','order')[0]
|
||||
obj = Area.objects.filter(deletemark=1,id=req.GET.get('id')).values('id','name','polygon','order','qrcode')[0]
|
||||
return JsonResponse(obj)
|
||||
elif a == 'edit':
|
||||
data = json.loads(req.body.decode('utf-8'))
|
||||
|
@ -5102,7 +5112,7 @@ def apiriskact(req):
|
|||
obj.zrr = User.objects.get(userid=data['zrr'])
|
||||
obj.group = Group.objects.get(groupid=data['group'])
|
||||
obj.save()
|
||||
obj.qrcode = makeqr3('https://safeyun.ctcshe.com/miniprogram/riskact?id='+str(obj.id))
|
||||
obj.qrcode = makeqr_riskact('https://safeyun.ctcshe.com/miniprogram/riskact?id='+str(obj.id))
|
||||
obj.save()
|
||||
return JsonResponse({'code':1})
|
||||
elif a == 'edit':
|
||||
|
|
Loading…
Reference in New Issue