diff --git a/safesite/export.py b/safesite/export.py
index e4cb50d5..3a7e7149 100644
--- a/safesite/export.py
+++ b/safesite/export.py
@@ -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')
diff --git a/safesite/exportemp/grpxjl.xlsx b/safesite/exportemp/grpxjl.xlsx
new file mode 100644
index 00000000..0c50241c
Binary files /dev/null and b/safesite/exportemp/grpxjl.xlsx differ
diff --git a/safesite/templates/checkdetail.html b/safesite/templates/checkdetail.html
new file mode 100644
index 00000000..ebd56dab
--- /dev/null
+++ b/safesite/templates/checkdetail.html
@@ -0,0 +1,113 @@
+
+
+
+
\ No newline at end of file
diff --git a/safesite/templates/checkjob.html b/safesite/templates/checkjob.html
index ec0bde13..340df8ce 100644
--- a/safesite/templates/checkjob.html
+++ b/safesite/templates/checkjob.html
@@ -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) {
diff --git a/safesite/templates/checkjobadd.html b/safesite/templates/checkjobadd.html
index ae0e21ea..010e4bfd 100644
--- a/safesite/templates/checkjobadd.html
+++ b/safesite/templates/checkjobadd.html
@@ -75,8 +75,8 @@
检查状态: |
- 检查完成
- 正在检查
+ 已整改完成
+ 正在整改中
|
diff --git a/safesite/templates/checkjobdetail.html b/safesite/templates/checkjobdetail.html
index 90330df7..24384c27 100644
--- a/safesite/templates/checkjobdetail.html
+++ b/safesite/templates/checkjobdetail.html
@@ -66,7 +66,7 @@
验收人: |
- {{yanshouren__username}} |
+ {{yanshouren__name}} |
验收时间: |
{{yanshou}} |
diff --git a/safesite/templates/checklist.html b/safesite/templates/checklist.html
index 9cbb672c..971afa1f 100644
--- a/safesite/templates/checklist.html
+++ b/safesite/templates/checklist.html
@@ -11,9 +11,9 @@
发布任务
{% endif %}
-
-
+ 删除
+ 详情
@@ -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('提示', '请选择一行数据!');
+ }
+ }
\ No newline at end of file
diff --git a/safesite/templates/personaltrain.html b/safesite/templates/personaltrain.html
index c1b7f2fe..97dc86ab 100644
--- a/safesite/templates/personaltrain.html
+++ b/safesite/templates/personaltrain.html
@@ -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
+ $('').appendTo('body').submit().remove();
+
}
\ No newline at end of file
diff --git a/safesite/urls.py b/safesite/urls.py
index 8f6d01c8..6a856e6d 100644
--- a/safesite/urls.py
+++ b/safesite/urls.py
@@ -115,6 +115,7 @@ urlpatterns = [
path('html/addcheckjob//',views.addcheckjob),#检查任务
path('html/detailjob//',views.detailjob),#任务详情
path('html/updchecktable//',views.updchecktable),#修改检查表
+ path('html/checkdetail//',views.checkdetail),#任务分配详情
#html页面
diff --git a/safesite/views.py b/safesite/views.py
index ba4f4f9f..41c3f8e8 100644
--- a/safesite/views.py
+++ b/safesite/views.py
@@ -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")
\ No newline at end of file