xiugairenwu
This commit is contained in:
parent
d50c6c8a21
commit
74e54e7140
|
@ -468,6 +468,46 @@ def exportxlsx(a,objs):
|
|||
res['Content-Disposition'] = 'attachment;filename='+filename+'.xlsx'
|
||||
res.write(output.getvalue())
|
||||
return res
|
||||
elif a=='grpxjl':
|
||||
#查询数据
|
||||
wslist = objs.values('train__trainnum', 'train__trainid', 'train__state', 'train__trainplace', 'train__starttime', 'train__trainname',
|
||||
'train__teacher', 'train__lecturer__name', 'participant__name', 'participant__name', 'checked', 'train__duration', 'examtestdetail')
|
||||
#写入数据
|
||||
wb = load_workbook(dirname + 'safesite/exportemp/grpxjl.xlsx')
|
||||
sheet = wb.active
|
||||
x=3
|
||||
for i in wslist:
|
||||
num = str(x)
|
||||
sheet['a'+num] = i['participant__name']
|
||||
sheet['b'+num] = i['train__trainnum']
|
||||
if i['train__state']==0:
|
||||
|
||||
sheet['c'+num] = "待评估"
|
||||
else:
|
||||
sheet['c'+num] = "已评估"
|
||||
sheet['d'+num] = i['train__trainname']
|
||||
sheet['e'+num] = i['train__trainplace']
|
||||
sheet['f'+num] = i['train__starttime']
|
||||
sheet['g'+num] = i['train__duration']
|
||||
if i['checked']==0:
|
||||
|
||||
sheet['h'+num] = "未微信签到"
|
||||
else:
|
||||
sheet['h'+num] = "已微信签到"
|
||||
|
||||
sheet['i'+num] = i['train__teacher']
|
||||
|
||||
x = x + 1
|
||||
nowtime = datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
sheet['b1'] = nowtime
|
||||
filename = 'WSS' + nowtime
|
||||
output = BytesIO()
|
||||
wb.save(output)
|
||||
output.seek(0)
|
||||
res = HttpResponse(content_type='application/vnd.ms-excel')
|
||||
res['Content-Disposition'] = 'attachment;filename='+filename+'.xlsx'
|
||||
res.write(output.getvalue())
|
||||
return res
|
||||
elif a=='jy':
|
||||
#查询数据
|
||||
jylist = objs.values('jynum','jylb__dickeyname','jyr__name','jybm__partname','dqxz','jynr','qwxg','submittime','jyimg','jyimg2','pgr__name','clr__name','jyfk','clcs','clms')
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,113 @@
|
|||
<div class="easyui-layout" id="result" style="width:100%;height:100%"></div>
|
||||
<script type="text/html" id="text">
|
||||
{% verbatim %}
|
||||
<div id='southdiv' data-options="region:'south'" style="height:50px;text-align:center;padding:5px">
|
||||
|
||||
<a iconCls="fa-close" class="easyui-linkbutton" onclick="closeForm()">关闭</a>
|
||||
</div>
|
||||
|
||||
<div data-options="region:'center'" style="height:100%;padding:15px 15px;">
|
||||
<div style="text-align:center;font-size: 24px;font-weight: bold;margin-bottom: 20px;">任务名:{{checktaskname}}</div>
|
||||
<table class='detailtable' style="text-align:center;">
|
||||
|
||||
<tr>
|
||||
<td style="font-weight: bold;">检查表名:</td>
|
||||
<td>{{checktype__checktitle}}</td>
|
||||
<td style="font-weight: bold;">检查时间:</td>
|
||||
<td>{{checktime| dateFormat 'yyyy-MM-dd hh:mm:ss'}}</td>
|
||||
|
||||
</tr>
|
||||
<tr style="height:80px">
|
||||
<td style="font-weight: bold;">检查内容:</td>
|
||||
<td colspan="3">{{checktype__checkcontent}}</td>
|
||||
</tr>
|
||||
<tr style="height:80px">
|
||||
<td style="font-weight: bold;">检查人员:</td>
|
||||
<td colspan="3">{{bcfr}}</td>
|
||||
</tr>
|
||||
<tr style="height:80px">
|
||||
<td style="font-weight: bold;">执行情况:</td>
|
||||
<td >{{zxstate==1?'同时执行':'单人执行'}}</td>
|
||||
|
||||
|
||||
<td style="font-weight: bold;">排查频率:</td>
|
||||
{{if tasktype==1}}
|
||||
<td >每天一次</td>
|
||||
{{else if tasktype==2}}
|
||||
<td>每周一次</td>
|
||||
{{else if tasktype==3}}
|
||||
<td>每月一次</td>
|
||||
{{else if tasktype==4}}
|
||||
<td>每季度一次</td>
|
||||
{{else if tasktype==5}}
|
||||
<td>每半年一次</td>
|
||||
{{else if tasktype==6}}
|
||||
<td>每年一次</td>
|
||||
{{/if}}
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
|
||||
<td style="font-weight: bold;">检查地点:</td>
|
||||
<td colspan="3">{{checkplace}}</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
{% endverbatim %}
|
||||
</script>
|
||||
<script type="text/javascript" src="/static/safesite/mystatic/js/template-web.js"></script>
|
||||
<script>
|
||||
var html;
|
||||
var state;
|
||||
var id = {{ id }};
|
||||
template.defaults.imports.dateFormat = function (date, format) {
|
||||
date = new Date(date);
|
||||
var map = {
|
||||
"M": date.getMonth() + 1, //月份
|
||||
"d": date.getDate(), //日
|
||||
"h": date.getHours(), //小时
|
||||
"m": date.getMinutes(), //分
|
||||
"s": date.getSeconds(), //秒
|
||||
"q": Math.floor((date.getMonth() + 3) / 3), //季度
|
||||
"S": date.getMilliseconds() //毫秒
|
||||
};
|
||||
format = format.replace(/([yMdhmsqS])+/g, function (all, t) {
|
||||
var v = map[t];
|
||||
if (v !== undefined) {
|
||||
if (all.length > 1) {
|
||||
v = '0' + v;
|
||||
v = v.substr(v.length - 2);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
else if (t === 'y') {
|
||||
return (date.getFullYear() + '').substr(4 - all.length);
|
||||
}
|
||||
return all;
|
||||
});
|
||||
return format;
|
||||
};
|
||||
template.defaults.imports.gfilename = function(value){
|
||||
x = value.split('/').pop();
|
||||
return x;
|
||||
}
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "api/checkproject?a=checkdetail",
|
||||
data: { id: id },
|
||||
async: false, // ajax同步使用false
|
||||
success: function (data) {
|
||||
html = template('text', data);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#result').html(html);
|
||||
|
||||
</script>
|
|
@ -64,8 +64,8 @@
|
|||
field: 'taskstate', title: '检查状态', width: 100, formatter: function (value, row, index) {
|
||||
|
||||
switch (value) {
|
||||
case 1: return '正在检查'; break;
|
||||
case 2: return '检查完毕'; break;
|
||||
case 1: return '正在整改中'; break;
|
||||
case 2: return '已整改完成'; break;
|
||||
case 3: return '任务关闭'; break;
|
||||
}
|
||||
}, styler: function (value, row, index) {
|
||||
|
|
|
@ -75,8 +75,8 @@
|
|||
<td>检查状态:</td>
|
||||
<td>
|
||||
|
||||
<input type="radio" name="taskstate" value="2">检查完成</input>
|
||||
<input type="radio" name="taskstate" value="1">正在检查</input>
|
||||
<input type="radio" name="taskstate" value="2">已整改完成</input>
|
||||
<input type="radio" name="taskstate" value="1">正在整改中</input>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td style="font-weight: bold;">验收人:</td>
|
||||
<td>{{yanshouren__username}}</td>
|
||||
<td>{{yanshouren__name}}</td>
|
||||
|
||||
<td style="font-weight: bold;">验收时间:</td>
|
||||
<td>{{yanshou}}</td>
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
<a id="addtask" class="easyui-linkbutton" onclick="addcheckrw()" data-options="iconCls: 'fa-plus',plain:true">发布任务</a>
|
||||
{% endif %}
|
||||
|
||||
<!-- <a id="delprg" class="easyui-linkbutton" onclick="deltask()" data-options="iconCls: 'fa-trash',plain:true">删除</a>-->
|
||||
|
||||
<a id="delprg" class="easyui-linkbutton" onclick="deltask()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
||||
|
||||
<a id="detailcheck" class="easyui-linkbutton" onclick="detailcheck()" data-options="iconCls: 'fa-info-circle',plain:true">详情</a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="tasktab" style="width:100%;height:100%;text-align: center;"></table>
|
||||
|
@ -40,6 +40,7 @@
|
|||
{ field: 'checktime', title: '检查时间', width: 300 },
|
||||
{ field: 'createuser__name', title: '创建人', width: 300 },
|
||||
{ field: 'createdate', title: '创建时间', width: 300 },
|
||||
|
||||
{ field: 'checkplace', title: '检查地点', width: 300 },
|
||||
|
||||
{ field: 'tasktype', title: '排查频次', width: 100, formatter: function (value, row, index) {
|
||||
|
@ -69,6 +70,46 @@
|
|||
function addcheckrw(){
|
||||
opendg('发布检查任务','html/addcheckrw')
|
||||
}
|
||||
|
||||
|
||||
function detailcheck() {
|
||||
var row = $('#tasktab').datagrid('getSelected');
|
||||
if (row) {
|
||||
opendg('检查任务详情','html/checkdetail/'+row.id.toString())
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '请先选择一条数据!');
|
||||
}
|
||||
|
||||
}
|
||||
function deltask() {
|
||||
var row = $('#tasktab').datagrid('getSelected');
|
||||
if (row) {
|
||||
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'api/checkproject?a=del',
|
||||
data: { 'id': row.id },
|
||||
datatype: "json",
|
||||
beforeSend: function () { },
|
||||
success: function (data) {
|
||||
if (data.code == 1) {
|
||||
$("#tasktab").datagrid('reload');
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '你无权删除该条任务信息!');
|
||||
}
|
||||
},
|
||||
complete: function (XMLHttpRequest, textStatus) {
|
||||
},
|
||||
error: function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
$.messager.alert('提示', '请选择一行数据!');
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -112,33 +112,9 @@
|
|||
|
||||
}
|
||||
function exportgrpxexcel() {
|
||||
var datalist = $('#grpxtable').datagrid('getData').rows;
|
||||
for(var j = 0,len = datalist.length; j < len; j++){
|
||||
var dic = datalist[j]
|
||||
for (var key in dic) {
|
||||
dic["姓名"]=dic["participant__name"]
|
||||
dic["培训编号"]=dic["train__trainnum"]
|
||||
dic["培训名称"]=dic["train__trainname"]
|
||||
dic["培训地点"]=dic["train__trainplace"]
|
||||
dic["开始时间"]=dic["train__starttime"]
|
||||
dic["得分"]=dic["score"]
|
||||
if(dic["score"]==null){dic["得分"]=''}
|
||||
if(dic["checked"]==0){dic["签到情况"]='未微信签到'}
|
||||
if(dic["checked"]==1){dic["签到情况"]='已微信签到'}
|
||||
dic["授课人"]=dic["train__lecturer__name"]
|
||||
delete dic["train__trainid"];
|
||||
delete dic["participant__name"];
|
||||
delete dic["train__trainnum"];
|
||||
delete dic["train__trainname"];
|
||||
delete dic["train__trainplace"];
|
||||
delete dic["train__starttime"];
|
||||
delete dic["score"];
|
||||
delete dic["checked"];
|
||||
delete dic["train__lecturer__name"];
|
||||
delete dic["train__state"];
|
||||
delete dic["train__teacher"];
|
||||
}
|
||||
}
|
||||
JSONToCSVConvertor(JSON.stringify(datalist), "个人培训档案", true);
|
||||
var sry = $('#sry').combobox('getValue')
|
||||
let url = 'api/train?a=exportexcel&sry='+sry
|
||||
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
|
||||
|
||||
}
|
||||
</script>
|
|
@ -115,6 +115,7 @@ urlpatterns = [
|
|||
path('html/addcheckjob/<int:id>/',views.addcheckjob),#检查任务
|
||||
path('html/detailjob/<int:id>/',views.detailjob),#任务详情
|
||||
path('html/updchecktable/<int:id>/',views.updchecktable),#修改检查表
|
||||
path('html/checkdetail/<int:id>/',views.checkdetail),#任务分配详情
|
||||
#html页面
|
||||
|
||||
|
||||
|
|
|
@ -502,7 +502,8 @@ def operprocedetail(req, id):
|
|||
|
||||
def datashow2(req):
|
||||
return render(req,'datashow2.html')
|
||||
|
||||
def checkdetail(req,id):
|
||||
return render(req,'checkdetail.html',{'id':id})
|
||||
def checktask(req):#检查项目
|
||||
return render(req, 'checktable.html')
|
||||
def addchecktask(req):#责任制
|
||||
|
@ -6399,7 +6400,19 @@ def apitrain(req):
|
|||
objs = objs[startnum:endnum].values('train__trainnum', 'train__trainid', 'train__state', 'train__trainplace', 'train__starttime', 'train__trainname',
|
||||
'train__teacher', 'train__lecturer__name', 'participant__name', 'participant__name', 'checked', 'train__duration', 'examtestdetail')
|
||||
return HttpResponse(transjson(total, objs), content_type="application/json")
|
||||
elif req.GET.get('a') == 'exportexcel':
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
a = Trainuser.objects.filter(train__deletemark=1)
|
||||
if req.GET.get('sry'):
|
||||
a = a.filter(participant__userid=req.GET.get('sry'))
|
||||
else:
|
||||
a = a.filter(participant__userid=userid)
|
||||
|
||||
|
||||
res = exportxlsx('grpxjl', a)
|
||||
return res
|
||||
|
||||
def apiquestioncat(req):
|
||||
a = req.GET.get('a')
|
||||
userid = req.session['userid']
|
||||
|
@ -7723,16 +7736,16 @@ def checkprojects(req):
|
|||
return HttpResponse(transjson(total, a), content_type="application/json")
|
||||
elif a == 'listall3':
|
||||
startnum,endnum = fenye(req)
|
||||
a = Checktask.objects.filter(usecomp=Partment.objects.get(partid=companyid), deletemark=1)
|
||||
a = Checktask.objects.filter(usecomp=Partment.objects.get(partid=companyid), deletemark=1).order_by('-createdate')
|
||||
total = a.count()
|
||||
startnum, endnum = fenye(req)
|
||||
|
||||
a = a[startnum:endnum].values('id','checktaskname','tasktype','checktype__checktitle','checkplace', 'checktime','createuser__name','createdate')
|
||||
|
||||
a = a[startnum:endnum].values('id','checktaskname','tasktype','checkname','checktype__checktitle','checkplace', 'checktime','createuser__name','createdate')
|
||||
|
||||
return HttpResponse(transjson(total, a), content_type="application/json")
|
||||
elif a == 'listall4':
|
||||
startnum,endnum = fenye(req)
|
||||
a = Checkjob.objects.filter(usecomp=Partment.objects.get(partid=companyid),checkname__userid=userid,deletemark=1)
|
||||
a = Checkjob.objects.filter(usecomp=Partment.objects.get(partid=companyid),checkname__userid=userid,deletemark=1).order_by('-starttime')
|
||||
total = a.count()
|
||||
startnum, endnum = fenye(req)
|
||||
|
||||
|
@ -7899,7 +7912,7 @@ def checkprojects(req):
|
|||
#删除
|
||||
elif a == 'del':
|
||||
id =req.GET.get('id')
|
||||
a = Checkproject.objects.get(id=id)
|
||||
a = Checktask.objects.get(id=id)
|
||||
if a.createuser==User.objects.get(userid=userid):
|
||||
a.deletemark=0
|
||||
a.save()
|
||||
|
@ -7931,6 +7944,17 @@ def checkprojects(req):
|
|||
uselist.append(item.name)
|
||||
|
||||
x = a.values('checktask__checktaskname','starttime','zgjg','checktask__tasktype','endtime','jobstate','zguser__username','checktask__checktype__checkcontent','checktask__checkplace','checktask__checktime' ,'checkname__username', 'checkquestion', 'zgtime', 'zguser__username', 'createuser__username',
|
||||
'createdate', 'taskstate','content','pmpeople', 'zgyq','zgjg', 'yanshou', 'yanshouren__username')[0]
|
||||
'createdate', 'taskstate','content','pmpeople', 'zgyq','zgjg', 'yanshou', 'yanshouren__name')[0]
|
||||
x['bcfr'] = uselist
|
||||
return HttpResponse(json.dumps(x, cls=MyEncoder), content_type="application/json")
|
||||
elif a == 'checkdetail':
|
||||
id = req.GET.get('id')
|
||||
a = Checktask.objects.filter(id=id)
|
||||
list1=Checktask.objects.get(id=id).checkname.all()
|
||||
uselist=[]
|
||||
for item in list1:
|
||||
uselist.append(item.name)
|
||||
|
||||
x = a.values('checktaskname','zxstate','tasktype','checkplace','checktime','checktype__checktitle','checktype__checkcontent')[0]
|
||||
x['bcfr'] = uselist
|
||||
return HttpResponse(json.dumps(x, cls=MyEncoder), content_type="application/json")
|
Loading…
Reference in New Issue