|
|
|
@ -126,110 +126,110 @@ def upfile(req):
|
|
|
|
|
return JsonResponse({"code":1,"filename":file_name,"filepath":filepath})
|
|
|
|
|
|
|
|
|
|
#html页面
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def riskas(req):
|
|
|
|
|
return render(req,'riskas.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def reportedit(req):
|
|
|
|
|
return render(req,'reportedit.html',{'year':req.GET.get('year'),'month':req.GET.get('month'),'part':req.GET.get('part')})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def riskedit(req,id):
|
|
|
|
|
return render(req,'riskedit.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def riskcheck(req):#风险点排查记录
|
|
|
|
|
return render(req,'riskactcheck.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def taskdo(req):
|
|
|
|
|
return render(req,'taskdo.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def task(req):
|
|
|
|
|
return render(req,'task.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def riskactchose(req):
|
|
|
|
|
area = 0
|
|
|
|
|
if req.GET.get('area',None):
|
|
|
|
|
area = req.GET.get('area')
|
|
|
|
|
return render(req,'riskactchose.html',locals())
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def riskactedit(req,id):
|
|
|
|
|
return render(req,'riskactedit.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def riskactadd(req):
|
|
|
|
|
return render(req,'riskactadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def riskadd(req,id):
|
|
|
|
|
return render(req,'riskadd.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def risk(req):
|
|
|
|
|
return render(req,'risk.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def inspect(req):
|
|
|
|
|
return render(req,'inspect.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def equipment(req):
|
|
|
|
|
return render(req,'equipment.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def areaedit(req,id):
|
|
|
|
|
return render(req,'areaedit.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def areaadd(req):
|
|
|
|
|
return render(req,'areaadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def areadetail(req):
|
|
|
|
|
id = req.GET.get('id')
|
|
|
|
|
return render(req,'areadetail.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def mapshow(req):
|
|
|
|
|
return render(req,'mapshow.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def area(req):
|
|
|
|
|
return render(req,'area.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def personaltrain(req):
|
|
|
|
|
return render(req,'personaltrain.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def examtest(req):
|
|
|
|
|
return render(req,'examtest.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def safecert(req):
|
|
|
|
|
return render(req,'safecert.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def safecertadd(req):
|
|
|
|
|
return render(req,'safecertadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def examtestdetail(req,id):
|
|
|
|
|
return render(req,'examtestdetail.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def examtestadd(req):
|
|
|
|
|
return render(req,'examtestadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def examtestadd2(req):
|
|
|
|
|
return render(req,'examtestadd2.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def questionchoose(req):
|
|
|
|
|
return render(req,'questionchoose.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def exampaperedit(req,id):
|
|
|
|
|
return render(req,'exampaperedit.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def exampaperadd(req):
|
|
|
|
|
return render(req,'exampaperadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def exampaper(req):
|
|
|
|
|
return render(req,'exampaper.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def examhistory(req,id):
|
|
|
|
|
return render(req,'examhistory.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def questionadd(req):
|
|
|
|
|
return render(req,'questionadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def questionadd2(req):
|
|
|
|
|
return render(req,'questionadd2.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def questionadd3(req):
|
|
|
|
|
return render(req,'questionadd3.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def questionedit(req,id):
|
|
|
|
|
obj = Question.objects.get(id=id)
|
|
|
|
|
if obj.type==1:
|
|
|
|
@ -238,140 +238,140 @@ def questionedit(req,id):
|
|
|
|
|
return render(req,'questionedit2.html',{'id':id})
|
|
|
|
|
elif obj.type==3:
|
|
|
|
|
return render(req,'questionedit3.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def question(req):
|
|
|
|
|
return render(req,'question.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def questioncatadd(req):
|
|
|
|
|
return render(req,'questioncatadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def questioncatedit(req,id):
|
|
|
|
|
return render(req,'questioncatedit.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def operationspjdadd(req):
|
|
|
|
|
return render(req,'operationspjdadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def fxcsadd(req):
|
|
|
|
|
return render(req,'fxcsadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def operationadd(req,zyid):
|
|
|
|
|
return render(req,'operationadd.html',{'zyid':zyid})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def operationdetail(req,zyid):
|
|
|
|
|
return render(req,'operationdetail.html',{'zyid':zyid})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def operation(req):
|
|
|
|
|
return render(req,'operation.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def zuoyepeizhi(req):
|
|
|
|
|
return render(req,'zuoyepeizhi.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def notice(req):
|
|
|
|
|
return render(req,'notice.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def noticeadd(req):
|
|
|
|
|
return render(req,'noticeadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def noticedetail(req,id):
|
|
|
|
|
return render(req,'noticedetail.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def noticeedit(req,id):
|
|
|
|
|
return render(req,'noticeedit.html',{'id':id})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def suggestupdate(req,jyid):
|
|
|
|
|
return render(req,'suggestupdate.html',{'jyid':jyid})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def suggestdetail(req,jyid):
|
|
|
|
|
return render(req,'suggestdetail.html',{'jyid':jyid})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def suggestadd(req):
|
|
|
|
|
return render(req,'suggestadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def suggest(req):
|
|
|
|
|
return render(req,'suggest.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def medetail(req):
|
|
|
|
|
return render(req,'medetail.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def socerthtml(req):
|
|
|
|
|
return render(req,'socert.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def socertadd(req):
|
|
|
|
|
return render(req,'socertadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def rightshtml(req):
|
|
|
|
|
groupid = req.GET.get('groupid')
|
|
|
|
|
return render(req,'rights.html',{'groupid':groupid})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def misshtml(req):
|
|
|
|
|
return render(req,'miss.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def missadd(req):
|
|
|
|
|
return render(req,'missadd.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def missdetail(req,missid):
|
|
|
|
|
return render(req,'missdetail.html',{'missid':missid})
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def troublehtml(req):
|
|
|
|
|
return render(req,'trouble.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def observehtml(req):
|
|
|
|
|
return render(req,'observe.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def addobserve(req):
|
|
|
|
|
return render(req,'addobserve.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def accesstrouble(req):
|
|
|
|
|
return render(req,'accesstrouble.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def addtrouble(req):
|
|
|
|
|
return render(req,'addtrouble.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def dichtml(req):
|
|
|
|
|
return render(req,'dichtml.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def putreehtml(req):
|
|
|
|
|
return render(req,'putree.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def usergroup(req):
|
|
|
|
|
return render(req,'usergroup.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def getuserf(req):
|
|
|
|
|
return render(req,'getuser.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def getusersf(req):
|
|
|
|
|
return render(req,'getusers.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def trainhtml(req):
|
|
|
|
|
return render(req,'train.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def abtrain(req):
|
|
|
|
|
return render(req,'abtrain.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def drillhtml(req):
|
|
|
|
|
return render(req,'drill.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def abdrill(req):
|
|
|
|
|
return render(req,'abdrill.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def reporthtml(req):
|
|
|
|
|
return render(req,'report.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def troubleashtml(req):
|
|
|
|
|
return render(req,'troubleashtml.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def userhtml(req):
|
|
|
|
|
return render(req,'userhtml.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def bhrhtml(req):
|
|
|
|
|
return render(req,'behavior.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def trainfigure(req):
|
|
|
|
|
return render(req,'trainfigure.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def equipmentfigure(req):
|
|
|
|
|
return render(req,'equipmentfigure.html')
|
|
|
|
|
@check_login
|
|
|
|
|
|
|
|
|
|
def mainhtml(req):
|
|
|
|
|
#计算一些数据
|
|
|
|
|
userid = req.session['userid']
|
|
|
|
@ -403,6 +403,7 @@ def login(req):
|
|
|
|
|
if user.exists():
|
|
|
|
|
if check_password(password,user[0].epassword):
|
|
|
|
|
req.session['userid'] = user[0].userid
|
|
|
|
|
req.session.set_expiry(60*40)
|
|
|
|
|
return redirect('index')
|
|
|
|
|
else:
|
|
|
|
|
msg = '密码错误'
|
|
|
|
@ -578,48 +579,53 @@ def getspr(ubp):
|
|
|
|
|
|
|
|
|
|
def getsprs(userid,ubp):
|
|
|
|
|
currentpart=ubp
|
|
|
|
|
a=getsprs_ubp2(userid,currentpart)
|
|
|
|
|
a=getsprs_ubp(userid,currentpart)
|
|
|
|
|
while a==False:
|
|
|
|
|
currentpart=currentpart.parentid #已找不到上级部门
|
|
|
|
|
if currentpart:
|
|
|
|
|
a=getsprs_ubp2(userid,currentpart)
|
|
|
|
|
a=getsprs_ubp(userid,currentpart)
|
|
|
|
|
else:
|
|
|
|
|
return User.objects.get(ubelongpart=currentpart,issuper=1)
|
|
|
|
|
return a
|
|
|
|
|
|
|
|
|
|
def getsprs_ubp(userid,ubp):
|
|
|
|
|
def getsprs_ubp(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.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
|
|
|
|
|
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 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):
|
|
|
|
@ -1355,7 +1361,7 @@ def getdickey(req):
|
|
|
|
|
if req.GET.get('dicclass')=='33':
|
|
|
|
|
for i in a:
|
|
|
|
|
objs = Operationspjd.objects.filter(zylx=Dickey.objects.get(dickeyid=i['dickeyid']),usecomp=Partment.objects.get(partid=companyid))
|
|
|
|
|
str='作业负责人-作业部门安全员-属地部门安全员'
|
|
|
|
|
str='作业负责人-作业部门-属地部门'
|
|
|
|
|
for x in objs:
|
|
|
|
|
str = str + '-' + x.jdmc
|
|
|
|
|
i['splcdetail'] = str
|
|
|
|
@ -1730,7 +1736,7 @@ def troublehandle(req):
|
|
|
|
|
a = a.filter(Q(zgbm__in=parts) | Q(fxbm__in=parts,zgbm=None))
|
|
|
|
|
total = a.count()
|
|
|
|
|
startnum,endnum=fenye(req)
|
|
|
|
|
obj = a.order_by('-xgsj')[startnum:endnum].values('troubleid','fxr__userid','fxr__name','yhms','yhzt','fxsj','tbsj','yhlb__dickeyname','todouser__name','yhpg__dickeyname','yhnum','yhdj__dickeyname','shresult','zgqx','yhtp','zghtp','todouser__userid')
|
|
|
|
|
obj = a.order_by('-fxsj')[startnum:endnum].values('troubleid','fxr__userid','fxr__name','yhms','yhzt','fxsj','tbsj','yhlb__dickeyname','todouser__name','yhpg__dickeyname','yhnum','yhdj__dickeyname','shresult','zgqx','yhtp','zghtp','todouser__userid')
|
|
|
|
|
return HttpResponse(transjson(total,obj),content_type="application/json")
|
|
|
|
|
elif a == 'listarea':
|
|
|
|
|
userid = req.session['userid']
|
|
|
|
@ -2581,7 +2587,7 @@ def pxhandle(req):
|
|
|
|
|
a = a.filter(starttime__lte=jssj)
|
|
|
|
|
total=a.count()
|
|
|
|
|
startnum,endnum=fenye(req)
|
|
|
|
|
obj=a.order_by('-modifytime')[startnum:endnum].values('trainnum','trainid','state','trainplace','starttime','trainname','traintype__dickeyname','teacher','lecturer__name','submituser__name','submituser__userid')
|
|
|
|
|
obj=a.order_by('-starttime')[startnum:endnum].values('trainnum','trainid','state','trainplace','starttime','trainname','traintype__dickeyname','teacher','lecturer__name','submituser__name','submituser__userid')
|
|
|
|
|
return HttpResponse(transjson(total,obj),content_type="application/json")
|
|
|
|
|
elif req.GET.get('a')=='detailhtml':
|
|
|
|
|
trainid = req.GET.get('trainid')
|
|
|
|
@ -2787,7 +2793,7 @@ def ylhandle(req):
|
|
|
|
|
a = a.filter(starttime__lte=jssj)
|
|
|
|
|
total=a.count()
|
|
|
|
|
startnum,endnum=fenye(req)
|
|
|
|
|
obj=a.order_by('-modifytime')[startnum:endnum].values('drillnum','drillid','state','drillplace','starttime','drillname','drilltype__dickeyname','chief__name','submituser__name','submituser__userid')
|
|
|
|
|
obj=a.order_by('-starttime')[startnum:endnum].values('drillnum','drillid','state','drillplace','starttime','drillname','drilltype__dickeyname','chief__name','submituser__name','submituser__userid')
|
|
|
|
|
return HttpResponse(transjson(total,a),content_type="application/json")
|
|
|
|
|
|
|
|
|
|
def gchandle(req):
|
|
|
|
@ -3901,7 +3907,7 @@ def apisuggest(req):
|
|
|
|
|
if req.GET.get('jssj'):
|
|
|
|
|
a = a.filter(submittime__lte=req.GET.get('jssj'))
|
|
|
|
|
total = a.count()
|
|
|
|
|
a = a[startnum:endnum].values('jyid','jylb__dickeyname','jyr__name','jybm__partname','dqxz','jynr','jynum','jyzt','todouser__userid','todouser__name','jyqy__name','jydd','submittime','accept')
|
|
|
|
|
a = a.order_by('-submittime')[startnum:endnum].values('jyid','jylb__dickeyname','jyr__name','jybm__partname','dqxz','jynr','jynum','jyzt','todouser__userid','todouser__name','jyqy__name','jydd','submittime','accept')
|
|
|
|
|
return HttpResponse(transjson(total,a),content_type="application/json")
|
|
|
|
|
elif a == 'exportexcel':
|
|
|
|
|
userid = req.session['userid']
|
|
|
|
@ -4359,6 +4365,7 @@ def apinotice(req):
|
|
|
|
|
|
|
|
|
|
def apioperation(req):
|
|
|
|
|
a = req.GET.get('a')
|
|
|
|
|
userid = req.session['userid']
|
|
|
|
|
if a == 'add':
|
|
|
|
|
userid = req.session['userid']
|
|
|
|
|
oneuser = User.objects.get(userid=userid)
|
|
|
|
@ -4382,9 +4389,9 @@ def apioperation(req):
|
|
|
|
|
obj.zyzt = {'zyzt':'确认中','index':0}
|
|
|
|
|
obj.save()
|
|
|
|
|
splc = []
|
|
|
|
|
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':[userid]})
|
|
|
|
|
splc.append({'jdmc':'作业部门审批','sprs':getsprs(userid,obj.zybm)})
|
|
|
|
|
splc.append({'jdmc':'属地部门审批','sprs':getsprs(userid,obj.sdbm)})
|
|
|
|
|
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
|
|
|
|
@ -4393,7 +4400,50 @@ def apioperation(req):
|
|
|
|
|
b=[]#发送通知
|
|
|
|
|
for i in data['zyry']:
|
|
|
|
|
x=User.objects.get(userid=i)
|
|
|
|
|
m = Operzyry(oper=obj,operzyry=x)
|
|
|
|
|
if int(userid)==int(i):#申请人包含作业人直接确认
|
|
|
|
|
m = Operzyry.objects.create(oper=obj,operzyry=x,checked=1)
|
|
|
|
|
if Operzyry.objects.filter(oper=obj,checked=0).exists():
|
|
|
|
|
pass
|
|
|
|
|
else:#工作人员全部确认
|
|
|
|
|
obj.zyzt['zyzt'] = '审批中'
|
|
|
|
|
obj.zyzt['index'] = 0
|
|
|
|
|
index = obj.zyzt['index']
|
|
|
|
|
sprs = [] #初始化审批人列表
|
|
|
|
|
if 'sprs' in obj.zyzt['splc'][index]:
|
|
|
|
|
sprs = obj.zyzt['splc'][index]['sprs']
|
|
|
|
|
else:
|
|
|
|
|
sprs = [obj.zyzt['splc'][index]['spr']]
|
|
|
|
|
jdmc = obj.zyzt['splc'][index]['jdmc']
|
|
|
|
|
obj.zyzt['jdmc'] = jdmc
|
|
|
|
|
obj.todousers = sprs
|
|
|
|
|
obj.save()
|
|
|
|
|
postdict={
|
|
|
|
|
'touser':'',
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
|
'miniprogram':{'appid':'wx5c39b569f01c27db'},
|
|
|
|
|
'data':{
|
|
|
|
|
'first':{
|
|
|
|
|
'value':obj.zylx.dickeyname + '作业审批,审批节点:' + obj.zyzt['jdmc']
|
|
|
|
|
},
|
|
|
|
|
'keyword1':{
|
|
|
|
|
'value':obj.zynr
|
|
|
|
|
},
|
|
|
|
|
'keyword2':{
|
|
|
|
|
'value':obj.kssj
|
|
|
|
|
},
|
|
|
|
|
'keyword3':{
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'请您及时完成审批!'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tolist = list(User.objects.filter(userid__in=sprs).values_list('openid',flat=True))
|
|
|
|
|
send_wechatmsgs.delay(postdict,tolist)
|
|
|
|
|
return JsonResponse({"code":1})
|
|
|
|
|
else:
|
|
|
|
|
m = Operzyry.objects.create(oper=obj,operzyry=x)
|
|
|
|
|
m.save()
|
|
|
|
|
b.append(x.openid)
|
|
|
|
|
|
|
|
|
@ -4466,6 +4516,8 @@ def apioperation(req):
|
|
|
|
|
zyid=req.GET.get('zyid')
|
|
|
|
|
a = Operation.objects.filter(zyid=zyid)
|
|
|
|
|
x = a.values('zyid','zydd','zylx__dickeyname','zynum','zyfzr__name','zynr','zyzt','zyimg','submittime','zybm__partname','sdbm__partname','kssj','jssj','fxcs','zyimg2')[0]
|
|
|
|
|
for i in x['zyzt']['splc']:
|
|
|
|
|
i['sprs'] = ','.join(list(User.objects.filter(userid__in=i['sprs']).values_list('name',flat=True)))
|
|
|
|
|
if x['zyimg']!='':
|
|
|
|
|
x['zyimg'] = x['zyimg'].split('?')
|
|
|
|
|
else:
|
|
|
|
@ -4476,8 +4528,10 @@ def apioperation(req):
|
|
|
|
|
x['zyimg2']=[]
|
|
|
|
|
x['fxcs'] = list(Fxcs.objects.filter(id__in=x['fxcs'].split('?')).values('id','fxfx','aqcs','cslx'))
|
|
|
|
|
#确认详情
|
|
|
|
|
qrxq = Operzyry.objects.filter(oper=Operation.objects.get(zyid=zyid)).values('operzyry__name','checked')
|
|
|
|
|
qrxqobjs = Operzyry.objects.filter(oper=Operation.objects.get(zyid=zyid))
|
|
|
|
|
qrxq = qrxqobjs.values('operzyry__name','checked')
|
|
|
|
|
x['qrxq'] = list(qrxq)
|
|
|
|
|
x['zyry'] = ','.join(list(qrxqobjs.values_list('operzyry__name',flat=True)))
|
|
|
|
|
#审批详情
|
|
|
|
|
spxq = Operspxq.objects.filter(oper=Operation.objects.get(zyid=zyid)).order_by('submittime').values('jdmc','spbm__partname','spr__name','submittime','checked')
|
|
|
|
|
x['spxq'] = list(spxq)
|
|
|
|
@ -4490,124 +4544,117 @@ def apioperation(req):
|
|
|
|
|
userid = req.session['userid']
|
|
|
|
|
data = json.loads(req.body.decode('utf-8'))
|
|
|
|
|
zyid = data['zyid']
|
|
|
|
|
obj = Operation.objects.get(zyid=zyid)
|
|
|
|
|
Operzyry.objects.filter(oper__zyid=zyid,operzyry__userid=userid).update(checked=1)
|
|
|
|
|
if Operzyry.objects.filter(oper__zyid=zyid,checked=0).exists():
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
obj = Operation.objects.get(zyid=zyid)
|
|
|
|
|
else:#工作人员全部确认
|
|
|
|
|
nowzt = obj.zyzt
|
|
|
|
|
obj.zyzt['zyzt'] = '审批中'
|
|
|
|
|
obj.zyzt['index'] = 0
|
|
|
|
|
index = obj.zyzt['index']
|
|
|
|
|
obj.zyzt['jdmc'] = obj.zyzt['splc'][index]['jdmc']
|
|
|
|
|
spruser = User.objects.get(userid=userid)
|
|
|
|
|
sprs = [] #初始化审批人列表
|
|
|
|
|
if 'sprs' in obj.zyzt['splc'][index]:
|
|
|
|
|
sprs = obj.zyzt['splc'][index]['sprs']
|
|
|
|
|
else:
|
|
|
|
|
sprs = [obj.zyzt['splc'][index]['spr']]
|
|
|
|
|
jdmc = obj.zyzt['splc'][index]['jdmc']
|
|
|
|
|
obj.zyzt['jdmc'] = jdmc
|
|
|
|
|
obj.todousers = sprs
|
|
|
|
|
obj.save()
|
|
|
|
|
postdict={
|
|
|
|
|
'touser':'',
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
|
'miniprogram':{'appid':'wx5c39b569f01c27db'},
|
|
|
|
|
'data':{
|
|
|
|
|
'first':{
|
|
|
|
|
'value':obj.zylx.dickeyname + '作业审批,审批节点:' + obj.zyzt['jdmc']
|
|
|
|
|
},
|
|
|
|
|
'keyword1':{
|
|
|
|
|
'value':obj.zynr
|
|
|
|
|
},
|
|
|
|
|
'keyword2':{
|
|
|
|
|
'value':obj.kssj
|
|
|
|
|
},
|
|
|
|
|
'keyword3':{
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'请您及时完成审批!'
|
|
|
|
|
'touser':'',
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
|
'miniprogram':{'appid':'wx5c39b569f01c27db'},
|
|
|
|
|
'data':{
|
|
|
|
|
'first':{
|
|
|
|
|
'value':obj.zylx.dickeyname + '作业审批,审批节点:' + obj.zyzt['jdmc']
|
|
|
|
|
},
|
|
|
|
|
'keyword1':{
|
|
|
|
|
'value':obj.zynr
|
|
|
|
|
},
|
|
|
|
|
'keyword2':{
|
|
|
|
|
'value':obj.kssj
|
|
|
|
|
},
|
|
|
|
|
'keyword3':{
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'请您及时完成审批!'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tolist = list(User.objects.filter(userid__in=sprs).values_list('openid',flat=True))
|
|
|
|
|
send_wechatmsgs.delay(postdict,tolist)
|
|
|
|
|
return JsonResponse({"code":1})
|
|
|
|
|
return JsonResponse({"code":1})
|
|
|
|
|
elif a == 'spzy':
|
|
|
|
|
userid = req.session['userid']
|
|
|
|
|
data = json.loads(req.body.decode('utf-8'))
|
|
|
|
|
zyid = data['zyid']
|
|
|
|
|
obj = Operation.objects.get(zyid=zyid)
|
|
|
|
|
oldtodo = obj.todousers
|
|
|
|
|
oldjdmc = obj.zyzt['jdmc']
|
|
|
|
|
oldindex = obj.zyzt['index']
|
|
|
|
|
nextindex = obj.zyzt['index']+1
|
|
|
|
|
spruser = User.objects.get(userid=userid)
|
|
|
|
|
if 'zzsp' in data:#关闭审批
|
|
|
|
|
obj.zyzt['zyzt'] = '待关闭'
|
|
|
|
|
obj.zyzt['jdmc'] = ''
|
|
|
|
|
obj.todouser = obj.zyfzr
|
|
|
|
|
obj.todousers = None
|
|
|
|
|
obj.save()
|
|
|
|
|
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
|
|
|
|
postdict={
|
|
|
|
|
'touser':obj.zyfzr.openid,
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
|
"miniprogram":{"appid":"wx5c39b569f01c27db"},
|
|
|
|
|
'data':{
|
|
|
|
|
'first':{
|
|
|
|
|
'value':obj.zylx.dickeyname + '作业审批通过:'
|
|
|
|
|
},
|
|
|
|
|
'keyword1':{
|
|
|
|
|
'value':obj.zynr
|
|
|
|
|
},
|
|
|
|
|
'keyword2':{
|
|
|
|
|
'value':obj.kssj
|
|
|
|
|
},
|
|
|
|
|
'keyword3':{
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'你是作业负责人,可以开始作业,作业完成请及时关闭!'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
send_wechatmsg.delay(postdict)
|
|
|
|
|
return JsonResponse({"code":1})
|
|
|
|
|
if 'zjsp' in data:#转交审批
|
|
|
|
|
newsprs = data['newsprs']#新审批人
|
|
|
|
|
obj.todousers = newsprs
|
|
|
|
|
obj.save()
|
|
|
|
|
postdict={
|
|
|
|
|
'touser':'',
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
|
'miniprogram':{'appid':'wx5c39b569f01c27db'},
|
|
|
|
|
'data':{
|
|
|
|
|
'first':{
|
|
|
|
|
'value':obj.zylx.dickeyname + '作业审批,审批节点:' + obj.zyzt['jdmc']
|
|
|
|
|
},
|
|
|
|
|
'keyword1':{
|
|
|
|
|
'value':obj.zynr
|
|
|
|
|
},
|
|
|
|
|
'keyword2':{
|
|
|
|
|
'value':obj.kssj
|
|
|
|
|
},
|
|
|
|
|
'keyword3':{
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'请您及时完成审批!'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tolist = list(User.objects.filter(userid__in=newsprs).values_list('openid',flat=True))
|
|
|
|
|
send_wechatmsgs.delay(postdict,tolist)
|
|
|
|
|
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=2,spbm=spruser.ubelongpart)
|
|
|
|
|
return JsonResponse({"code":1})
|
|
|
|
|
try:
|
|
|
|
|
if oldindex == 0:
|
|
|
|
|
Operspxq.objects.create(oper=obj,jdmc=obj.zyzt['splc'][0]['jdmc'],spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
|
|
|
|
spr1 = data['spr1'] if 'spr1' in data else None
|
|
|
|
|
spr2 = data['spr2'] if 'spr2' in data else None
|
|
|
|
|
if spr1:
|
|
|
|
|
obj.zyzt['splc'][1]['sprs'] = [spr1] #作业部门审批人
|
|
|
|
|
if spr2:
|
|
|
|
|
obj.zyzt['splc'][2]['sprs'] = [spr2] #属地部门审批人
|
|
|
|
|
while nextindex<len(obj.zyzt['splc']):
|
|
|
|
|
nextsplc = obj.zyzt['splc'][nextindex]
|
|
|
|
|
obj.zyzt['zyzt'] = '审批中'
|
|
|
|
|
if userid in nextsplc['sprs']:#本人可审批直接跳过
|
|
|
|
|
Operspxq.objects.create(oper=obj,jdmc=nextsplc['jdmc'],spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
|
|
|
|
else:
|
|
|
|
|
obj.zyzt['zyzt'] = '审批中'
|
|
|
|
|
obj.zyzt['index'] = nextindex
|
|
|
|
|
obj.zyzt['jdmc'] = nextsplc['jdmc']
|
|
|
|
|
obj.todousers = nextsplc['sprs']
|
|
|
|
|
obj.save()
|
|
|
|
|
tolist = list(User.objects.filter(userid__in=nextsplc['sprs']).values_list('openid',flat=True))
|
|
|
|
|
toliststr = ','.join(list(User.objects.filter(userid__in=nextsplc['sprs']).values_list('name',flat=True)))
|
|
|
|
|
postdict={
|
|
|
|
|
'touser':'',
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
|
'miniprogram':{'appid':'wx5c39b569f01c27db'},
|
|
|
|
|
'data':{
|
|
|
|
|
'first':{
|
|
|
|
|
'value':obj.zylx.dickeyname + '作业审批,审批节点:' + obj.zyzt['jdmc']
|
|
|
|
|
},
|
|
|
|
|
'keyword1':{
|
|
|
|
|
'value':obj.zynr
|
|
|
|
|
},
|
|
|
|
|
'keyword2':{
|
|
|
|
|
'value':obj.kssj
|
|
|
|
|
},
|
|
|
|
|
'keyword3':{
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'请您及时完成审批!可审批人:'+toliststr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
send_wechatmsgs.delay(postdict,tolist)
|
|
|
|
|
return JsonResponse({"code":1})
|
|
|
|
|
nextindex = nextindex + 1
|
|
|
|
|
if 'zjsp' in data:#转交上级审批
|
|
|
|
|
if spruser.ubelongpart.parentid:
|
|
|
|
|
newsprs = getsprs(userid,spruser.ubelongpart.parentid)
|
|
|
|
|
else:
|
|
|
|
|
newsprs = getsprs(userid,spruser.usecomp)
|
|
|
|
|
#newsprs = data['newsprs']#新审批人
|
|
|
|
|
obj.zyzt['jdmc'] = '上级审批'
|
|
|
|
|
obj.zyzt['index'] = nextindex
|
|
|
|
|
obj.zyzt['jdmc'] = nextsplc['jdmc']
|
|
|
|
|
obj.todousers = nextsplc['sprs']
|
|
|
|
|
obj.todousers = newsprs
|
|
|
|
|
obj.zyzt['splc'].insert(nextindex,{'jdmc':'上级审批','sprs':newsprs})
|
|
|
|
|
obj.save()
|
|
|
|
|
tolist = list(User.objects.filter(userid__in=newsprs).values_list('openid',flat=True))
|
|
|
|
|
toliststr = ','.join(list(User.objects.filter(userid__in=newsprs).values_list('name',flat=True)))
|
|
|
|
|
postdict={
|
|
|
|
|
'touser':'',
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
@ -4626,44 +4673,43 @@ def apioperation(req):
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'请您及时完成审批!'
|
|
|
|
|
'value':'请您及时完成审批!可审批人:'+toliststr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tolist = list(User.objects.filter(userid__in=nextsplc['sprs']).values_list('openid',flat=True))
|
|
|
|
|
send_wechatmsgs.delay(postdict,tolist)
|
|
|
|
|
|
|
|
|
|
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
|
|
|
|
except :
|
|
|
|
|
obj.zyzt['zyzt'] = '待关闭'
|
|
|
|
|
obj.zyzt['jdmc'] = ''
|
|
|
|
|
obj.todouser = None
|
|
|
|
|
obj.todousers = [obj.zyfzr.userid]
|
|
|
|
|
obj.save()
|
|
|
|
|
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
|
|
|
|
postdict={
|
|
|
|
|
'touser':obj.zyfzr.openid,
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
|
'miniprogram':{'appid':'wx5c39b569f01c27db'},
|
|
|
|
|
'data':{
|
|
|
|
|
'first':{
|
|
|
|
|
'value':obj.zylx.dickeyname + '作业审批通过:'
|
|
|
|
|
},
|
|
|
|
|
'keyword1':{
|
|
|
|
|
'value':obj.zynr
|
|
|
|
|
},
|
|
|
|
|
'keyword2':{
|
|
|
|
|
'value':obj.kssj
|
|
|
|
|
},
|
|
|
|
|
'keyword3':{
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'你是作业负责人,可以开始作业,作业完成请及时关闭!'
|
|
|
|
|
}
|
|
|
|
|
Operspxq.objects.create(oper=obj,jdmc=obj.zyzt['splc'][nextindex-1]['jdmc'],spr=spruser,checked=2,spbm=spruser.ubelongpart)
|
|
|
|
|
return JsonResponse({"code":1})
|
|
|
|
|
obj.zyzt['zyzt'] = '待关闭'
|
|
|
|
|
obj.zyzt['jdmc'] = ''
|
|
|
|
|
obj.zyzt['index'] = nextindex
|
|
|
|
|
obj.todouser = None
|
|
|
|
|
obj.todousers = [obj.zyfzr.userid]
|
|
|
|
|
obj.save()
|
|
|
|
|
postdict={
|
|
|
|
|
'touser':obj.zyfzr.openid,
|
|
|
|
|
'template_id':'lOuwSE67vZC3ZVFYPZvz2eb7JdFxqx7ysMFkXrYmYh0',
|
|
|
|
|
'miniprogram':{'appid':'wx5c39b569f01c27db'},
|
|
|
|
|
'data':{
|
|
|
|
|
'first':{
|
|
|
|
|
'value':obj.zylx.dickeyname + '作业审批通过:'
|
|
|
|
|
},
|
|
|
|
|
'keyword1':{
|
|
|
|
|
'value':obj.zynr
|
|
|
|
|
},
|
|
|
|
|
'keyword2':{
|
|
|
|
|
'value':obj.kssj
|
|
|
|
|
},
|
|
|
|
|
'keyword3':{
|
|
|
|
|
'value':obj.zydd
|
|
|
|
|
},
|
|
|
|
|
'remark':{
|
|
|
|
|
'value':'你是作业负责人,可以开始作业,作业完成请及时关闭!'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
send_wechatmsg.delay(postdict)
|
|
|
|
|
}
|
|
|
|
|
Operspxq.objects.create(oper=obj,jdmc=obj.zyzt['splc'][nextindex-1]['jdmc'],spr=spruser,checked=1,spbm=spruser.ubelongpart)
|
|
|
|
|
send_wechatmsg.delay(postdict)
|
|
|
|
|
return JsonResponse({"code":1})
|
|
|
|
|
elif a == 'gbzy':#关闭作业
|
|
|
|
|
data = json.loads(req.body.decode('utf-8'))
|
|
|
|
@ -5551,7 +5597,7 @@ def apiinspect(req):
|
|
|
|
|
a = a.filter(state=state)
|
|
|
|
|
total=a.count()
|
|
|
|
|
startnum,endnum=fenye(req)
|
|
|
|
|
a = a.order_by('-id')[startnum:endnum].values('id','state','content','creattime','equipment__num','equipment__name','equipment__area__name','user__name','user__ubelongpart__partname','trouble__yhzt','trouble__yhnum','trouble__yhms')
|
|
|
|
|
a = a.order_by('-creattime')[startnum:endnum].values('id','state','content','creattime','equipment__num','equipment__name','equipment__area__name','user__name','user__ubelongpart__partname','trouble__yhzt','trouble__yhnum','trouble__yhms')
|
|
|
|
|
return HttpResponse(transjson(total,a),content_type="application/json")
|
|
|
|
|
elif a == 'exportexcel':
|
|
|
|
|
objs = Inspect.objects.filter(usecomp__partid=companyid)
|
|
|
|
|