rectifyStandingBook_clgs.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  7. <title>隐患整改台账</title>
  8. <link rel="stylesheet" href="../../../assets/libs/layui/css/layui.css"/>
  9. <link rel="stylesheet" href="../../../assets/module/admin.css?v=312"/>
  10. <style>
  11. .layui-table-cell {
  12. height: auto;
  13. }
  14. .table-head-head-title {
  15. text-align: center;
  16. font-weight: bold;
  17. margin-top: 15px;
  18. }
  19. .table-head-info {
  20. overflow: hidden;
  21. font-size: 16px;
  22. margin: 15px;
  23. }
  24. .table-head-info .left {
  25. float: left;
  26. }
  27. .table-head-info .right {
  28. float: right;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <!-- 页面加载loading -->
  34. <div class="page-loading">
  35. <div class="ball-loader">
  36. <span></span><span></span><span></span><span></span>
  37. </div>
  38. </div>
  39. <!-- 正文开始 -->
  40. <div class="layui-fluid">
  41. <div class="layui-card">
  42. <div class="layui-card-body">
  43. <form class="layui-form m-top10px m-bottom10px" lay-filter="filterForm" id="filterForm">
  44. <div class="layui-form toolbar">
  45. <div class="layui-form-item">
  46. <div class="layui-inline layui-col-md2 text-left" style="margin-left: -40px;">
  47. <label class="layui-form-label">所属部门</label>
  48. <div class="layui-input-block">
  49. <input type="text" id="currentGroupName" class="layui-input" name="currentGroupName"
  50. value=""
  51. placeholder="全部部门"
  52. class="form-control" readonly>
  53. <input type="hidden" id="selectedGroup" name="selectedGroup" readonly>
  54. <div id="menuContent" class="menuContent">
  55. <ul id="groupTree" class="ztree" style="margin-top:0;"></ul>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="layui-inline layui-col-md3 ">
  60. <label class="layui-form-label">日期</label>
  61. <div class="layui-input-block">
  62. <input type="text" name="hiddenTime" id="hiddenTime" autocomplete="off"
  63. placeholder="开始日期 至 结束日期" class="layui-input">
  64. </div>
  65. </div>
  66. <button type="button" lay-filter="formSubSearch" lay-submit
  67. class="layui-btn layui-btn-normal layui-btn-sm" style="height: 36px;">
  68. <i class="layui-icon"></i>搜索
  69. </button>
  70. <button type="button" lay-filter="formSubEmpty" lay-submit class="layui-btn layui-btn-sm"
  71. style="height: 36px;">
  72. <i class="layui-icon"></i>清空
  73. </button>
  74. <!--<div class="layui-inline pull-right">-->
  75. <!--<button id="exportFile" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-normal">-->
  76. <!--<i class="layui-download-circle">&#xe65c;</i>导出-->
  77. <!--</button>-->
  78. <!--</div>-->
  79. </div>
  80. </div>
  81. </form>
  82. <div id="printBox">
  83. <h2 class="table-head-head-title">隐患等级登记台账</h2>
  84. <div class="table-head-info">
  85. <div class="left">
  86. 填报单位:<span id="reportingUnit"></span>
  87. </div>
  88. <div class="right">
  89. 填报时间:<span id="reportingTime"></span>
  90. </div>
  91. </div>
  92. <table class="layui-table" id="datatable" lay-filter="datatable"></table>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <!-- js部分 -->
  98. <script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>
  99. <script type="text/javascript" src="../../../assets/js/common.js?v=312"></script>
  100. <script type="text/javascript" src="../../../assets/libs/jquery/jquery-3.2.1.min.js"></script>
  101. <script>
  102. layui.use(['layer', 'form', 'table', 'admin', 'uParas', '_groupTree', 'util', 'laydate', 'soulTable', 'dateUtils', 'printer'], function () {
  103. var $ = layui.jquery;
  104. var layer = layui.layer;
  105. var form = layui.form;
  106. var table = layui.table;
  107. var admin = layui.admin;
  108. var laydate = layui.laydate;
  109. var uParas = layui.uParas;
  110. var util = layui.util;
  111. var _groupTree = layui._groupTree;
  112. var soulTable = layui.soulTable;
  113. var dateUtils = layui.dateUtils;
  114. var printer = layui.printer;
  115. $("#reportingUnit").text(layui.data(uParas.tableName).user.name);
  116. /*日期*/
  117. // laydate.render({
  118. // elem: '#hiddenTime',
  119. // format: 'yyyy-MM-dd',
  120. // range: '至',
  121. // type: 'date',
  122. // });
  123. laydate.render({
  124. elem: '#hiddenTime',
  125. format: 'yyyy-MM',
  126. type: 'month',
  127. });
  128. // 渲染表格
  129. var insTb = table.render({
  130. elem: '#datatable',
  131. url: uParas.baseUrl + '/ent/hiddenDangerStatistics/queryRectifyStandingBookByPage',
  132. where: {"weighty": 0}, /*是否是重大隐患整改台账*/
  133. page: false,
  134. toolbar: true,
  135. height: 680,
  136. title: '隐患整改台账',
  137. defaultToolbar: ['filter', { //自定义导出
  138. title: '导出',
  139. layEvent: 'LAYTABLE_EXPORT_EXCEL',
  140. icon: 'layui-icon-export'
  141. }, { //自定义导出
  142. title: '打印',
  143. layEvent: 'LAYTABLE_PRINT_NEW',
  144. icon: 'layui-icon-print'
  145. }],
  146. cellMinWidth: 100,
  147. cols: [[
  148. {type: 'numbers', title: '序号', rowspan: 2},
  149. {
  150. field: 'hdangerCreatedTime',
  151. sort: false,
  152. title: '排查日期',
  153. templet: "<div>{{layui.util.toDateString(d.hdangerCreatedTime, 'yyyy-MM-dd')}}</div>",
  154. rowspan: 2
  155. },
  156. {field: 'riskPointPlaces', sort: false, title: '隐患地点', rowspan: 2},
  157. {field: 'hdangerTitle', sort: false, title: '隐患名称', rowspan: 2},
  158. {
  159. field: 'hdangerLevel', sort: false, title: '隐患等级',
  160. templet: function (d) {
  161. return setHdangerLevel(d.hdangerLevel);
  162. }
  163. , rowspan: 2
  164. },
  165. {field: '', title: '隐患来源', colspan: 2, align: 'center'},
  166. {field: '', title: '整改要求', colspan: 4, align: 'center'},
  167. {field: '', title: '复查情况', colspan: 3, align: 'center'},
  168. {field: 'remark', sort: false, title: '备注', rowspan: 2},
  169. ], [
  170. {
  171. field: 'hdangerRetifyReasons', sort: false, title: '自查', templet: function (d) {
  172. return "";
  173. }
  174. },
  175. {
  176. field: '', sort: false, title: '上报', templet: function (d) {
  177. return "项目部上报";
  178. }
  179. },
  180. {field: 'hdangerRetifyGroupName', sort: false, title: '单位'},
  181. {field: 'hdangerRetifyByName', sort: false, title: '责任人'},
  182. {field: 'hdangerRetifyMeasures', sort: false, title: '措施'},
  183. {
  184. field: 'hdangerRetifyDeadline', sort: false, title: '时限', templet: function (d) {
  185. return getDays(d.hdangerCreatedTime, d.hdangerRetifyDeadline) + "天";
  186. }
  187. },
  188. {
  189. field: 'finishedTime',
  190. sort: false,
  191. title: '时间',
  192. templet: "<div>{{layui.util.toDateString(d.finishedTime, 'yyyy-MM-dd')}}</div>"
  193. },
  194. {field: 'hdangerAcceptedByName', sort: false, title: '复查人'},
  195. {field: 'hdangerAcceptedResult', sort: false, title: '结论'},
  196. ]],
  197. done: function () {
  198. // tableX.merges('datatable', [0]); // 在done回调里面调用
  199. soulTable.render(this)
  200. // var htmlStr = printer.makeHtml({
  201. // // style: '<style>*{color: red;text-align: center;}</style>',
  202. // body: $('#printBox')
  203. // });
  204. }
  205. });
  206. function getDays(startDate, endDate) {
  207. //sDate1和sDate2是2006-12-18格式
  208. var dateSpan,
  209. tempDate,
  210. iDays;
  211. sDate1 = Date.parse(startDate);
  212. sDate2 = Date.parse(endDate);
  213. dateSpan = sDate2 - sDate1;
  214. dateSpan = Math.abs(dateSpan);
  215. iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
  216. return iDays
  217. }
  218. //监听头工具栏事件
  219. table.on('toolbar(datatable)', function (obj) {
  220. var checkStatus = table.checkStatus(obj.config.id);
  221. switch (obj.event) {
  222. //自定义头工具栏右侧图标 - 导出
  223. case 'LAYTABLE_EXPORT_EXCEL':
  224. soulTable.export(insTb, {filename: '隐患整改台账.xlsx'},
  225. {
  226. mergeData: false,
  227. dependKey: 'riskPointName',
  228. lineStyleConfig: []
  229. }
  230. );
  231. break;
  232. case 'LAYTABLE_PRINT_NEW':
  233. printer.printHtml({
  234. html: printer.makeHtml({
  235. style: '<style>body{font-size: 12px; color: #666;}table{width: 100%; border-collapse: collapse; border-spacing: 0;}th,td{line-height: 20px; padding: 9px 10px;width: 100px; border: 1px solid #ccc; text-align: left; font-size: 12px; color: #666;}a{color: #666; text-decoration:none;}*.layui-hide{display: none} .table-head-head-title{text-align:center;font-weight:bold;margin-top:15px;} .table-head-info{overflow:hidden; font-size:16px;margin:15px;} .table-head-info .left{float:left;} .table-head-info .right{float:right;}</style>',
  236. body: $('#printBox').html()
  237. }),
  238. horizontal: true, // 横向打印
  239. close: false // 自动关闭打印窗口
  240. });
  241. break;
  242. }
  243. ;
  244. });
  245. function setHdangerLevel(hdangerLevel) {
  246. var title = '';
  247. if (hdangerLevel == 1) {
  248. title = '重大';
  249. } else if (hdangerLevel == 2) {
  250. title = '较大';
  251. } else if (hdangerLevel == 3) {
  252. title = '一般';
  253. } else if (hdangerLevel == 4) {
  254. title = '较低';
  255. } else {
  256. return '未知';
  257. }
  258. return title
  259. }
  260. /***部门过滤*/
  261. _groupTree.initGroupColation(insTb, '/admin/common/getGroupLists', "groupTree", "currentGroupName", "selectedGroup", "menuContent");
  262. // $('#exportFile').click(function () {
  263. // table.exportFile(
  264. // ['名字','性别','年龄'],
  265. // [
  266. // ['张三','男','20'],
  267. // ['李四','女','18'],
  268. // ['王五','女','19']
  269. // ], 'xls'); //默认导出 csv,也可以为:xls
  270. // });
  271. // 搜索
  272. form.on('submit(formSubSearch)', function (data) {
  273. var hiddenTime = "";
  274. /*更新数据表*/
  275. if ($("#hiddenTime").val() != '') {
  276. $("#reportingTime").text($("#hiddenTime").val());
  277. var now = new Date($("#hiddenTime").val()); //当前日期
  278. var nowMonth = now.getMonth(); //当前月
  279. var nowYear = now.getFullYear(); //当前年
  280. //本月的开始时间
  281. var monthStartDate = new Date(nowYear, nowMonth, 1);
  282. //本月的结束时间
  283. var monthEndDate = new Date(nowYear, nowMonth + 1, 0);
  284. var timeStar = Date.parse(monthStartDate);//s
  285. var timeEnd = Date.parse(monthEndDate);//s
  286. hiddenTime = dateUtils.dateFormat(timeStar, "yyyy-MM-dd") + " 至 " + dateUtils.dateFormat(timeEnd, "yyyy-MM-dd");
  287. }
  288. var data = {"hiddenTime": hiddenTime, "groupId": $("#selectedGroup").val()};
  289. insTb.reload({where: data}, 'data');
  290. });
  291. // 清空
  292. form.on('submit(formSubEmpty)', function (data) {
  293. $("#hiddenTime").val("");
  294. /*更新数据表*/
  295. var data = {"hiddenTime": null, "groupId": $("#selectedGroup").val()};
  296. insTb.reload({where: data}, 'data');
  297. });
  298. });
  299. // $("#exportFile").click(function(){
  300. // $("#datatable").table2excel({
  301. // // 不被导出的表格行的CSS class类
  302. // exclude: ".noExl",
  303. // // 导出的Excel文档的名称
  304. // name: "Excel Document Name",
  305. // // Excel文件的名称
  306. // filename: "test",
  307. // //文件后缀名
  308. // fileext: ".xls",
  309. // //是否排除导出图片
  310. // exclude_img: false,
  311. // //是否排除导出超链接
  312. // exclude_links: false,
  313. // //是否排除导出输入框中的内容
  314. // exclude_inputs: false
  315. // });
  316. // });
  317. </script>
  318. </body>
  319. </html>