This commit is contained in:
shilixia 2019-10-18 17:18:01 +08:00
parent cf6aedda8f
commit 3da5b1851e
1 changed files with 118 additions and 109 deletions

View File

@ -6,11 +6,14 @@
month = now.getMonth() + 1; month = now.getMonth() + 1;
for (var i = 0; i < 5; i++) { for (var i = 0; i < 5; i++) {
$('#year').append('<option value="' + (year - i) + '">' + (year - i) + '</option>'); $('#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) { $.get('api/tool?a=servertime', function (res) {
$('#year').combobox().combobox('setValue', res.year); $('#year').combobox().combobox('setValue', res.year);
$('#years').combobox().combobox('setValue', res.year);
$('#month').combobox().combobox('setValue', res.month); $('#month').combobox().combobox('setValue', res.month);
behaviorDate(); behaviorDate();
gczxt();
}) })
}); });
@ -151,139 +154,145 @@
function funTypeChange() { function funTypeChange() {
behaviorDate();//饼图 behaviorDate();//饼图
} }
function funTypeChange2() {
gczxt();
}
function gczxt() {//行为观察折线图
var y = $("#years").val();
//行为观察折线图
$.ajax({
type: "get",
async: true, //异步请求(同步请求将会锁住浏览器,用户其他操作必须等待请求完成才可以执行)
url: "api/obscount?a=gclzx&year=" + y, //请求发送
dataType: "json", //返回数据形式为json
success: function (data) {
//请求成功时执行该函数内容data即为服务器返回的json对象
var y = now.getFullYear(); var gcChart2 = echarts.init(document.getElementById("piecontainer2"));
//行为观察折线图
$.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.setOption(option = {
gcChart2.hideLoading(); title: {
gcChart2.setOption(option = { text: '行为观察折线图'
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
}, },
{ tooltip: {
name: '员工的位置', trigger: 'axis'
type: 'line',
stack: '总量',
data: data.userwz
}, },
{ legend: {
name: '个人防护装备', data: ['人员的反映', '员工的位置', '个人防护装备', '工具和设备', '程序和标准', '人体工程学', '环境整洁']
type: 'line',
stack: '总量',
data: data.grfh
}, },
{ grid: {
name: '工具和设备', left: '3%',
type: 'line', right: '4%',
stack: '总量', bottom: '3%',
data: data.gjhsb containLabel: true
}, },
{ toolbox: {
name: '程序和标准', feature: {
type: 'line', saveAsImage: {}
stack: '总量', }
data: data.cxhbz
}
,
{
name: '人体工程学',
type: 'line',
stack: '总量',
data: data.rtgcx
}, },
{ xAxis: {
name: '环境整洁', type: 'category',
type: 'line', boundaryGap: false,
stack: '总量', data: data.months
data: data.hjzj },
} yAxis: {
] type: 'value'
}); },
}, series: [
error: function (errorMsg) { {
gcChart2.hideLoading(); 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> </script>
<div class="border" id="desktop" style="margin: 10px 10px 0 10px; background: #fff; overflow: auto;"> <div class="border" id="desktop" style="margin: 10px 10px 0 10px; background: #fff; overflow: auto;">
<!--行为观察统计--> <!--行为观察统计-->
<select class="txtInput select3" id="years" name="years" style="width:100px;"></select><label></label>
<button class="btn btn-info" onclick="funTypeChange2()">&nbsp;查询</button>
<div id="piecontainer2" style="width:100%;height:400px;"> <div id="piecontainer2" style="width:100%;height:400px;">
</div> </div>
<div style="width:100%"> <div style="width:100%">
<div style="width:40%;height:400px;float:left"> <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="year" name="year" style="width:100px;"></select><label></label>
<select class="txtInput select3" id="month" name="month" style="width:100px;"> <select class="txtInput select3" id="month" name="month" style="width:100px;">
<option value="1">1月</option> <option value="1">1月</option>
<option value="2">2月</option> <option value="2">2月</option>
<option value="3">3月</option> <option value="3">3月</option>
<option value="4">4月</option> <option value="4">4月</option>
<option value="5">5月</option> <option value="5">5月</option>
<option value="6">6月</option> <option value="6">6月</option>
<option value="7">7月</option> <option value="7">7月</option>
<option value="8">8月</option> <option value="8">8月</option>
<option value="9">9月</option> <option value="9">9月</option>
<option value="10">10月</option> <option value="10">10月</option>
<option value="11">11月</option> <option value="11">11月</option>
<option value="12">12月</option> <option value="12">12月</option>
</select> </select>
<button class="btn btn-info" onclick="funTypeChange()">&nbsp;查询</button> <button class="btn btn-info" onclick="funTypeChange()">&nbsp;查询</button>
<div id="piecontainer" style="height:400px;width:100%"> <div id="piecontainer" style="height:400px;width:100%">
</div>
</div> </div>
</div>
<div style="width: 60%; margin: 0px auto;float:right;margin-bottom:100px; "> <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"> <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> <thead>
<tr> <tr>
<th data-options="field:'looker__userid',hidden:true">用户ID</th> <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:'looker__name',align:'right'" width="30%">观察记录人姓名</th>
<th data-options="field:'lookpart__partname',align:'right'" width="35%">观察部门</th> <th data-options="field:'lookpart__partname',align:'right'" width="35%">观察部门</th>
<th data-options="field:'number',align:'right'" width="35%">行为观察数</th> <th data-options="field:'number',align:'right'" width="35%">行为观察数</th>
</tr> </tr>
@ -306,7 +315,7 @@
</div> </div>
</div> </div>
</div> </div>