xiugai
This commit is contained in:
parent
11b09e4288
commit
3f79b3dbdc
|
@ -1 +1,279 @@
|
||||||
<div>正在完成</div>
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
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>');
|
||||||
|
$('#years').append('<option value="' + (year - i) + '">' + (year - i) + '</option>');
|
||||||
|
}
|
||||||
|
$.get('api/tool?a=servertime', function (res) {
|
||||||
|
$('#year').combobox().combobox('setValue', res.year);
|
||||||
|
$('#years').combobox().combobox('setValue', res.year);
|
||||||
|
$('#month').combobox().combobox('setValue', res.month);
|
||||||
|
behaviorDate();
|
||||||
|
trainstatistical();
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function gcpmsearch() {
|
||||||
|
var querydata = $('#fxrpms').serializeJSON();
|
||||||
|
$('#fxrpmtable').datagrid('load', querydata);
|
||||||
|
}
|
||||||
|
//培训分析柱形图
|
||||||
|
function behaviorDate() {
|
||||||
|
var y = $("#year").val();
|
||||||
|
var sbChart = echarts.init(document.getElementById("piecontainer"));
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||||
|
url: "api/equipmentfig?a=eqmcount", //请求发送
|
||||||
|
dataType: "json", //返回数据形式为json
|
||||||
|
success: function (data) {
|
||||||
|
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||||
|
console.log(data.data.eqmlist);
|
||||||
|
if (data) {
|
||||||
|
var num = [];
|
||||||
|
var name = [];
|
||||||
|
if (data.data.eqmlist != null) {
|
||||||
|
$.each(data.data.eqmlist, function (i, item) {
|
||||||
|
|
||||||
|
|
||||||
|
num.push(item.num);
|
||||||
|
|
||||||
|
name.push(item.area__name);
|
||||||
|
|
||||||
|
})
|
||||||
|
sbChart.setOption({
|
||||||
|
legend: {
|
||||||
|
data: name
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: '各区域设备数量',
|
||||||
|
x: 'center'
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
|
show: true,
|
||||||
|
feature: {
|
||||||
|
mark: { show: true },
|
||||||
|
dataView: { show: true, readOnly: false },
|
||||||
|
restore: { show: true },
|
||||||
|
saveAsImage: { show: true }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
color: ['#3398DB'],
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||||
|
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '3%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '3%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
xAxis: [
|
||||||
|
{
|
||||||
|
type: 'category',
|
||||||
|
data: name,
|
||||||
|
axisTick: {
|
||||||
|
alignWithLabel: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '设备数量',
|
||||||
|
type: 'bar',
|
||||||
|
barWidth: '60%',
|
||||||
|
data: num,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (errorMsg) {
|
||||||
|
sbChart.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
//培训分析扇形图
|
||||||
|
function trainstatistical() {
|
||||||
|
//var y = $("#year").val();
|
||||||
|
//var m = $("#month").val();
|
||||||
|
var pxChart = echarts.init(document.getElementById("piecontainer2"));
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
|
||||||
|
url: "api/equipmentfig?a=state", //请求发送
|
||||||
|
dataType: "json", //返回数据形式为json
|
||||||
|
success: function (data) {
|
||||||
|
//请求成功时执行该函数内容,data即为服务器返回的json对象
|
||||||
|
|
||||||
|
if (data != null) {
|
||||||
|
|
||||||
|
|
||||||
|
pxChart.setOption({
|
||||||
|
title: {
|
||||||
|
text: '设备状态统计',
|
||||||
|
x: 'center'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item',
|
||||||
|
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
|
show: true,
|
||||||
|
feature: {
|
||||||
|
mark: { show: true },
|
||||||
|
dataView: { show: true, readOnly: false },
|
||||||
|
restore: { show: true },
|
||||||
|
saveAsImage: { show: true }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
calculable: true,
|
||||||
|
legend: {
|
||||||
|
orient: 'vertical',
|
||||||
|
left: 'right',
|
||||||
|
y: 'bottom',
|
||||||
|
data: ['正常','异常']
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '设备状态',
|
||||||
|
type: 'pie',
|
||||||
|
radius: '55%',
|
||||||
|
center: ['50%', '60%'],
|
||||||
|
data: [{ value: data.normal, name: '正常' },{ value:data.abnormal,name: '异常' }],
|
||||||
|
itemStyle: {
|
||||||
|
emphasis: {
|
||||||
|
shadowBlur: 10,
|
||||||
|
shadowOffsetX: 0,
|
||||||
|
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (errorMsg) {
|
||||||
|
pxChart.hideLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function funTypeChange() {
|
||||||
|
behaviorDate();//
|
||||||
|
}
|
||||||
|
function funTypeChange2() {
|
||||||
|
trainstatistical();//
|
||||||
|
}
|
||||||
|
function fxrpmsearch() {
|
||||||
|
var querydata = $('#fxrpms').serializeJSON();
|
||||||
|
$('#fxrpmtable').datagrid('load', querydata);
|
||||||
|
}
|
||||||
|
function fxrpmexport() {
|
||||||
|
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["participant__name"]
|
||||||
|
dic["用户名"] = dic["participant__username"]
|
||||||
|
dic["培训次数"] = dic["count"]
|
||||||
|
delete dic["participant__name"];
|
||||||
|
delete dic["participant__username"]
|
||||||
|
delete dic["count"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSONToCSVConvertor(JSON.stringify(datalist), "培训次数", true);
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="border" id="desktop" style="margin: 10px 10px 0 10px; background: #fff; overflow: auto;">
|
||||||
|
|
||||||
|
<div style="width:100%">
|
||||||
|
<div style="width:80%;margin:auto;margin-bottom:100px;">
|
||||||
|
<select class="txtInput select3" id="year" name="year" style="width:100px;"></select><label>年</label>
|
||||||
|
|
||||||
|
<button class="btn btn-info" onclick="funTypeChange()"> 查询</button>
|
||||||
|
|
||||||
|
<div id="piecontainer" style="height:400px;width:100%">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width:80%;margin:auto;margin-bottom:100px;">
|
||||||
|
|
||||||
|
<div id="piecontainer2" style="height:400px;width:100%">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 80%; margin:auto;margin-bottom:100px; ">
|
||||||
|
<table name="" id="fxrpmtable" class='easyui-datagrid' title="培训次数" data-options="rownumbers:true,singleSelect:true,striped: true,method:'get',url: 'api/trainfg?a=trainuser',toolbar:'#fxrpmbar'" style="height:400px">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th data-options="field:'participant__name',align:'right'" width="35%">姓名</th>
|
||||||
|
<th data-options="field:'participant__username',align:'right'" width="30%">用户名</th>
|
||||||
|
<th data-options="field:'count',align:'right'" width="35%">培训次数</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
<div id='fxrpmbar'>
|
||||||
|
<form id="fxrpms">
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
<a onclick="fxrpmsearch()" class='easyui-linkbutton' iconCls='fa-search' plain=true>查询</a>
|
||||||
|
<a onclick="fxrpmexport()" class='easyui-linkbutton' iconCls='fa-upload' plain=true>导出</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
|
@ -158,7 +158,7 @@ urlpatterns = [
|
||||||
path('api/riskas',views.apiriskas),
|
path('api/riskas',views.apiriskas),
|
||||||
path('api/trainfg',views.trainfg),
|
path('api/trainfg',views.trainfg),
|
||||||
path('api/check_session',views.check_session),
|
path('api/check_session',views.check_session),
|
||||||
|
path('api/equipmentfig',views.equipmentfig),#设备统计图
|
||||||
#path('api/rights/group/<int:groupid>',views.rightsgroup),
|
#path('api/rights/group/<int:groupid>',views.rightsgroup),
|
||||||
path('api/main',views.mainapi),
|
path('api/main',views.mainapi),
|
||||||
path('bindwechat', views.bwlogin,name='bwlogin'), #微信登陆绑定相关
|
path('bindwechat', views.bwlogin,name='bwlogin'), #微信登陆绑定相关
|
||||||
|
|
|
@ -6145,4 +6145,22 @@ def trainfg(req):
|
||||||
dickeyname=i.dickeyname
|
dickeyname=i.dickeyname
|
||||||
traintypelist.append({'value':count,'name':dickeyname})
|
traintypelist.append({'value':count,'name':dickeyname})
|
||||||
return HttpResponse(json.dumps({'code':1,'data':{'traintypelist':list(traintypelist)}}), content_type='application/json')
|
return HttpResponse(json.dumps({'code':1,'data':{'traintypelist':list(traintypelist)}}), content_type='application/json')
|
||||||
|
#设备统计图
|
||||||
|
|
||||||
|
def equipmentfig(req):
|
||||||
|
a = req.GET.get('a')
|
||||||
|
userid = req.session['userid']
|
||||||
|
companyid = getcompany(userid)
|
||||||
|
|
||||||
|
if a=='state':
|
||||||
|
# year = int(req.GET.get('year'))
|
||||||
|
# month = int(req.GET.get('month'))
|
||||||
|
# first_day,first_day_of_next_month = gettime(datetime(year,month,1))
|
||||||
|
a = Equipment.objects.filter(usecomp__partid=companyid,deletemark=1)
|
||||||
|
normal = a.filter(state=1).count()#正常
|
||||||
|
abnormal = a.filter(state=0).count()#异常
|
||||||
|
return JsonResponse({"code":1,"normal":normal,"abnormal":abnormal})
|
||||||
|
elif a=='eqmcount':
|
||||||
|
eqmlist=Equipment.objects.filter(usecomp__partid=companyid,deletemark=1).values('area__name').annotate(num = Count('area'))
|
||||||
|
|
||||||
|
return HttpResponse(json.dumps({'code':1,'data':{'eqmlist':list(eqmlist)}}), content_type='application/json')
|
Loading…
Reference in New Issue