This commit is contained in:
caoqianming 2022-04-17 22:27:47 +08:00
commit 472cfa5947
5 changed files with 56 additions and 23 deletions

View File

@ -80,10 +80,10 @@ def api(req):
startnum,endnum=fenye(req)
a = a.order_by('-downnum','-modifytime')[startnum:endnum].values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime')
return HttpResponse(transjson(total,a),content_type="application/json")
elif a == 'detail':
id = req.GET.get('id')
obj = Edulesson.objects.filter(id=id).values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime')
return JsonResponse(list(obj)[0])
# elif a == 'detail':
# id = req.GET.get('eduid')
# obj = Edulesson.objects.filter(id=id).values('id','num','title','user__name','user__ubelongpart__partname','desciption','submittime','type','cate__name','url','downnum','modifytime')
# return JsonResponse(list(obj)[0])
#视频
elif a=='add':
userid = req.session['userid']#用户ID
@ -168,7 +168,11 @@ def api(req):
return JsonResponse({"code":1,"url": a.url})
#观看详情
elif a=='detail':
id=req.GET.get('zrid')
a = EdulessonWatch.objects.filter(edulesson=id).values('id','user__name','submittime')
total = a.count()
return HttpResponse(transjson(total,a),content_type="application/json")
id=req.GET.get('eduid')
userid = req.session['userid']
companyid = getcompany(userid)#公司ID
objs = EdulessonWatch.objects.filter(edulesson=id, user__usecomp=companyid)
total = objs.count()
startnum, endnum = fenye(req)
objs_data = objs.order_by('-submittime')[startnum:endnum].values('id','user__name','submittime')
return HttpResponse(transjson(total, objs_data), content_type="application/json")

View File

@ -1,6 +1,6 @@
<div title="作业" style="height:100%;">
<table id="zytable" style="width:100%;height:100%"></table>
<div title="观看历史" style="height:100%;">
<table id="eduwatchtable" style="width:100%;height:100%"></table>
</div>
@ -9,7 +9,7 @@
var eduid = {{ jyid }};
var html;
$('#zytable').datagrid({
$('#eduwatchtable').datagrid({
url: 'edu/api?a=detail&eduid=' + eduid,
rownumbers: true,
singleSelect: true,
@ -17,7 +17,8 @@
fitColumns: true,
method: 'get',
pageSize: 20,
toolbar: '#zytablebar',
pagination: 'true',
toolbar: '#eduwatchtablebar',
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'user__name', title: '观看人', width: 80 },

View File

@ -30,9 +30,9 @@
{% if request|has_permission:'b_edu_study' %}
<a id="tzdetail" onclick="tzdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">下载/查看</a>
{% endif %}
<!-- {% if request|has_permission:'b_edu_detail' %}
<a id="edulook" class="easyui-linkbutton" onclick="jydetail()" data-options="iconCls: 'fa-plus',plain:true">观看历史</a>
{% endif %} -->
{% if request|has_permission:'b_edu_addfile' %}
<a id="edulook" class="easyui-linkbutton" onclick="edudetail()" data-options="iconCls: 'fa-info',plain:true">观看历史</a>
{% endif %}
</div>
@ -159,7 +159,7 @@
$.messager.alert('提示', '请选择一行数据!');
}
}
function jydetail() {
function edudetail() {
var row = $('#edutab').datagrid('getSelected');
if (row) {
var url = 'edu/html/edulessondetail/detail/' + row.id

View File

@ -34,6 +34,9 @@
{% if request|has_permission:'b_trouble_exportxls' %}
<a id="exportexcel" onclick="exportyhexcel2()" class='easyui-linkbutton' data-options="iconCls: 'fa-download',plain:true">导出无图Excel</a>
{% endif %}
{% if request|has_permission:'b_trouble_exportxls' %}
<a id="exportexcel" onclick="exportyhexcel3()" class='easyui-linkbutton' data-options="iconCls: 'fa-download',plain:true">导出选中</a>
{% endif %}
</div>
<div id="sdg_yh" class="easyui-dialog" title="筛选条件" style="width:400px;height:420px;"
data-options="iconCls:'fa-search',resizable:true,modal:true,closed:true,border:false">
@ -98,7 +101,6 @@
$('#yhtable').datagrid({
rownumbers: true,
singleSelect: true,
striped: true,
method: 'get',
url: '',
@ -109,9 +111,10 @@
border: false,
columns: [[
{ field: 'troubleid', hidden: true },
{ field: 'ck', checkbox: true , width: 20},
{ field: 'yhnum', title: '编号', width: 100 },
{
field: 'yhzt', title: '流程状态', width: 100, styler: function (value, row, index) {
field: 'yhzt', title: '流程状态', width: 60, styler: function (value, row, index) {
switch (value) {
case 0: return 'background-color:yellow;'; break;
case 1: return 'background-color:yellow;'; break;
@ -147,7 +150,7 @@
{ field: 'todouser__userid', hidden: true },
{ field: 'sybzt', hidden: true },
{
field: 'shresult', title: '隐患状态', width: 100, styler: function (value, row, index) {
field: 'shresult', title: '隐患状态', width: 80, styler: function (value, row, index) {
switch (value) {
case 1: return ''; break;
case 2: return 'color:red;font-weight:bold'; break;
@ -338,6 +341,21 @@
window.open(url);
// $('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
}
function exportyhexcel3() {
var rows = $('#yhtable').datagrid('getSelections');
if(rows.length>0){
var data = {'ids':[]}
for(var i=0;i<rows.length;i++){
data.ids.push(rows[i].troubleid)
}
let url = 'troublehandle?a=exportexcel2&' + parseParams(data)
window.open(url);
}
else {
$.messager.alert('提示', '未选择数据!');
}
}
function delyh() {
var row = $('#yhtable').datagrid('getSelected');
if (row) {

View File

@ -1322,7 +1322,6 @@ def getyh(req):
def accessyh(req):
logger.info(req.get_full_path())
userid = req.session['userid']
yhdata = json.loads(req.body.decode('utf-8'))
troubleid = yhdata['troubleid']
@ -1704,7 +1703,7 @@ def accessyh(req):
postdict['touser'] = a.todouser.openid
send_wechatmsg.delay(postdict)
return JsonResponse({"code": 1})
logger.info(a.troubleid + '-' + str(yhdata))
def parttree2(req):
userid = req.session['userid']
companyid = getcompany(userid)
@ -2097,6 +2096,14 @@ def troublehandle(req):
else:
res = exportxlsx('yh', a)
return res
elif a == 'exportexcel2':
userid = req.session['userid']
companyid = getcompany(userid)
ids_l = req.GET.get('ids').split(',')
objs = Trouble.objects.filter(
usecomp=Partment.objects.get(partid=companyid), deletemark=1, troubleid__in=ids_l)
res = exportxlsx('yh', objs)
return res
elif a == 'del':
userid = req.session['userid']
if User.objects.get(userid=userid).issuper == 1:
@ -3539,8 +3546,11 @@ def gchandle(req):
if 'lookers' in gcdata:
ulist = gcdata['lookers'].split(',')
for i in ulist:
x = User.objects.get(userid=i)
obj.lookers.add(x)
try:
x = User.objects.get(userid=i)
obj.lookers.add(x)
except:
pass
if 'unsafe' in gcdata:
olist = gcdata['unsafe']
for i in olist: