Merge branch 'master' of 10.7.100.160:/job/safesite
This commit is contained in:
commit
f0b6b728a7
|
@ -0,0 +1,31 @@
|
|||
# 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 = [
|
||||
]
|
||||
|
||||
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)
|
||||
|
@ -44,6 +44,15 @@ def makeqr4(data):
|
|||
img.save(filepath)
|
||||
return filepath
|
||||
|
||||
def makeqr_area(data):
|
||||
upload_folder = 'media/qr_area'
|
||||
if not os.path.exists(upload_folder):
|
||||
os.mkdir(upload_folder)
|
||||
img = qrcode.make(data=data)
|
||||
filepath = os.path.join(upload_folder, data.split('=')[1]+'.png').replace('\\','/')
|
||||
img.save(filepath)
|
||||
return filepath
|
||||
|
||||
def drequipments(companyid,path):
|
||||
wb = load_workbook(path)
|
||||
sheet = wb.worksheets[0]
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# Generated by Django 2.1.5 on 2019-09-19 14:23
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0267_auto_20190917_1543'),
|
||||
('safesite', '0265_auto_20190917_1716'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 2.1.5 on 2019-09-19 14:23
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('safesite', '0268_merge_20190919_1423'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='observe',
|
||||
name='lookers',
|
||||
field=models.ManyToManyField(related_name='gcrs', to='safesite.User'),
|
||||
),
|
||||
]
|
|
@ -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 = [];
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
</input>
|
||||
</div>
|
||||
</form>
|
||||
<div class="labeldiv">区域二维码</div>
|
||||
<img id="qrcode" height=240px width=240px>
|
||||
</div>
|
||||
<script>
|
||||
var id = {{id}}
|
||||
|
@ -23,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()
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
{ field: 'lookplace', title: '观察地点', width: 150 },
|
||||
{ field: 'actname', title: '作业名称', width: 200 },
|
||||
{ field: 'looktime', title: '观察时间', width: 200 },
|
||||
{ field: 'looker__name', title: '观察人', width: 200 },
|
||||
{ field: 'looker__name', title: '观察记录人', width: 200 },
|
||||
{ field: 'lookeder', title: '被观察对象', width: 200 },
|
||||
{ field: 'otherunsafe', title: '过程和交流记录', width: 300 },
|
||||
]]
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td style="width:50%">所属部门:{{lookpart__partname}}</td>
|
||||
<td style="width:50%">观察人:{{looker__name}}</td>
|
||||
<td>观察人记录人:{{looker__name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">观察人员:{{lookers}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>开始时间:{{looktime| dateFormat 'yyyy-MM-dd hh:mm'}}</td>
|
||||
|
|
|
@ -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')
|
||||
|
@ -2543,6 +2543,11 @@ def gchandle(req):
|
|||
if 'lookimg' in gcdata:
|
||||
obj.lookimg = '?'.join(gcdata['lookimg'])
|
||||
obj.save()
|
||||
if 'lookers' in gcdata:
|
||||
ulist=gcdata['lookers'].split(',')
|
||||
for i in ulist:
|
||||
x=User.objects.get(userid=i)
|
||||
obj.lookers.add(x)
|
||||
if 'unsafe' in gcdata:
|
||||
olist = gcdata['unsafe']
|
||||
for i in olist:
|
||||
|
@ -2621,9 +2626,10 @@ def gchandle(req):
|
|||
x['lookimg'] = x['lookimg'].split('?')
|
||||
else:
|
||||
x['lookimg']=[]
|
||||
for key in x:
|
||||
if x[key] == None:
|
||||
x[key] = ''
|
||||
x['lookers']=[]
|
||||
for i in a[0].lookers.all():
|
||||
x['lookers'].append(i.name)
|
||||
x['lookers']=','.join(x['lookers'])
|
||||
Observeto.objects.get_or_create(observe=a[0], user=User.objects.get(userid=req.session['userid']),defaults={'read': 1})
|
||||
return HttpResponse(json.dumps(x,cls=MyEncoder),content_type="application/json")
|
||||
elif a == 'getdics':
|
||||
|
@ -3620,7 +3626,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 +3637,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 +4517,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 +4595,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 +4868,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 +4878,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 +5114,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