xingweitongji
This commit is contained in:
parent
1b0b31bae6
commit
b698651baa
|
@ -166,7 +166,9 @@
|
|||
.icon-taskdo{
|
||||
background:url('icons/taskdo.png') no-repeat center center;
|
||||
}
|
||||
|
||||
.icon-bhr {
|
||||
background: url('icons/behv.png') no-repeat center center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
|
@ -0,0 +1,312 @@
|
|||
|
||||
<script>
|
||||
var now = new Date();
|
||||
$(function () {
|
||||
year = now.getFullYear();
|
||||
month = now.getMonth() + 1;
|
||||
for (var i = 0; i < 5; i++) {
|
||||
$('#year').append('<option value="' + (year - i) + '">' + (year - i) + '</option>');
|
||||
}
|
||||
$.get('api/tool?a=servertime', function (res) {
|
||||
$('#year').combobox().combobox('setValue', res.year);
|
||||
$('#month').combobox().combobox('setValue', res.month);
|
||||
behaviorDate();
|
||||
})
|
||||
|
||||
});
|
||||
$("#sfxbm2").combotree({
|
||||
url: 'parthandle?a=tree',
|
||||
editable: false,
|
||||
loadFilter: function (rows) {
|
||||
return convert(rows);
|
||||
},
|
||||
formatter: function (node) {
|
||||
var s = node.text;
|
||||
if (node.children) {
|
||||
s += ' <span style=\'color:blue\'>(' + node.children.length + ')</span>';
|
||||
}
|
||||
return s;
|
||||
},
|
||||
onSelect: function (node) {
|
||||
$('#sfxr').combobox({
|
||||
url: 'getuser?partid=' + node.id + '&a=combobox',
|
||||
editable: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
function gcpmsearch() {
|
||||
var querydata = $('#fxrpms').serializeJSON();
|
||||
$('#fxrpmtable').datagrid('load', querydata);
|
||||
}
|
||||
function gcpmexport() {
|
||||
var data = $('#fxrpmtable').datagrid('getData');
|
||||
var datalist = data.rows;
|
||||
|
||||
for (var j = 0, len = datalist.length; j < len; j++) {
|
||||
var dic = datalist[j]
|
||||
for (var key in dic) {
|
||||
dic["观察人"] = dic["looker__name"]
|
||||
dic["观察部门"] = dic["lookpart__partname"]
|
||||
dic["行为观察数"] = dic["number"]
|
||||
delete dic["looker__userid"];
|
||||
delete dic["looker__name"]
|
||||
delete dic["lookpart__partname"]
|
||||
delete dic["number"]
|
||||
}
|
||||
}
|
||||
JSONToCSVConvertor(JSON.stringify(datalist), "观察行为排名", true);
|
||||
}
|
||||
function behaviorDate()
|
||||
{
|
||||
var y = $("#year").val();
|
||||
var m = $("#month").val();
|
||||
var gcChart = echarts.init(document.getElementById("piecontainer"));
|
||||
|
||||
gcChart.setOption(option = {
|
||||
title: {
|
||||
text: '观察类型分布',
|
||||
x: 'left'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
x: 'left',
|
||||
y: 'bottom',
|
||||
data: []
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
mark: { show: true },
|
||||
dataView: { show: true, readOnly: false },
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true }
|
||||
}
|
||||
},
|
||||
calculable: true,
|
||||
series: [
|
||||
{
|
||||
name: '级别分布',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
roseType: 'angle',
|
||||
center: ['50%', '60%'],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
label: {
|
||||
show: false
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true,
|
||||
position: 'center',
|
||||
textStyle: {
|
||||
fontSize: '22',
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data: []
|
||||
}
|
||||
]
|
||||
});
|
||||
gcChart.showLoading();
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "api/obscount?a=gclxt&year=" + y + "&month=" + m, //请求发送
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
|
||||
if (data) {
|
||||
gcChart.hideLoading(); //隐藏加载动画
|
||||
gcChart.setOption({
|
||||
legend: { data: data.key },
|
||||
series: {
|
||||
name: '级别分布',
|
||||
data: data.value,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
gcChart.hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function funTypeChange() {
|
||||
behaviorDate();//饼图
|
||||
}
|
||||
|
||||
var y = now.getFullYear();
|
||||
//行为观察折线图
|
||||
$.ajax({
|
||||
type: "get",
|
||||
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||
url: "api/obscount?a=gclzx&year=" + y, //请求发送
|
||||
dataType: "json", //返回数据形式为json
|
||||
success: function (data) {
|
||||
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||
|
||||
var gcChart2 = echarts.init(document.getElementById("piecontainer2"));
|
||||
gcChart2.hideLoading();
|
||||
gcChart2.setOption(option = {
|
||||
title: {
|
||||
text: '行为观察折线图'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
},
|
||||
legend: {
|
||||
data: ['人员的反映', '员工的位置', '个人防护装备', '工具和设备', '程序和标准','人体工程学','环境整洁']
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
containLabel: true
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: data.months
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '人员的反映',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.userfy
|
||||
},
|
||||
{
|
||||
name: '员工的位置',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.userwz
|
||||
},
|
||||
{
|
||||
name: '个人防护装备',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.grfh
|
||||
},
|
||||
{
|
||||
name: '工具和设备',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.gjhsb
|
||||
},
|
||||
{
|
||||
name: '程序和标准',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.cxhbz
|
||||
}
|
||||
,
|
||||
{
|
||||
name: '人体工程学',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.rtgcx
|
||||
},
|
||||
{
|
||||
name: '环境整洁',
|
||||
type: 'line',
|
||||
stack: '总量',
|
||||
data: data.hjzj
|
||||
}
|
||||
]
|
||||
});
|
||||
},
|
||||
error: function (errorMsg) {
|
||||
gcChart2.hideLoading();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div class="border" id="desktop" style="margin: 10px 10px 0 10px; background: #fff; overflow: auto;">
|
||||
<!--行为观察统计-->
|
||||
|
||||
<div id="piecontainer2" style="width:100%;height:400px;">
|
||||
|
||||
</div>
|
||||
<div style="width:100%">
|
||||
<div style="width:40%;height:400px;float:left">
|
||||
<select class="txtInput select3" id="year" name="year" style="width:100px;"></select><label>年</label>
|
||||
<select class="txtInput select3" id="month" name="month" style="width:100px;">
|
||||
<option value="1">1月</option>
|
||||
<option value="2">2月</option>
|
||||
<option value="3">3月</option>
|
||||
<option value="4">4月</option>
|
||||
<option value="5">5月</option>
|
||||
<option value="6">6月</option>
|
||||
<option value="7">7月</option>
|
||||
<option value="8">8月</option>
|
||||
<option value="9">9月</option>
|
||||
<option value="10">10月</option>
|
||||
<option value="11">11月</option>
|
||||
<option value="12">12月</option>
|
||||
</select>
|
||||
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||
|
||||
<div id="piecontainer" style="height:400px;width:100%">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 60%; margin: 0px auto;float:right;margin-bottom:100px; ">
|
||||
<table name="" id="fxrpmtable" class='easyui-datagrid' title="行为观察排名" data-options="rownumbers:true,singleSelect:true,striped: true,method:'get',url: 'api/obscount?a=gclxbg',toolbar:'#fxrpmbar'" style="height:400px">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th data-options="field:'looker__userid',hidden:true">用户ID</th>
|
||||
<th data-options="field:'looker__name',align:'right'" width="30%">观察人姓名</th>
|
||||
<th data-options="field:'lookpart__partname',align:'right'" width="35%">观察部门</th>
|
||||
<th data-options="field:'number',align:'right'" width="35%">行为观察数</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div id='fxrpmbar'>
|
||||
<form id="fxrpms">
|
||||
<a onclick="gcpmsearch()" class='easyui-linkbutton' iconCls='fa-search' plain=true>查询</a>
|
||||
<a onclick="gcpmexport()" class='easyui-linkbutton' iconCls='fa-upload' plain=true>导出</a>
|
||||
<div>
|
||||
<label>发现部门</label><input id="sfxbm2" name="fxbm" style="width:180px;height:22px" />
|
||||
<label>起始时间</label><input id="sqssj" name="qssj" class="easyui-datebox" style="width:180px;height:22px" />
|
||||
<label>结束时间</label><input id="sjssj" name="jssj" class="easyui-datebox" style="width:180px;height:22px" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -85,6 +85,8 @@ urlpatterns = [
|
|||
path('html/riskcheck',views.riskcheck),
|
||||
path('html/risk/edit/<int:id>/',views.riskedit),
|
||||
path('html/report/edit',views.reportedit),
|
||||
path('html/bhr',views.bhrhtml),
|
||||
|
||||
#html页面
|
||||
|
||||
|
||||
|
@ -149,7 +151,7 @@ urlpatterns = [
|
|||
path('api/riskcheck2',views.apiriskcheck2),
|
||||
path('api/report',views.apireport),
|
||||
path('html/examhistory/<int:id>/',views.examhistory),
|
||||
|
||||
path('api/obscount',views.observepic),
|
||||
|
||||
#path('api/rights/group/<int:groupid>',views.rightsgroup),
|
||||
path('api/main',views.mainapi),
|
||||
|
|
|
@ -234,7 +234,8 @@ def troubleashtml(req):
|
|||
return render(req,'troubleashtml.html')
|
||||
def userhtml(req):
|
||||
return render(req,'userhtml.html')
|
||||
|
||||
def bhrhtml(req):
|
||||
return render(req,'behavior.html')
|
||||
def check_login(func):
|
||||
def warpper(request,*args,**kwargs):
|
||||
is_login = request.session.get('userid', None)
|
||||
|
@ -2714,10 +2715,85 @@ def gchandle(req):
|
|||
url = exportdoc2('gc',data)
|
||||
return JsonResponse({"code":1,"downloadurl":url})
|
||||
|
||||
def observepic(req):
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
|
||||
if req.GET.get('a')=='gclxt':#观察类型饼图
|
||||
year = int(req.GET.get('year'))
|
||||
month = int(req.GET.get('month'))
|
||||
first_day,first_day_of_next_month = gettime(datetime(year,month,1))
|
||||
if req.GET.get('part'):
|
||||
partid = req.GET.get('part')
|
||||
else:
|
||||
partid = companyid
|
||||
parts = Partment.objects.filter(Q(partid=partid) | Q(partlink__contains=',' + str(partid) + ','))
|
||||
a = Observe.objects.filter(lookpart__in=parts,deletemark=1,looktime__range=(first_day, first_day_of_next_month))
|
||||
value=[]
|
||||
key=[]
|
||||
for i in Dicclass.objects.filter(parentid__dicid=23):
|
||||
x = i.dicname
|
||||
y = Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count()
|
||||
key.append(x)
|
||||
value.append({'value':y,'name':x})
|
||||
return JsonResponse({'code':1,'key':key,'value':value})
|
||||
elif req.GET.get('a')=='gclzx':#观察类型折线图
|
||||
year = int(req.GET.get('year'))
|
||||
months = [1,2,3,4,5,6,7,8,9,10,11,12]
|
||||
userfy=[]#人员反映
|
||||
userwz=[]#员工的位置
|
||||
grfh=[]#个人防护装备
|
||||
gjhsb=[]#工具和设备
|
||||
cxhbz=[]#程序和标准
|
||||
rtgcx=[]#人体工程学
|
||||
hjzj=[]#环境整洁
|
||||
|
||||
for month in months:
|
||||
first_day,first_day_of_next_month = gettime(datetime(year,month,1))
|
||||
if req.GET.get('part'):
|
||||
partid = req.GET.get('part')
|
||||
else:
|
||||
partid = companyid
|
||||
parts = Partment.objects.filter(Q(partid=partid) | Q(partlink__contains=',' + str(partid) + ','))
|
||||
a = Observe.objects.filter(lookpart__in=parts,deletemark=1,looktime__range=(first_day, first_day_of_next_month))
|
||||
for i in Dicclass.objects.filter(parentid__dicid=23):
|
||||
if i.dicid==24:
|
||||
userfy.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
|
||||
elif i.dicid==25:
|
||||
userwz.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
|
||||
elif i.dicid==26:
|
||||
grfh.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
|
||||
elif i.dicid==27:
|
||||
gjhsb.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
|
||||
elif i.dicid==28:
|
||||
cxhbz.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
|
||||
elif i.dicid==29:
|
||||
rtgcx.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
|
||||
elif i.dicid==30:
|
||||
hjzj.append(Unsafes.objects.filter(observe__in=a,unsafedicclass=i).count())
|
||||
|
||||
|
||||
|
||||
return JsonResponse({'code':1,'months':months,'userfy':userfy,'userwz':userwz,'grfh':grfh,'gjhsb':gjhsb,'cxhbz':cxhbz,'rtgcx':rtgcx,'hjzj':hjzj,})
|
||||
elif req.GET.get('a')=='gclxbg':
|
||||
userid = req.session['userid']
|
||||
companyid = getcompany(userid)
|
||||
a = Observe.objects.filter(usecomp=Partment.objects.get(partid=companyid),deletemark=1)
|
||||
|
||||
if req.GET.get('qssj'):#开始时间
|
||||
a = a.filter(looktime__gte=req.GET.get('qssj'))
|
||||
if req.GET.get('jssj'):#结束时间
|
||||
a = a.filter(looktime__lte=req.GET.get('jssj'))
|
||||
if req.GET.get('fxbm'):
|
||||
gcbm = req.GET.get('fxbm')
|
||||
parts = Partment.objects.filter(partlink__contains=',' + gcbm + ',')|Partment.objects.filter(partid=gcbm)
|
||||
a = a.filter(lookpart__in=parts)
|
||||
|
||||
total = a.count()
|
||||
objs = a.values('looker__userid','looker__name','lookpart__partname').annotate(number = Count('looker')).order_by('-number')
|
||||
return HttpResponse(transjson(total,objs),content_type="application/json")
|
||||
|
||||
|
||||
|
||||
def dicchandle(req):
|
||||
a = req.GET.get('a')
|
||||
if a == 'tree':
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue