123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <title>隐患详情</title>
- <link rel="stylesheet" href="../../../assets/libs/layui/css/layui.css"/>
- <link rel="stylesheet" href="../../../assets/module/formSelects/formSelects-v4.css"/>
- <link rel="stylesheet" href="../../../assets/module/admin.css?v=312"/>
- <link rel="stylesheet" href="../../../assets/module/uParas.css?v=312"/>
- </head>
- <body>
- <style type="text/css">
- /*table th{*/
- /* color: #ffb800;*/
- /*}*/
- table tr th, td {
- text-align: center;
- }
- .one {
- border-bottom: 1px solid indianred;
- color: #FF4B28;
- }
- .two {
- border-bottom: 1px solid #148ef1;
- color: #FF6C00;
- }
- .three {
- border-bottom: 1px solid #FFDF0E;
- color: #FFDF0E;
- }
- .four {
- border-bottom: 1px solid #00C0FF;
- color: #00C0FF;
- }
- </style>
- <!-- 加载动画 -->
- <div class="page-loading">
- <div class="ball-loader">
- <span></span><span></span><span></span><span></span>
- </div>
- </div>
- <!-- 正文开始 -->
- <div class="layui-fluid">
- <div class="layui-card">
- <div class="layui-card-body">
- <form class="layui-form m-top10px m-bottom10px" lay-filter="filterForm" id="filterForm">
- <div class="layui-card-header">
- <div class="layui-inline layui-col-md2 text-left" style="margin-left: -40px;">
- <label class="layui-form-label">部门</label>
- <div class="layui-input-block">
- <input type="text" id="currentGroupName" class="layui-input" name="currentGroupName"
- value=""
- placeholder="全部部门"
- class="form-control" readonly>
- <input type="hidden" id="selectedGroup" name="selectedGroup" readonly>
- <div id="menuContent" class="menuContent">
- <ul id="groupTree" class="ztree" style="margin-top:0;"></ul>
- </div>
- </div>
- </div>
- <div class="layui-inline layui-col-md2 ">
- <label class="layui-form-label">日期</label>
- <div class="layui-input-block">
- <input type="text" name="yearStr" id="yearStr"
- placeholder="选择年份" lay-verify="datetime" autocomplete="off" class="layui-input work-flow-review-hint">
- </div>
- </div>
- <!-- <div class="layui-inline layui-col-md2 ">-->
- <!-- <div class="layui-input-block" style="margin-left: 0px;margin-top: -3px;">-->
- <!-- <button id="formSubSearch" class="layui-btn icon-btn bg-c-add">-->
- <!-- <i class="layui-icon"></i>-->
- <!-- </button>-->
- <!-- </div>-->
- <!-- </div>-->
- </div>
- <div class="layui-card-body overflow-y-680px">
- <div class="layui-tab layui-tab-brief ">
- <!--统计图-->
- <div id="groupScoreStatistics" class="m-top10px" style="height:550px;"></div>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- <!-- js部分 -->
- <script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>
- <script type="text/javascript" src="../../../assets/js/common.js?v=312"></script>
- <script type="text/javascript" src="../../../assets/libs/echarts/echarts.min.js?v=312"></script>
- <script type="text/javascript" src="../../../assets/libs/jquery/jquery-3.2.1.min.js"></script>
- <script>
- layui.use(['layer', 'form', 'table', 'util', 'zTree','_groupTree','laydate', 'admin', 'uParas', 'element', 'laytpl'], function () {
- var $ = layui.jquery;
- var layer = layui.layer;
- var form = layui.form;
- var util = layui.util;
- var table = layui.table;
- var admin = layui.admin;
- var uParas = layui.uParas;
- var element = layui.element, laytpl = layui.laytpl;
- var _groupTree = layui._groupTree;
- var laydate = layui.laydate;
- var insTb;
- /*日期*/
- laydate.render({
- elem: '#yearStr',
- format: 'yyyy',
- type: 'year',
- value: new Date().getFullYear(), //初始化值
- btns: false, //隐藏按钮
- change: function(value, date){ //监听日期被切换
- $("#yearStr").val(value);
- findByStatistics($("#selectedGroup").val(), $("#yearStr").val());
- /*更新数据表*/
- var data = {"yearStr":$("#yearStr").val(),"gId":$("#selectedGroup").val()};
- insTb.reload({where: data}, 'data');
- }
- });
- findByStatistics($("#selectedGroup").val(), $("#yearStr").val());
- /**
- * 部门过滤
- * ztree 文本下拉
- */
- admin.req(uParas.baseUrl + '/admin/common/getGroupLists', null, function (res) {
- if (res.code == 1) {
- $.fn.zTree.init($('#groupTree'), settingMAP, res.data);
- $.fn.zTree.getZTreeObj("groupTree").expandAll(true);
- layer.closeAll('loading');
- hideMenuMap();
- }
- }, 'get');
- $("#currentGroupName").click(function () {
- $("#menuContent").slideDown("fast");
- $("body").bind("mousedown", onBodyDown);
- });
- function onBodyDown(event) {
- if (!(event.target.id === "selectedGroup" || event.target.id === "menuContent" || $(event.target).parents("#menuContentMap").length > 0)) {
- hideMenuMap();
- }
- }
- var settingMAP = {
- check: {
- enable: false,
- chkboxType: {"Y": "", "N": ""}
- },
- view: {
- dblClickExpand: false
- },
- data: {
- simpleData: {
- enable: true,
- idKey: "gId",
- pIdKey: "groupParent",
- rootPId: null
- },
- key: {
- name: "groupName"
- }
- },
- callback: {
- onClick: onClickMap
- }
- };
- function onClickMap(event, treeId, treeNode, clickFlag) {
- var zTree = $.fn.zTree.getZTreeObj("groupTree"),
- nodes = zTree.getSelectedNodes(),
- v = "", idlist = "";
- for (var i = 0, l = nodes.length; i < l; i++) {
- v += nodes[i].groupName + ",";
- idlist += nodes[i].gId + ",";
- }
- if (v.length > 0) {
- v = v.substring(0, v.length - 1);
- idlist = idlist.substring(0, idlist.length - 1);
- }
- var cityObj = $("#currentGroupName");
- if (cityObj.val() == v) {
- cityObj.attr("value", "");
- $("#gId").attr("value", "");
- } else {
- cityObj.attr("value", v);
- $("#gId").attr("value", idlist);
- }
- hideMenuMap();
- var groupId_ = idlist;
- if (groupId_ != "-1") {
- var Obj = new Object();
- Obj.gId = groupId_;
- }
- if (insTb != null && insTb != undefined && insTb != '') {
- /*更新数据表*/
- insTb.reload({where: Obj}, 'data');
- }
- /*更新统计*/
- findByStatistics(groupId_, $("#yearStr").val());
- }
- function hideMenuMap() {
- $("#menuContent").fadeOut("fast");
- $("body").unbind("mousedown", onBodyDown);
- }
- /**结束*/
- /*搜索*/
- // $('#formSubSearch').click(function () {
- // var data = {"hiddenYear":$("#yearStr").val(),"groupId":$("#selectedGroup").val()};
- // // insTb.reload({where: data}, 'data');
- // // initTable(data);
- // // insTb.reload({where: data}, 'data');
- // findByStatistics($("#selectedGroup").val(), $("#yearStr").val());
- // });
- // $("#yearStr").change(function () {
- // findByStatistics($("#selectedGroup").val(), $("#yearStr").val());
- // });
- /*统计数据*/
- function findByStatistics(groupId, yearStr) {
- var url = "/ent/performanceScore/findScoreMonthStatistics";
- var dataMap = {
- "gId": groupId,
- "yearStr": yearStr,
- "isMyself": 0, //0部门统计
- };
- admin.req(uParas.baseUrl + url, dataMap, function (res) {
- if (res.code == 1) {
- /*绘制统计图*/
- initChartStatcs(res.data.monthScore);
- }
- }, 'get');
- }
- /*初始化统计图*/
- function initChartStatcs(monthScore) {
- var dataArray = [];
- var seriesArray = [];
- seriesArray[0] = {
- name: '分数',
- barGap: 0,
- type: 'line', //line 折线图;bar柱状图
- barGap:'-100%',
- barCategoryGap:'60%',
- label: {show: true,position: 'top'},
- data: monthScore,
- };
- var seriesLabel = [];
- var colorArray = [];
- seriesLabel[0] = {
- label: {show: true,position: 'top'},
- };
- colorArray[0] = '#00C0FF';
- var myChart = echarts.init(document.getElementById('groupScoreStatistics'));
- echarts.config = {
- align: 'center',
- verticalAlign: 'middle',
- distance: 15,
- onChange: function () {
- myChart.setOption({
- series: seriesLabel
- // series: [{
- // label: labelOption
- // }, {
- // label: labelOption
- // }, {
- // label: labelOption
- // }, {
- // label: labelOption
- // }]
- });
- }
- };
- option = {
- title: {
- left: "2%",
- text: $("#yearStr").val() + '年-月度统计',
- //subtext: 'eeee',
- x: 'left'
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- crossStyle: {
- color: '#999'
- }
- }
- },
- // color: ['#FF4B28', '#FF6C00', '#FFDF0E', '#00C0FF'],
- color: colorArray,
- toolbox: {
- itemSize: 18,
- itemGap: 15,
- right: '50',
- feature: {
- show: true,
- orient: 'vertical',
- mark: {
- show: true,
- },
- dataView: {
- show: false,
- optionToContent: function (opt) {
- // console.log(11111);
- var xaisName = opt.xAxis[0].name;
- var axisData = opt.xAxis[0].data;
- var series = opt.series;
- var tableDom = document.createElement("table");
- tableDom.setAttribute("id", "test");
- tableDom.setAttribute("class", "table-data-table");
- var table = '<table id="test" style="width:100%;height:200px; text-align:center;border: 3px solid;">';
- var table = '<thead><tr style="height: 40px;">'
- + '<td style="width: 200px;height: 30px;">' + xaisName + '</td>'
- + '<td class="one" style="width: 200px;height: 30px;">' + series[0].name + '</td>'
- + '<td class="two" style="width: 200px;height: 30px;">' + series[1].name + '</td>'
- + '<td class="three" style="width: 200px;height: 30px;">' + series[2].name + '</td>'
- + '<td class="four" style="width: 200px;height: 30px;">' + series[3].name + '</td>'
- + '</tr></thead><tbody>';
- for (var i = 0, l = axisData.length; i < l; i++) {
- table += '<tr style="height: 35px;">'
- + '<td style="height: 30px;">' + axisData[i] + '</td>'
- + '<td class="one" style="height: 30px;">' + series[0].data[i] + '</td>'
- + '<td class="two" style="height: 30px;">' + series[1].data[i] + '</td>'
- + '<td class="three" style="height: 30px;">' + series[2].data[i] + '</td>'
- + '<td class="four" style="height: 30px;">' + series[3].data[i] + '</td>'
- + '</tr>';
- }
- table += '</tbody>';
- tableDom.innerHTML = table;
- return tableDom;
- },
- readOnly: true, //是否可以编辑
- lang: ['数据视图', '关闭', '刷新'],
- buttonColor: '#cccccc',
- buttonTextColor: '#000',
- },
- magicType: {show: true, type: ['line', 'bar']},
- restore: {show: false},
- saveAsImage: {show: true}
- }
- },
- legend: {
- left: 'center',
- // data: ['重大隐患总数', '较大隐患总数', '一般隐患总数', '较低隐患总数']
- data: dataArray
- },
- xAxis: [
- {
- name: '共12个周期',
- type: 'category',
- axisTick: {show: false},
- data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
- axisPointer: {
- type: 'shadow'
- }
- }
- ],
- yAxis: [
- {
- type: 'value',
- name: '分数',
- },
- ],
- grid: {
- // width:"50%",
- left: "2%",
- right: "6%",
- bottom: "40",
- top: "12%",
- containLabel: true
- },
- calculable: true,
- series: seriesArray
- };
- myChart.setOption(option);
- setTimeout(function () {
- window.onresize = function () {
- myChart.resize();
- }
- }, 200);
- }
- });
- </script>
- </body>
- </html>
|