作业审批

This commit is contained in:
caoqianming 2019-10-10 16:02:06 +08:00
parent 47310b5d5f
commit af81fbf1d0
10 changed files with 96 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@ -32,6 +32,17 @@ function canvasDataURL(path, obj, callback) {
scale = w / h;
w = obj.width || w;
h = obj.height || (w / scale);
if(w <= h ){
if(w>640){
w = 640
h = w/scale
}
}else{
if(h>640){
h=640
w = h*scale
}
}
var quality = 0.7; // 默认图片质量为0.7
//生成canvas
var canvas = document.createElement('canvas');
@ -45,9 +56,9 @@ function canvasDataURL(path, obj, callback) {
canvas.setAttributeNode(anh);
ctx.drawImage(that, 0, 0, w, h);
// 图像质量
if (obj.quality && obj.quality <= 1 && obj.quality > 0) {
quality = obj.quality;
}
// if (obj.quality && obj.quality <= 1 && obj.quality > 0) {
// quality = obj.quality;
// }
// quality值越小所绘制出的图像越模糊
var base64 = canvas.toDataURL('image/jpeg', quality);
// 回调函数返回base64的值
@ -62,7 +73,6 @@ function convertBase64UrlToBlob(urlData) {
}
return new Blob([u8arr], { type: mime });
}
//取消上传
function cancleUploadFile() {

View File

@ -301,7 +301,16 @@
$("#yhms").textbox('disable');
$('#fcyjdiv,#file2,#zgxq,#shyjdiv,#csyj,#reject').hide(); $('#jxpg').show();
$("#yhpg").combobox({ url: 'getdickey?dicclass=19&a=combobox', });
$("#zgbm").combotree({ url: 'parthandle?a=tree3', onSelect: function (node) { $('#zgr').combobox({ url: 'getuser?partid=' + node.id + '&a=combobox', }); } });
$("#zgbm").combotree({ url: 'parthandle?a=tree3', onSelect: function (node) {
$('#zgr').combobox({
url: 'getuser?partid=' + node.id + '&a=combobox',
editable: false,
filter: function (q, row) {
var opts = $(this).combobox('options');
return row[opts.textField].indexOf(q) >= 0;//这里改成>=即可在任意地方匹配
},
});
} });
// if (data.yhpg__dickeyname != '' & data.yhpg__dickeyname != null) {
// $("#yhpg").combobox('setValue', data.yhpg__dickeyid).combobox('readonly');
// $("#yhlx").combobox({ url: 'getdicclass?dicid=15' }).combobox('setValue', data.yhlx__dicid).combobox('readonly');

View File

@ -219,9 +219,7 @@
var form = new FormData();
if (fileObj.size / 1024 > 500) { //大于500k进行压缩上传
$("#file").after('<span id="tip" style="color:blue">图片大于500k,正在压缩...</span>');
photoCompress(fileObj, {
quality: 0.2
}, function (base64Codes) {
photoCompress(fileObj, {}, function (base64Codes) {
//console.log("压缩后:" + base.length / 1024 + " " + base);
var bl = convertBase64UrlToBlob(base64Codes);
form.append("upfile", bl, fileObj.name); // 文件对象
@ -310,9 +308,7 @@
var form = new FormData();
if (fileObj.size / 1024 > 500) { //大于500k进行压缩上传
$("#file2").after('<span id="tip" style="color:blue">图片大于500k,正在压缩...</span>');
photoCompress(fileObj, {
quality: 0.2
}, function (base64Codes) {
photoCompress(fileObj, {}, function (base64Codes) {//quality: 0.2
//console.log("压缩后:" + base.length / 1024 + " " + base);
var bl = convertBase64UrlToBlob(base64Codes);
form.append("upfile", bl, fileObj.name); // 文件对象

View File

@ -263,7 +263,7 @@ float: left;">
<div style="width:70%;float:left;height:100%;margin-top: 10px;" align=center>
<div style="margin-left:10px;margin-right: 10px">
<div id="panelx" class="easyui-panel" title="各指标数量趋势" data-options="iconCls:'fa-bar-chart',closable:true,
<div class="easyui-panel" title="各指标数量趋势" data-options="iconCls:'fa-bar-chart',closable:true,
collapsible:true,"
align=center style="height:100%">
<div id='gzbqst' style="width:90%;height:500px;"></div>
@ -326,6 +326,12 @@ float: left;">
</div>
<div style="width:100%;height:800px">
<div id="panelx" class="easyui-panel" data-options="iconCls:'fa-bar-chart'" >
</div>
</div>
<script type="text/javascript">
//首页总数统计
$.ajax({
@ -372,13 +378,12 @@ float: left;">
<script>
var data=JSON.parse(localStorage.getItem("data"));
bindmap9('gzbqst')
if(data.rights.indexOf('30')!=-1){ //有无地图功能
$('#panelx').panel({
href:'html/mapshow',
title:'地图展示'
})
}else{
bindmap9('gzbqst')
}
$("#sfxbm").combotree({
url: 'parthandle?a=tree',

View File

@ -72,6 +72,10 @@
<input id="B" class="easyui-textbox" name="B" style="width:480px;" data-options="label:'选项B'," value="错" editable=false/>
<input name="right" type="radio" value="B" />
</div>
<div style="margin-top:5px;margin-bottom:5px">
<input id="resolution" class="easyui-textbox" name="resolution" style="width:480px;height:80px"
data-options="label:'解析',multiline:true" />
</div>
</form>
</div>
</div>

View File

@ -93,6 +93,7 @@
//$('#station').combobox('setValue',res.station__groupid)
$('#label').textbox('setValue',res.label)
$('#title').textbox('setValue',res.title)
$('#resolution').textbox('setValue',res.resolution)
for(var key in res.answer){
$('#'+key).textbox('setValue',res.answer[key])
}

View File

@ -106,6 +106,7 @@
//$('#station').combobox('setValue',res.station__groupid)
$('#label').textbox('setValue',res.label)
$('#title').textbox('setValue',res.title)
$('#resolution').textbox('setValue',res.resolution)
for(var key in res.answer){
$('#'+key).textbox('setValue',res.answer[key])
}

View File

@ -72,6 +72,10 @@
<input id="B" class="easyui-textbox" name="B" style="width:480px;" data-options="label:'选项B'," value="错" editable=false/>
<input id="Bcheck" name="right" type="radio" value="B" />
</div>
<div style="margin-top:5px;margin-bottom:5px">
<input id="resolution" class="easyui-textbox" name="resolution" style="width:480px;height:80px"
data-options="label:'解析',multiline:true" />
</div>
</form>
</div>
</div>
@ -83,6 +87,7 @@
// $('#station').combobox('setValue',res.station__groupid)
$('#label').textbox('setValue',res.label)
$('#title').textbox('setValue',res.title)
$('#resolution').textbox('setValue',res.resolution)
for(var key in res.answer){
$('#'+key).textbox('setValue',res.answer[key])
}

View File

@ -493,6 +493,11 @@ def getsprs(ubp):
def getsprs_ubp(ubp):
a=ubp
if a.aqy !=',':
aqystr = a.aqy
aqylist = aqystr.split(',')
aqylist = list(map(int, list(filter(None, aqylist))))
return aqylist
if a.bmzg !=',':
zgstr = a.bmzg
zglist = zgstr.split(',')
@ -3401,19 +3406,19 @@ def apipartuser(req):
if req.GET.get('parentid')=='company':
lst=[]
company = User.objects.get(userid=userid).usecomp
partobjs = Partment.objects.filter(parentid=company)
partobjs = Partment.objects.filter(parentid=company,deletemark=1)
for i in partobjs:
lst.append({'id':i.partid,'name':i.partname,'parentId':0,'checked':False,'isPeople':False,'children':[]})
userobjs = User.objects.filter(ubelongpart=company).exclude(issuper=1)
userobjs = User.objects.filter(ubelongpart=company,deletemark=1).exclude(issuper=1)
for i in userobjs:
lst.append({'id':i.userid,'name':i.name,'parentId':0,'checked':False,'isPeople':True,'children':[]})
return JsonResponse({"code":1,"data":lst})
else:
lst=[]
partobjs = Partment.objects.filter(parentid=req.GET.get('parentid'))
partobjs = Partment.objects.filter(parentid=req.GET.get('parentid'),deletemark=1)
for i in partobjs:
lst.append({'id':i.partid,'name':i.partname,'parentId':0,'checked':False,'isPeople':False,'children':[]})
userobjs = User.objects.filter(ubelongpart=req.GET.get('parentid')).exclude(issuper=1)
userobjs = User.objects.filter(ubelongpart=req.GET.get('parentid'),deletemark=1).exclude(issuper=1)
for i in userobjs:
lst.append({'id':i.userid,'name':i.name,'parentId':0,'checked':False,'isPeople':True,'children':[]})
return JsonResponse({"code":1,"data":lst})
@ -4111,7 +4116,8 @@ def apioperation(req):
return res
elif a == 'qrzy':
userid = req.session['userid']
zyid = req.POST.get('zyid')
data = json.loads(req.body.decode('utf-8'))
zyid = data['zyid']
Operzyry.objects.filter(oper__zyid=zyid,operzyry__userid=userid).update(checked=1)
if Operzyry.objects.filter(oper__zyid=zyid,checked=0).exists():
pass
@ -4122,7 +4128,10 @@ def apioperation(req):
obj.zyzt['index'] = 0
index = obj.zyzt['index']
obj.zyzt['jdmc'] = obj.zyzt['splc'][index]['jdmc']
sprs = obj.zyzt['splc'][index]['sprs']
if 'sprs' in obj.zyzt['splc'][index]:
sprs = obj.zyzt['splc'][index]['sprs']
else:
sprs = [obj.zyzt['splc'][index]['spr']]
obj.todousers = sprs
obj.save()
for i in sprs:
@ -4151,13 +4160,14 @@ def apioperation(req):
return JsonResponse({"code":1})
elif a == 'spzy':
userid = req.session['userid']
zyid = req.POST.get('zyid')
data = json.loads(req.body.decode('utf-8'))
zyid = data['zyid']
obj = Operation.objects.get(zyid=zyid)
oldtodo = obj.todousers
oldjdmc = obj.zyzt['jdmc']
nextindex = obj.zyzt['index']+1
spruser = User.objects.get(userid=userid)
if req.POST.get('zzsp',None):
if 'zzsp' in data:
obj.zyzt['zyzt'] = '待关闭'
obj.todouser = obj.zyfzr
obj.todousers = None
@ -4186,6 +4196,35 @@ def apioperation(req):
}
send_wechatmsg.delay(postdict)
return JsonResponse({"code":1})
if 'zjsp' in data:
newsprs = data['newsprs']#新审批人
obj.todousers = newsprs
obj.save()
for i in newsprs:
postdict={
'touser':'',
'template_id':User.objects.get(userid=i).openid,
'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=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=2,spbm=spruser.ubelongpart)
return JsonResponse({"code":1})
try:
nextsplc = obj.zyzt['splc'][nextindex]
obj.zyzt['zyzt'] = '审批中'
@ -4220,8 +4259,8 @@ def apioperation(req):
Operspxq.objects.create(oper=Operation.objects.get(zyid=zyid),jdmc=oldjdmc,spr=spruser,checked=1,spbm=spruser.ubelongpart)
except :
obj.zyzt['zyzt'] = '待关闭'
obj.todouser = obj.zyfzr
obj.todousers = None
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={
@ -4256,6 +4295,7 @@ def apioperation(req):
obj.zyimg2 = '?'.join(zyimg2)
obj.zyzt['zyzt']='已关闭'
obj.todouser = None
obj.todousers = None
obj.save()
return JsonResponse({"code":1})
elif a == 'todonum':