operation check complete

This commit is contained in:
caoqianming 2019-12-02 21:08:02 +08:00
parent b388dce777
commit 0848977438
3 changed files with 78 additions and 40 deletions

View File

@ -29,7 +29,7 @@
</div>
<div style="margin-bottom:5px;">
<input id="starttime" editable="false" name="starttime" class="easyui-datetimebox" style="width:90%"
data-options="label:'最早参加',currentText:'今天',closeText:'关闭',showSeconds: false" />
data-options="label:'最早参加',currentText:'今天',closeText:'关闭',showSeconds: false,required:true" />
</div>
<div style="margin-bottom:5px;">
<input id="endtime" editable="false" name="endtime" class="easyui-datetimebox" style="width:90%"

View File

@ -30,7 +30,7 @@
</div>
<div style="margin-bottom:5px;">
<input id="starttime" editable="false" name="starttime" class="easyui-datetimebox" style="width:90%"
data-options="label:'考试开启',currentText:'今天',closeText:'关闭',showSeconds: false" />
data-options="label:'考试开启',currentText:'今天',closeText:'关闭',showSeconds: false,required:true" />
</div>
<div style="margin-bottom:5px;">
<input id="endtime" editable="false" name="endtime" class="easyui-datetimebox" style="width:90%"

View File

@ -588,44 +588,50 @@ def getsprs(userid,ubp):
return User.objects.get(ubelongpart=currentpart,issuper=1)
return a
def getsprs_ubp(userid,ubp):#主管和被授权人员
def getsprs_ubp(userid,ubp):#主管
a=ubp
if a.bmzg !=',':
zgstr = a.bmzg
zglist = zgstr.split(',')
zglist = list(map(int, list(filter(None, zglist))))
if userid in zglist:
return [userid]
else:
return zglist
else:
return False
def getsprs2(userid,ubp):
currentpart=ubp
a=getsprs_ubp2(userid,currentpart)
while a==False:
currentpart=currentpart.parentid #已找不到上级部门
if currentpart:
a=getsprs_ubp2(userid,currentpart)
else:
return User.objects.get(ubelongpart=currentpart,issuper=1)
return a
def getsprs_ubp2(userid,ubp):#主管和被授权人员
a=ubp
# if a.aqy !=',':
# aqystr = a.aqy
# aqylist = aqystr.split(',')
# aqylist = list(map(int, list(filter(None, aqylist))))
# if userid in aqylist:
# return [userid]
# else:
# if ',' + str(userid) + ',' in a.bmzg:
# return [userid]
# else:
# return aqylist
if a.bmzg !=',':
zgstr = a.bmzg
zglist = zgstr.split(',')
zglist = list(map(int, list(filter(None, zglist))))
bsqstr = a.bsq
bsqlist = list(map(int, list(filter(None, bsqstr.split(',')))))
if userid in zglist:
return [userid]
elif userid in bsqlist:
zglist.append(userid)
return zglist
else:
return zglist
# if userid in zglist:
# return [userid]
# elif userid in bsqlist:
# zglist.append(userid)
# return zglist
# else:
# return zglist
zglist.extend(bsqlist)
return list(set(zglist))
else:
return False
# def getsprs_ubp2(userid,ubp):
# a=ubp
# if a.aqy !=',' or a.bmzg !=',':
# allstr = a.aqy + a.bmzg
# alllist = allstr.split(',')
# alist = list(map(int, list(filter(None, alllist))))
# return alist
# else:
# return False
def menutree(req):
@ -4172,6 +4178,21 @@ def apitool(req):
i.zyzt['jdmc'] =''
i.save()
return JsonResponse({"code":1})
elif a == 'correct_examtest':
for i in ExamTest.objects.all():
if i.starttime:
pass
else:
print(i.id,'start')
i.starttime = i.createtime
i.save()
if i.endtime:
pass
else:
print(i.id,'end')
i.endtime = i.createtime + timedelta(days=1)
i.save()
return JsonResponse({"code":1})
@ -4387,11 +4408,18 @@ def apioperation(req):
obj.zyimg = '?'.join(data['zyimg'])
obj.fxcs = '?'.join(map(str,data['fxcs']))
obj.zyzt = {'zyzt':'确认中','index':0}
obj.save()
splc = []
if 'spr1s' in data:
spr1s = [data['spr1s']]
else:
spr1s = getsprs(userid,obj.zybm)
if 'spr2s' in data:
spr2s = [data['spr2s']]
else:
spr2s = getsprs(userid,obj.sdbm)
splc.append({'jdmc':'作业负责人审批','sprs':[userid]})
splc.append({'jdmc':'作业部门审批','sprs':getsprs(userid,obj.zybm)})
splc.append({'jdmc':'属地部门审批','sprs':getsprs(userid,obj.sdbm)})
splc.append({'jdmc':'作业部门审批','sprs':spr1s})
splc.append({'jdmc':'属地部门审批','sprs':spr2s})
for i in Operationspjd.objects.filter(zylx=obj.zylx,usecomp=Partment.objects.get(partid=getcompany(userid))).order_by('id'):
splc.append({'jdmc':i.jdmc,'sprs':i.sprs})
obj.zyzt['splc']=splc
@ -4401,7 +4429,7 @@ def apioperation(req):
for i in data['zyry']:
x=User.objects.get(userid=i)
if int(userid)==int(i):#申请人包含作业人直接确认
m = Operzyry.objects.create(oper=obj,operzyry=x,checked=1)
Operzyry.objects.create(oper=obj,operzyry=x,checked=1)
if Operzyry.objects.filter(oper=obj,checked=0).exists():
pass
else:#工作人员全部确认
@ -4443,9 +4471,8 @@ def apioperation(req):
send_wechatmsgs.delay(postdict,tolist)
return JsonResponse({"code":1})
else:
m = Operzyry.objects.create(oper=obj,operzyry=x)
m.save()
b.append(x.openid)
Operzyry.objects.create(oper=obj,operzyry=x)
b.append(x.openid)
postdict={
'touser':'',
@ -4745,6 +4772,14 @@ def apioperation(req):
return JsonResponse({"code":1})
else:
return JsonResponse({"code":0})
elif a == 'getspr12':
zybm = User.objects.get(userid=userid).ubelongpart#作业部门
sdbm = Partment.objects.get(partid=json.loads(req.body.decode('utf-8'))['sdbm'])
spr1 = getsprs2(userid,zybm)
spr2 = getsprs2(userid,sdbm)
spr1Array = User.objects.filter(userid__in=spr1).annotate(value=F('userid'),text=F('name')).values('value','text')
spr2Array = User.objects.filter(userid__in=spr2).annotate(value=F('userid'),text=F('name')).values('value','text')
return JsonResponse({"code":1,"data":{'spr1Array':list(spr1Array),'spr2Array':list(spr2Array)}})
def apioperationsetting(req):
@ -5248,10 +5283,13 @@ def apiexamtestdetail(req):
startnum,endnum=fenye(req)
a = a[startnum:endnum].values('id','examtest__id','examtest__name','examtest__starttime','examtest__endtime','examtest__passscore','examtest__state','examtest__duration')
for i in a:
if i['examtest__endtime']>datetime.now():
i['isActive'] = True
if i['examtest__endtime']:
if i['examtest__endtime']>datetime.now():
i['isActive'] = True
else:
i['isActive'] = False
else:
i['isActive'] = False
i['isActive'] = True
return HttpResponse(transjson(total,a),content_type="application/json")
elif a=='listyk':
a = ExamTestDetail.objects