Commit b265579144b5a81fa08bdc2ac3144585eb9d02d4

Authored by 娄高锋
1 parent 980c6efc

闵行工时统计表

src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -363,4 +363,27 @@ public class ReportController {
363 363 public Map<String, Object> online(@RequestParam Map<String, Object> map){
364 364 return service.online(map);
365 365 }
  366 +
  367 + @RequestMapping(value="/workingHours" ,method = RequestMethod.POST)
  368 + public List<Map<String, Object>> workingHours(@RequestParam String gsdm, @RequestParam String fgsdm,
  369 + @RequestParam String line, @RequestParam String date, @RequestParam String gh, @RequestParam String cl,
  370 + @RequestParam String lineName, @RequestParam String type){
  371 + List<Map<String, Object>> list = service.workingHours(gsdm, fgsdm, line, date, gh, cl);
  372 + if("export".equals(type)){
  373 + try {
  374 + ReportUtils ee = new ReportUtils();
  375 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  376 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  377 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  378 + listI.add(list.iterator());
  379 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  380 + ee.excelReplace(listI, new Object[] { }, path + "mould/workingHours.xls",
  381 + path + "export/"+sdfSimple.format(sdfMonth.parse(date))
  382 + +"-"+lineName+"-工时统计表.xls");
  383 + } catch (Exception e) {
  384 + e.printStackTrace();
  385 + }
  386 + }
  387 + return list;
  388 + }
366 389 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -177,6 +177,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
177 177 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
178 178 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and s.scheduleDateStr = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm")
179 179 List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);
  180 +
  181 + /**按日期线路查询*/
  182 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  183 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr = ?1 and s.xlBm = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% order by s.gsBm, s.fgsBm, s.xlBm")
  184 + List<ScheduleRealInfo> scheduleByDateAndLine4(String scheduleDate, String line, String gsdm, String fgsdm);
180 185  
181 186 //按照时间段统计
182 187 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
... ...
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
... ... @@ -124,5 +124,8 @@ public interface SchedulePlanInfoRepository extends BaseRepository&lt;SchedulePlanI
124 124  
125 125 @Query(value="select s from SchedulePlanInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 order by s.xlBm,clZbh,lp,xlDir")
126 126 List<SchedulePlanInfo> findLineScheduleBc(String scheduleDate);
  127 +
  128 + @Query(value="select s from SchedulePlanInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 and s.xlBm = ?2 and s.gsBm like %?3% and s.fgsBm like %?4%")
  129 + List<SchedulePlanInfo> findByDateAndLine(String scheduleDate, String line, String gsdm, String fgsdm);
127 130  
128 131 }
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -56,4 +56,6 @@ public interface ReportService {
56 56 List<Map<String, Object>> countDjg(Map<String, Object> map);
57 57  
58 58 Map<String, Object> online(Map<String, Object> map);
  59 +
  60 + List<Map<String, Object>> workingHours(String gsdm, String fgsdm, String line, String date, String gh, String cl);
59 61 }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -10,10 +10,12 @@ import com.bsth.entity.oil.Dlb;
10 10 import com.bsth.entity.oil.Ylb;
11 11 import com.bsth.entity.realcontrol.ChildTaskPlan;
12 12 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  13 +import com.bsth.entity.schedule.SchedulePlanInfo;
13 14 import com.bsth.entity.sys.Interval;
14 15 import com.bsth.repository.LineRepository;
15 16 import com.bsth.repository.StationRouteRepository;
16 17 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  18 +import com.bsth.repository.schedule.SchedulePlanInfoRepository;
17 19 import com.bsth.service.report.CulateMileageService;
18 20 import com.bsth.service.report.ReportService;
19 21 import com.bsth.util.Arith;
... ... @@ -23,6 +25,8 @@ import com.bsth.util.ReportUtils;
23 25 import com.bsth.util.db.DBUtils_MS;
24 26 import com.google.protobuf.StringValue;
25 27  
  28 +import junit.framework.Assert;
  29 +
26 30 import org.apache.commons.lang.StringUtils;
27 31 import org.slf4j.Logger;
28 32 import org.slf4j.LoggerFactory;
... ... @@ -35,6 +39,7 @@ import java.sql.Connection;
35 39 import java.sql.PreparedStatement;
36 40 import java.sql.ResultSet;
37 41 import java.sql.SQLException;
  42 +import java.text.Collator;
38 43 import java.text.DecimalFormat;
39 44 import java.text.ParseException;
40 45 import java.text.SimpleDateFormat;
... ... @@ -58,6 +63,8 @@ public class ReportServiceImpl implements ReportService{
58 63 @Autowired
59 64 ScheduleRealInfoRepository scheduleRealInfoRepository;
60 65 @Autowired
  66 + SchedulePlanInfoRepository schedulePlanInfoRepository;
  67 + @Autowired
61 68 StationRouteRepository stationRoutRepository;
62 69 @Autowired
63 70 CulateMileageService culateService;
... ... @@ -3549,6 +3556,194 @@ public class ReportServiceImpl implements ReportService{
3549 3556 }
3550 3557 return list;
3551 3558 }
  3559 +
  3560 + @Override
  3561 + public List<Map<String, Object>> workingHours(String gsdm, String fgsdm, String line, String date,
  3562 + String gh, String cl) {
  3563 + List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
  3564 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  3565 + List<SchedulePlanInfo> planList = schedulePlanInfoRepository.findByDateAndLine(date, line, gsdm, fgsdm);
  3566 + List<ScheduleRealInfo> realList = scheduleRealInfoRepository.scheduleByDateAndLine4(date, line, gsdm, fgsdm);
  3567 + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
  3568 + for(SchedulePlanInfo plan : planList){
  3569 + String gsBm = plan.getGsBm();
  3570 + String fgsBm = plan.getFgsBm();
  3571 + String xlBm = plan.getXlBm();
  3572 + String scheduleDate = sdf.format(plan.getScheduleDate());
  3573 + String jGh = plan.getjGh();
  3574 + String jName = plan.getjName();
  3575 +// String sGh = plan.getsGh();
  3576 +// String sName = plan.getsName();
  3577 + String clZbh = plan.getClZbh();
  3578 + String lpName = plan.getLpName();
  3579 + Long bcsj = (long)plan.getBcsj();
  3580 +
  3581 + String key = gsBm + "/" + fgsBm + "/" + xlBm + "/" + scheduleDate + "/"
  3582 + + jGh + "/" + jName + "/" + clZbh + "/" + lpName;
  3583 + if(!(keyMap.containsKey(key))){
  3584 + Map<String, Object> m = new HashMap<String, Object>();
  3585 + m.put("gsBm", gsBm);
  3586 + m.put("fgsBm", fgsBm);
  3587 + m.put("xlBm", xlBm);
  3588 + m.put("date", scheduleDate);
  3589 + m.put("jGh", jGh);
  3590 + m.put("jName", jName);
  3591 +// m.put("sGh", sGh);
  3592 +// m.put("sName", sName);
  3593 + m.put("clZbh", clZbh);
  3594 + m.put("lpName", lpName);
  3595 + m.put("jh", 0);
  3596 + m.put("sj", 0);
  3597 + keyMap.put(key, m);
  3598 + }
  3599 + Map<String, Object> map = keyMap.get(key);
  3600 + map.put("jh", bcsj + Long.valueOf(map.get("jh").toString()));
  3601 + }
  3602 + for(ScheduleRealInfo real : realList){
  3603 + Set<ChildTaskPlan> getcTasks = real.getcTasks();
  3604 + String gsBm = real.getGsBm();
  3605 + String fgsBm = real.getFgsBm();
  3606 + String xlBm = real.getXlBm();
  3607 + String scheduleDate = real.getScheduleDateStr();
  3608 + String jGh = real.getjGh();
  3609 + String jName = real.getjName();
  3610 +// String sGh = real.getsGh();
  3611 +// String sName = real.getsName();
  3612 + String clZbh = real.getClZbh();
  3613 + String lpName = real.getLpName();
  3614 + Long bcsj = 0l;
  3615 + if(getcTasks.isEmpty()){
  3616 + if(!(real.isDestroy()) && real.getFcsjActual() != null && real.getZdsjActual() != null
  3617 + && real.getFcsjActual().trim().length() > 0 && real.getZdsjActual().trim().length() > 0
  3618 + && (real.getFcsjActual() + real.getZdsjActual()).indexOf("null") < 0){
  3619 + String fcsj = real.getFcsjActual();
  3620 + String zdsj = real.getZdsjActual();
  3621 + String[] fcsjs = fcsj.split(":");
  3622 + String[] zdsjs = zdsj.split(":");
  3623 + Long fcsjT = Long.valueOf(fcsjs[0]) * 60 + Long.valueOf(fcsjs[1]);
  3624 + Long zdsjT = Long.valueOf(zdsjs[0]) * 60 + Long.valueOf(zdsjs[1]);
  3625 + if(zdsjT < fcsjT){
  3626 + zdsjT += 1440l;
  3627 + }
  3628 + bcsj += zdsjT - fcsjT;
  3629 + }
  3630 + } else {
  3631 + for(ChildTaskPlan task : getcTasks){
  3632 + if(!(task.isDestroy()) && task.getCcId()==null){
  3633 + String fcsj = task.getStartDate();
  3634 + String zdsj = task.getEndDate();
  3635 + String[] fcsjs = fcsj.split(":");
  3636 + String[] zdsjs = zdsj.split(":");
  3637 + Long fcsjT = Long.valueOf(fcsjs[0]) * 60 + Long.valueOf(fcsjs[1]);
  3638 + Long zdsjT = Long.valueOf(zdsjs[0]) * 60 + Long.valueOf(zdsjs[1]);
  3639 + if(zdsjT < fcsjT){
  3640 + zdsjT += 1440l;
  3641 + }
  3642 + bcsj += zdsjT - fcsjT;
  3643 + }
  3644 + }
  3645 + }
  3646 +
  3647 + String key = gsBm + "/" + fgsBm + "/" + xlBm + "/" + scheduleDate + "/"
  3648 + + jGh + "/" + jName + "/" + clZbh + "/" + lpName;
  3649 + if(!(keyMap.containsKey(key))){
  3650 + Map<String, Object> m = new HashMap<String, Object>();
  3651 + m.put("gsBm", gsBm);
  3652 + m.put("fgsBm", fgsBm);
  3653 + m.put("xlBm", xlBm);
  3654 + m.put("date", scheduleDate);
  3655 + m.put("jGh", jGh);
  3656 + m.put("jName", jName);
  3657 +// m.put("sGh", sGh);
  3658 +// m.put("sName", sName);
  3659 + m.put("clZbh", clZbh);
  3660 + m.put("lpName", lpName);
  3661 + m.put("jh", 0);
  3662 + m.put("sj", 0);
  3663 + keyMap.put(key, m);
  3664 + }
  3665 + Map<String, Object> map = keyMap.get(key);
  3666 + map.put("sj", bcsj + Long.valueOf(map.get("sj").toString()));
  3667 + }
  3668 +
  3669 + for(String key : keyMap.keySet()){
  3670 + Map<String, Object> map = keyMap.get(key);
  3671 + if(gh.trim().length() > 0){
  3672 + if(!(map.get("jGh").toString().toLowerCase().contains(gh.toLowerCase()))){
  3673 + continue;
  3674 + }
  3675 + }
  3676 + if(cl.trim().length() > 0){
  3677 + if(!(map.get("clZbh").toString().toLowerCase().contains(cl.toLowerCase()))){
  3678 + continue;
  3679 + }
  3680 + }
  3681 + String gsBm = map.get("gsBm").toString();
  3682 + String fgsBm = map.get("fgsBm").toString();
  3683 + String xlBm = map.get("xlBm").toString();
  3684 + String gsName = BasicData.businessCodeNameMap.get(gsBm);
  3685 + String fgsName = BasicData.businessFgsCodeNameMap.get(fgsBm + "_" + gsBm);
  3686 + String xlName = BasicData.lineCode2NameMap.get(xlBm);
  3687 + map.put("gsName", gsName);
  3688 + map.put("fgsName", fgsName);
  3689 + map.put("xlName", xlName);
  3690 + map.put("jsy", map.get("jGh").toString() + "/" + map.get("jName").toString());
  3691 + Long jh = Long.valueOf(map.get("jh").toString());
  3692 + Long sj = Long.valueOf(map.get("sj").toString());
  3693 + map.put("jhTime", jh/60l + "." + (jh%60l>9?jh%60l:("0"+jh%60l)));
  3694 + map.put("sjTime", sj/60l + "." + (sj%60l>9?sj%60l:("0"+sj%60l)));
  3695 + resultList.add(map);
  3696 + }
  3697 +
  3698 + Collections.sort(resultList, new Comparator<Map<String, Object>>() {
  3699 + @Override
  3700 + public int compare(Map<String, Object> c1, Map<String, Object> c2) {
  3701 + long gsBm1 = Long.valueOf(c1.get("gsBm").toString());
  3702 + long gsBm2 = Long.valueOf(c2.get("gsBm").toString());
  3703 + long diff1 = gsBm1 - gsBm2;
  3704 + if (diff1 > 0l) {
  3705 + return 1;
  3706 + }else if (diff1 < 0l) {
  3707 + return -1;
  3708 + }
  3709 + long fgsBm1 = Long.valueOf(c1.get("fgsBm").toString());
  3710 + long fgsBm2 = Long.valueOf(c2.get("fgsBm").toString());
  3711 + long diff2 = fgsBm1 - fgsBm2;
  3712 + if (diff2 > 0l) {
  3713 + return 1;
  3714 + }else if (diff2 < 0l) {
  3715 + return -1;
  3716 + }
  3717 + String xlName1 = c1.get("xlName").toString();
  3718 + String xlName2 = c2.get("xlName").toString();
  3719 + int compare1 = Collator.getInstance(Locale.CHINESE).compare(xlName1, xlName2);
  3720 + if (compare1 > 0) {
  3721 + return 1;
  3722 + }else if (compare1 < 0) {
  3723 + return -1;
  3724 + }
  3725 + String lpName1 = c1.get("lpName").toString();
  3726 + String lpName2 = c2.get("lpName").toString();
  3727 + int compare2 = Collator.getInstance(Locale.CHINESE).compare(lpName1, lpName2);
  3728 + if (compare2 > 0) {
  3729 + return 1;
  3730 + }else if (compare2 < 0) {
  3731 + return -1;
  3732 + }
  3733 + String jGh1 = c1.get("jGh").toString();
  3734 + String jGh2 = c2.get("jGh").toString();
  3735 + int compare3 = Collator.getInstance(Locale.CHINESE).compare(jGh1, jGh2);
  3736 + if (compare3 > 0) {
  3737 + return 1;
  3738 + }else if (compare3 < 0) {
  3739 + return -1;
  3740 + }
  3741 + return 0; //相等为0
  3742 + }
  3743 + });
  3744 +
  3745 + return resultList;
  3746 + }
3552 3747  
3553 3748  
3554 3749 }
... ...
src/main/resources/static/pages/forms/mould/workingHours.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/workingHours.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>工时统计表</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form class="form-inline" action="">
  30 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
  33 + </div>
  34 + <div style="display: inline-block; margin-left: 14px;" id="fgsdmDiv">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
  37 + </div>
  38 + <div style="display: inline-block;margin-left: 24px;">
  39 + <span class="item-label" style="width: 80px;">线路: </span>
  40 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  41 + </div>
  42 + <div style="margin-top: 2px"></div>
  43 + <div style="display: inline-block;margin-left: 33px;">
  44 + <span class="item-label" style="width: 80px;">时间: </span>
  45 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  46 + </div>
  47 + <div style="display: inline-block;margin-left: 28px;">
  48 + <span class="item-label" style="width: 80px;">工号: </span>
  49 + <input class="form-control" type="text" id="gh" style="width: 180px;"/>
  50 + </div>
  51 + <div style="display: inline-block;margin-left: 24px;">
  52 + <span class="item-label" style="width: 80px;">车辆: </span>
  53 + <input class="form-control" type="text" id="cl" style="width: 180px;"/>
  54 + </div>
  55 + <div class="form-group" style="margin-left: 13px">
  56 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  57 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  58 + </div>
  59 + </form>
  60 + </div>
  61 + <div class="portlet-body">
  62 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  63 + <table class="table table-bordered table-hover table-checkable" id="forms">
  64 + <thead>
  65 + <tr>
  66 + <th colspan="9">工时统计表</th>
  67 + </tr>
  68 + <tr>
  69 + <td>日期</td>
  70 + <td>公司</td>
  71 + <td>分公司</td>
  72 + <td>线路</td>
  73 + <td>路牌</td>
  74 + <td>驾驶员</td>
  75 + <td>车辆</td>
  76 + <td>计划工时(小时.分钟)</td>
  77 + <td>实际工时(小时.分钟)</td>
  78 + </tr>
  79 + </thead>
  80 + <tbody id="tbody">
  81 +
  82 + </tbody>
  83 + </table>
  84 + </div>
  85 + </div>
  86 + </div>
  87 + </div>
  88 +</div>
  89 +
  90 +<script>
  91 + $(function(){
  92 +
  93 + // 关闭左侧栏
  94 + if (!$('body').hasClass('page-sidebar-closed'))
  95 + $('.menu-toggler.sidebar-toggler').click();
  96 +
  97 + var d = new Date();
  98 + d.setTime(d.getTime() - 1*1000*60*60*24);
  99 + var year = d.getFullYear();
  100 + var month = d.getMonth() + 1;
  101 + var day = d.getDate();
  102 + if(month < 10)
  103 + month = "0" + month;
  104 + if(day < 10)
  105 + day = "0" + day;
  106 + var dateTime = year + "-" + month + "-" + day;
  107 + $("#date").datetimepicker({
  108 + format : 'YYYY-MM-DD',
  109 + locale : 'zh-cn'
  110 + });
  111 + $("#date").val(dateTime);
  112 +
  113 + var fage=false;
  114 + var xlList;
  115 + var obj = [];
  116 +
  117 +
  118 + $.get('/report/lineList',function(result){
  119 + xlList=result;
  120 + $.get('/user/companyData', function(result){
  121 + obj = result;
  122 + var options = '';
  123 + for(var i = 0; i < obj.length; i++){
  124 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  125 + }
  126 +
  127 + if(obj.length ==0){
  128 + $("#gsdmDiv").css('display','none');
  129 + }else if(obj.length ==1){
  130 + $("#gsdmDiv").css('display','none');
  131 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  132 + $('#fgsdmDiv').css('display','none');
  133 + }
  134 + $('#gsdm').html(options);
  135 + updateCompany();
  136 + });
  137 + })
  138 + $("#gsdm").on("change",updateCompany);
  139 + function updateCompany(){
  140 + var company = $('#gsdm').val();
  141 + var options = '';
  142 + for(var i = 0; i < obj.length; i++){
  143 + if(obj[i].companyCode == company){
  144 + var children = obj[i].children;
  145 + for(var j = 0; j < children.length; j++){
  146 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  147 + }
  148 + }
  149 + }
  150 + $('#fgsdm').html(options);
  151 + }
  152 +
  153 + var tempData = {};
  154 + $.get('/report/lineList',function(xlList){
  155 + var data = [];
  156 +// data.push({id: " ", text: "全部线路"});
  157 + $.get('/user/companyData', function(result){
  158 + for(var i = 0; i < result.length; i++){
  159 + var companyCode = result[i].companyCode;
  160 + var children = result[i].children;
  161 + for(var j = 0; j < children.length; j++){
  162 + var code = children[j].code;
  163 + for(var k=0;k < xlList.length;k++ ){
  164 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  165 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  166 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  167 + }
  168 + }
  169 + }
  170 + }
  171 + initPinYinSelect2('#line',data,'');
  172 +
  173 + });
  174 + });
  175 +
  176 + $("#line").on("change", function(){
  177 + if($("#line").val() == " "){
  178 + $("#gsdm").attr("disabled", false);
  179 + $("#fgsdm").attr("disabled", false);
  180 + } else {
  181 + var temp = tempData[$("#line").val()].split(":");
  182 + $("#gsdm").val(temp[0]);
  183 + updateCompany();
  184 + $("#fgsdm").val(temp[1]);
  185 + $("#gsdm").attr("disabled", true);
  186 + $("#fgsdm").attr("disabled", true);
  187 + }
  188 + });
  189 +
  190 +
  191 + var line;
  192 + var date;
  193 + var gsdm;
  194 + var fgsdm;
  195 + var gh;
  196 + var cl;
  197 + var lineName=$("#select2-line-container").html();
  198 + $("#query").on("click",function(){
  199 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  200 + layer.msg("请选择时间");
  201 + return;
  202 + }
  203 + line = $("#line").val();
  204 + date = $("#date").val();
  205 + gsdm=$("#gsdm").val();
  206 + fgsdm=$("#fgsdm").val();
  207 + gh=$("#gh").val();
  208 + cl=$("#cl").val();
  209 + lineName=$("#select2-line-container").html();
  210 + var i = layer.load(2);
  211 + $post('/report/workingHours',{gsdm:gsdm,fgsdm:fgsdm,line:line,date:date,gh:gh,cl:cl,lineName:lineName,type:'query'},function(result){
  212 + // 把数据填充到模版中
  213 + var tbodyHtml = template('workingHours',{list:result});
  214 + // 把渲染好的模版html文本追加到表格中
  215 + $('#tbody').html(tbodyHtml);
  216 + layer.close(i);
  217 + })
  218 + });
  219 +
  220 + $("#export").on("click",function(){
  221 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  222 + layer.msg("请选择时间");
  223 + return;
  224 + }
  225 + line = $("#line").val();
  226 + date = $("#date").val();
  227 + gsdm=$("#gsdm").val();
  228 + fgsdm=$("#fgsdm").val();
  229 + gh=$("#gh").val();
  230 + cl=$("#cl").val();
  231 + lineName=$("#select2-line-container").html();
  232 + var i = layer.load(2);
  233 + $post('/report/workingHours',{gsdm:gsdm,fgsdm:fgsdm,line:line,date:date,gh:gh,cl:cl,lineName:lineName,type:'export'},function(result){
  234 + window.open("/downloadFile/download?fileName="
  235 + +moment(date).format("YYYYMMDD")+"-"+lineName+"-工时统计表");
  236 + layer.close(i);
  237 + });
  238 + });
  239 +});
  240 +</script>
  241 +<script type="text/html" id="workingHours">
  242 + {{each list as obj i}}
  243 + <tr>
  244 + <td>{{obj.date}}</td>
  245 + <td>{{obj.gsName}}</td>
  246 + <td>{{obj.fgsName}}</td>
  247 + <td>{{obj.xlName}}</td>
  248 + <td>{{obj.lpName}}</td>
  249 + <td>{{obj.jsy}}</td>
  250 + <td>{{obj.clZbh}}</td>
  251 + <td>{{obj.jhTime}}</td>
  252 + <td>{{obj.sjTime}}</td>
  253 + </tr>
  254 + {{/each}}
  255 + {{if list.length == 0}}
  256 + <tr>
  257 + <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td>
  258 + </tr>
  259 + {{/if}}
  260 +</script>
0 261 \ No newline at end of file
... ...