diff --git a/safesite/templates/behavior.html b/safesite/templates/behavior.html index 88bf8b64..1fe2d098 100644 --- a/safesite/templates/behavior.html +++ b/safesite/templates/behavior.html @@ -6,11 +6,14 @@ month = now.getMonth() + 1; for (var i = 0; i < 5; i++) { $('#year').append(''); + $('#years').append(''); } $.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(); + gczxt(); }) }); @@ -151,139 +154,145 @@ function funTypeChange() { 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(); - //行为观察折线图 - $.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 + var gcChart2 = echarts.init(document.getElementById("piecontainer2")); + + gcChart2.setOption(option = { + title: { + text: '行为观察折线图' }, - { - name: '员工的位置', - type: 'line', - stack: '总量', - data: data.userwz + tooltip: { + trigger: 'axis' }, - { - name: '个人防护装备', - type: 'line', - stack: '总量', - data: data.grfh + legend: { + data: ['人员的反映', '员工的位置', '个人防护装备', '工具和设备', '程序和标准', '人体工程学', '环境整洁'] }, - { - name: '工具和设备', - type: 'line', - stack: '总量', - data: data.gjhsb + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true }, - { - name: '程序和标准', - type: 'line', - stack: '总量', - data: data.cxhbz - } - , - { - name: '人体工程学', - type: 'line', - stack: '总量', - data: data.rtgcx + toolbox: { + feature: { + saveAsImage: {} + } }, - { - name: '环境整洁', - type: 'line', - stack: '总量', - data: data.hjzj - } - ] - }); - }, - error: function (errorMsg) { - gcChart2.hideLoading(); - } - }); + 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(); + } + }); + } +
- + +
- - - + + + -
+
-
+
- +
- + @@ -306,7 +315,7 @@ - + \ No newline at end of file
用户ID观察人姓名观察记录人姓名 观察部门 行为观察数