Commit 1ff7296b85c11f5234337900c516ade403391dd8
Merge branch 'master' into minhang
Showing
26 changed files
with
1721 additions
and
403 deletions
src/main/java/com/bsth/controller/DownloadController.java
| @@ -28,11 +28,10 @@ public class DownloadController | @@ -28,11 +28,10 @@ public class DownloadController | ||
| 28 | { | 28 | { |
| 29 | 29 | ||
| 30 | @RequestMapping("download") | 30 | @RequestMapping("download") |
| 31 | - public ResponseEntity<byte[]> download(String jName,String lpName) throws IOException { | ||
| 32 | - String moudelPath = this.getClass().getResource("/").getPath()+ "static\\pages\\forms\\export\\"+jName+".xls"; | ||
| 33 | -// System.out.println(moudelPath); | ||
| 34 | - String fileName = jName+lpName+".xls"; | ||
| 35 | -// String path="D:\\export\\target\\"+jName+".xls"; | 31 | + public ResponseEntity<byte[]> download(String fileName) throws IOException { |
| 32 | + fileName = fileName+".xls"; | ||
| 33 | + String moudelPath = this.getClass().getResource("/").getPath()+ "static\\pages\\forms\\export\\"+fileName; | ||
| 34 | +// String path="D:\\export\\target\\"+jName+".xls"; | ||
| 36 | File file=new File(moudelPath); | 35 | File file=new File(moudelPath); |
| 37 | HttpHeaders headers = new HttpHeaders(); | 36 | HttpHeaders headers = new HttpHeaders(); |
| 38 | String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 | 37 | String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题 |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -300,8 +300,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -300,8 +300,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | @RequestMapping(value = "/dailyInfo") | 302 | @RequestMapping(value = "/dailyInfo") |
| 303 | - public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date) { | ||
| 304 | - return scheduleRealInfoService.dailyInfo(line, date); | 303 | + public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) { |
| 304 | + return scheduleRealInfoService.dailyInfo(line, date, type); | ||
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | @RequestMapping(value = "/historyMessage") | 307 | @RequestMapping(value = "/historyMessage") |
| @@ -336,9 +336,33 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -336,9 +336,33 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 336 | @RequestParam String endDate,@RequestParam String lpName,@RequestParam String code) { | 336 | @RequestParam String endDate,@RequestParam String lpName,@RequestParam String code) { |
| 337 | return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code); | 337 | return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code); |
| 338 | } | 338 | } |
| 339 | - | 339 | + /** |
| 340 | + * @Title queryListWaybill | ||
| 341 | + * @Description 查询行车路单列表 | ||
| 342 | + * @param jName 驾驶员名字 | ||
| 343 | + * @param clZbh 车辆自编号(内部编号) | ||
| 344 | + * @param lpName 路牌 | ||
| 345 | + * @return | ||
| 346 | + */ | ||
| 340 | @RequestMapping(value="/queryListWaybill") | 347 | @RequestMapping(value="/queryListWaybill") |
| 341 | public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName){ | 348 | public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName){ |
| 342 | return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName); | 349 | return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName); |
| 343 | } | 350 | } |
| 351 | + | ||
| 352 | + @RequestMapping(value="/statisticsDaily") | ||
| 353 | + public List<Map<String,Object>> statisticsDaily(@RequestParam String line,@RequestParam String date,@RequestParam String xlName){ | ||
| 354 | + return scheduleRealInfoService.statisticsDaily(line, date,xlName); | ||
| 355 | + } | ||
| 356 | + | ||
| 357 | + /** | ||
| 358 | + * @Title: scheduleDaily | ||
| 359 | + * @Description: TODO(调度日报表) | ||
| 360 | + * @param line 线路 | ||
| 361 | + * @param date 时间 | ||
| 362 | + * @return | ||
| 363 | + */ | ||
| 364 | + @RequestMapping(value="/scheduleDaily") | ||
| 365 | + public List<Object> scheduleDaily(@RequestParam String line,@RequestParam String date){ | ||
| 366 | + return scheduleRealInfoService.scheduleDaily(line,date); | ||
| 367 | + } | ||
| 344 | } | 368 | } |
src/main/java/com/bsth/controller/sys/UserController.java
| @@ -4,23 +4,30 @@ import javax.servlet.http.HttpServletRequest; | @@ -4,23 +4,30 @@ import javax.servlet.http.HttpServletRequest; | ||
| 4 | import javax.servlet.http.HttpServletResponse; | 4 | import javax.servlet.http.HttpServletResponse; |
| 5 | import javax.servlet.http.HttpSession; | 5 | import javax.servlet.http.HttpSession; |
| 6 | 6 | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | import org.springframework.security.authentication.BadCredentialsException; | 8 | import org.springframework.security.authentication.BadCredentialsException; |
| 8 | import org.springframework.security.core.Authentication; | 9 | import org.springframework.security.core.Authentication; |
| 9 | import org.springframework.security.core.context.SecurityContextHolder; | 10 | import org.springframework.security.core.context.SecurityContextHolder; |
| 11 | +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
| 10 | import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; | 12 | import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; |
| 11 | import org.springframework.security.web.authentication.session.SessionAuthenticationException; | 13 | import org.springframework.security.web.authentication.session.SessionAuthenticationException; |
| 12 | import org.springframework.web.bind.annotation.RequestMapping; | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 15 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 13 | import org.springframework.web.bind.annotation.RestController; | 16 | import org.springframework.web.bind.annotation.RestController; |
| 14 | import org.springframework.web.servlet.ModelAndView; | 17 | import org.springframework.web.servlet.ModelAndView; |
| 15 | 18 | ||
| 16 | import com.bsth.controller.BaseController; | 19 | import com.bsth.controller.BaseController; |
| 17 | import com.bsth.entity.sys.SysUser; | 20 | import com.bsth.entity.sys.SysUser; |
| 18 | import com.bsth.security.util.SecurityUtils; | 21 | import com.bsth.security.util.SecurityUtils; |
| 22 | +import com.bsth.service.sys.SysUserService; | ||
| 19 | 23 | ||
| 20 | @RestController | 24 | @RestController |
| 21 | @RequestMapping("user") | 25 | @RequestMapping("user") |
| 22 | public class UserController extends BaseController<SysUser, Integer>{ | 26 | public class UserController extends BaseController<SysUser, Integer>{ |
| 23 | 27 | ||
| 28 | + @Autowired | ||
| 29 | + SysUserService sysUserService; | ||
| 30 | + | ||
| 24 | /** | 31 | /** |
| 25 | * | 32 | * |
| 26 | * @Title: loginFailure | 33 | * @Title: loginFailure |
| @@ -65,4 +72,45 @@ public class UserController extends BaseController<SysUser, Integer>{ | @@ -65,4 +72,45 @@ public class UserController extends BaseController<SysUser, Integer>{ | ||
| 65 | public SysUser currentUser(){ | 72 | public SysUser currentUser(){ |
| 66 | return SecurityUtils.getCurrentUser(); | 73 | return SecurityUtils.getCurrentUser(); |
| 67 | } | 74 | } |
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @Title changeEnabled | ||
| 78 | + * @Description: TODO(改变用户状态) | ||
| 79 | + * @param id 用户ID | ||
| 80 | + * @param enabled 状态 | ||
| 81 | + * @return | ||
| 82 | + */ | ||
| 83 | + @RequestMapping("/changeEnabled") | ||
| 84 | + public int changeEnabled(@RequestParam int id,@RequestParam int enabled){ | ||
| 85 | + return sysUserService.changeEnabled(id,enabled); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * @Title changePWD | ||
| 90 | + * @Description: TODO(修改密码) | ||
| 91 | + * @param oldPWD 原始密码 | ||
| 92 | + * @param newwPWD 新密码 | ||
| 93 | + * @param cnewPWD 确认新密码 | ||
| 94 | + * @return | ||
| 95 | + */ | ||
| 96 | + @RequestMapping("/changePWD") | ||
| 97 | + public String changePWD(@RequestParam String oldPWD,@RequestParam String newPWD,@RequestParam String cnewPWD){ | ||
| 98 | + SysUser sysUser = SecurityUtils.getCurrentUser(); | ||
| 99 | + String msg = ""; | ||
| 100 | + if(new BCryptPasswordEncoder(4).matches(oldPWD, sysUser.getPassword())){ | ||
| 101 | + if(oldPWD.equals(newPWD)){ | ||
| 102 | + msg = "新密码不能跟原始密码一样!"; | ||
| 103 | + }else{ | ||
| 104 | + if(newPWD.equals(cnewPWD)){ | ||
| 105 | + sysUserService.changePWD(sysUser.getId(),newPWD); | ||
| 106 | + msg = "修改成功!"; | ||
| 107 | + }else{ | ||
| 108 | + msg= "新密码两次输入不一致!"; | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + }else{ | ||
| 112 | + msg = "原始密码错误!"; | ||
| 113 | + } | ||
| 114 | + return msg; | ||
| 115 | + } | ||
| 68 | } | 116 | } |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -54,4 +54,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -54,4 +54,10 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 54 | 54 | ||
| 55 | @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by fcsj") | 55 | @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 order by fcsj") |
| 56 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName); | 56 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName); |
| 57 | + | ||
| 58 | + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") | ||
| 59 | + List<ScheduleRealInfo> statisticsDaily(String line,String date); | ||
| 60 | + | ||
| 61 | + @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") | ||
| 62 | + List<ScheduleRealInfo> scheduleDaily(String line,String date); | ||
| 57 | } | 63 | } |
src/main/java/com/bsth/repository/sys/SysUserRepository.java
| 1 | package com.bsth.repository.sys; | 1 | package com.bsth.repository.sys; |
| 2 | 2 | ||
| 3 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 4 | +import org.springframework.data.jpa.repository.Query; | ||
| 3 | import org.springframework.stereotype.Repository; | 5 | import org.springframework.stereotype.Repository; |
| 6 | +import org.springframework.transaction.annotation.Transactional; | ||
| 4 | 7 | ||
| 5 | import com.bsth.entity.sys.SysUser; | 8 | import com.bsth.entity.sys.SysUser; |
| 6 | import com.bsth.repository.BaseRepository; | 9 | import com.bsth.repository.BaseRepository; |
| @@ -10,4 +13,13 @@ public interface SysUserRepository extends BaseRepository<SysUser, Integer>{ | @@ -10,4 +13,13 @@ public interface SysUserRepository extends BaseRepository<SysUser, Integer>{ | ||
| 10 | 13 | ||
| 11 | SysUser findByUserName(String userName); | 14 | SysUser findByUserName(String userName); |
| 12 | 15 | ||
| 16 | + @Transactional | ||
| 17 | + @Modifying | ||
| 18 | + @Query(value="update bsth_c_sys_user set enabled=?2 where id=?1",nativeQuery=true) | ||
| 19 | + int changeEnabled(int id,int enabled); | ||
| 20 | + | ||
| 21 | + @Transactional | ||
| 22 | + @Modifying | ||
| 23 | + @Query(value="update bsth_c_sys_user set password=?2 where id=?1",nativeQuery=true) | ||
| 24 | + int changePWD(int id,String newPWD); | ||
| 13 | } | 25 | } |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -62,7 +62,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -62,7 +62,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 62 | 62 | ||
| 63 | List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); | 63 | List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName); |
| 64 | 64 | ||
| 65 | - List<Map<String,Object>> dailyInfo(String line,String date); | 65 | + List<Map<String,Object>> dailyInfo(String line,String date,String type); |
| 66 | 66 | ||
| 67 | List<Object[]> historyMessage(String line,String date,String code); | 67 | List<Object[]> historyMessage(String line,String date,String code); |
| 68 | 68 | ||
| @@ -95,4 +95,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -95,4 +95,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 95 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName); | 95 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName); |
| 96 | 96 | ||
| 97 | Map<String, Object> removeChildTask(Long taskId); | 97 | Map<String, Object> removeChildTask(Long taskId); |
| 98 | + | ||
| 99 | + List<Map<String,Object>> statisticsDaily(String line,String date,String xlName); | ||
| 100 | + | ||
| 101 | + List<Object> scheduleDaily(String line,String date); | ||
| 98 | } | 102 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -42,7 +42,9 @@ import com.bsth.service.SectionRouteService; | @@ -42,7 +42,9 @@ import com.bsth.service.SectionRouteService; | ||
| 42 | import com.bsth.service.impl.BaseServiceImpl; | 42 | import com.bsth.service.impl.BaseServiceImpl; |
| 43 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 43 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 44 | import com.bsth.service.realcontrol.buffer.ScheduleBuffer; | 44 | import com.bsth.service.realcontrol.buffer.ScheduleBuffer; |
| 45 | +import com.bsth.util.ReportRelatedUtils; | ||
| 45 | import com.bsth.util.ReportUtils; | 46 | import com.bsth.util.ReportUtils; |
| 47 | +import com.bsth.util.TimeUtils; | ||
| 46 | import com.bsth.util.TransGPS; | 48 | import com.bsth.util.TransGPS; |
| 47 | import com.bsth.util.TransGPS.Location; | 49 | import com.bsth.util.TransGPS.Location; |
| 48 | import com.bsth.vehicle.BorrowCenter; | 50 | import com.bsth.vehicle.BorrowCenter; |
| @@ -87,7 +89,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -87,7 +89,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 87 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 89 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 88 | 90 | ||
| 89 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | 91 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| 90 | - sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"); | 92 | + sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"), sdfShort = new SimpleDateFormat("HH:mm"), |
| 93 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | ||
| 91 | 94 | ||
| 92 | @Override | 95 | @Override |
| 93 | public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { | 96 | public Map<String, Collection<ScheduleRealInfo>> findByLines(String lines) { |
| @@ -426,13 +429,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -426,13 +429,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 426 | public List<ScheduleRealInfo> queryUserInfo(String line, String date) { | 429 | public List<ScheduleRealInfo> queryUserInfo(String line, String date) { |
| 427 | return scheduleRealInfoRepository.queryUserInfo(line, date); | 430 | return scheduleRealInfoRepository.queryUserInfo(line, date); |
| 428 | } | 431 | } |
| 429 | - | 432 | + /** |
| 433 | + * | ||
| 434 | + */ | ||
| 430 | @Override | 435 | @Override |
| 431 | public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName) { | 436 | public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName) { |
| 432 | ReportUtils ee = new ReportUtils(); | 437 | ReportUtils ee = new ReportUtils(); |
| 438 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | ||
| 433 | List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | 439 | List<Iterator<?>> list = new ArrayList<Iterator<?>>(); |
| 434 | List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.exportWaybill(jName, clZbh, lpName); | 440 | List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.exportWaybill(jName, clZbh, lpName); |
| 435 | - ScheduleRealInfo scheduleReal = scheduleRealInfoRepository.findOne(scheduleRealInfos.get(0).getId()); | 441 | + List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>(); |
| 436 | 442 | ||
| 437 | DecimalFormat format = new DecimalFormat("0.00"); | 443 | DecimalFormat format = new DecimalFormat("0.00"); |
| 438 | int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | 444 | int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); |
| @@ -440,7 +446,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -440,7 +446,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 440 | int jhbc = 0; | 446 | int jhbc = 0; |
| 441 | double jhlc = 0; | 447 | double jhlc = 0; |
| 442 | float realMileage = 0l,addMileage = 0l,remMileage = 0l; | 448 | float realMileage = 0l,addMileage = 0l,remMileage = 0l; |
| 443 | - Map<String,Object> map = new HashMap<String, Object>(); | 449 | + |
| 450 | + Map<String,Object> map; | ||
| 444 | for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){ | 451 | for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){ |
| 445 | if(scheduleRealInfo != null){ | 452 | if(scheduleRealInfo != null){ |
| 446 | jhlc += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | 453 | jhlc += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); |
| @@ -448,8 +455,34 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -448,8 +455,34 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 448 | addMileage += scheduleRealInfo.getAddMileage()==null?0:scheduleRealInfo.getAddMileage(); | 455 | addMileage += scheduleRealInfo.getAddMileage()==null?0:scheduleRealInfo.getAddMileage(); |
| 449 | remMileage += scheduleRealInfo.getRemMileage()==null?0:scheduleRealInfo.getRemMileage(); | 456 | remMileage += scheduleRealInfo.getRemMileage()==null?0:scheduleRealInfo.getRemMileage(); |
| 450 | jhbc++; | 457 | jhbc++; |
| 458 | + | ||
| 459 | + map = new HashMap<String, Object>(); | ||
| 460 | + try { | ||
| 461 | + map = rru.getMapValue(scheduleRealInfo); | ||
| 462 | + String zdsj = scheduleRealInfo.getZdsj(); | ||
| 463 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | ||
| 464 | + if(zdsj != null && zdsjActual != null && | ||
| 465 | + !zdsj.equals(zdsjActual)){ | ||
| 466 | + if(zdsj.compareTo(zdsjActual) > 0){ | ||
| 467 | + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | ||
| 468 | + map.put("slow", ""); | ||
| 469 | + } else { | ||
| 470 | + map.put("fast", ""); | ||
| 471 | + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | ||
| 472 | + } | ||
| 473 | + } else { | ||
| 474 | + map.put("fast", ""); | ||
| 475 | + map.put("slow", ""); | ||
| 476 | + } | ||
| 477 | + listMap.add(map); | ||
| 478 | + } catch (Exception e) { | ||
| 479 | + e.printStackTrace(); | ||
| 480 | + } | ||
| 451 | } | 481 | } |
| 452 | } | 482 | } |
| 483 | + | ||
| 484 | + //计算里程和班次数,并放入Map里 | ||
| 485 | + map = new HashMap<String, Object>(); | ||
| 453 | map.put("jhlc", format.format(jhlc)); | 486 | map.put("jhlc", format.format(jhlc)); |
| 454 | map.put("remMileage", format.format(remMileage)); | 487 | map.put("remMileage", format.format(remMileage)); |
| 455 | map.put("addMileage", format.format(addMileage)); | 488 | map.put("addMileage", format.format(addMileage)); |
| @@ -463,19 +496,50 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -463,19 +496,50 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 463 | 496 | ||
| 464 | String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | 497 | String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; |
| 465 | 498 | ||
| 466 | - list.add(scheduleRealInfos.iterator()); | ||
| 467 | - ee.excelReplace(list, new Object[] { scheduleReal,map }, path+"mould\\waybill.xls", | 499 | + list.add(listMap.iterator()); |
| 500 | + ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould\\waybill.xls", | ||
| 468 | path+"export\\" + jName + ".xls"); | 501 | path+"export\\" + jName + ".xls"); |
| 469 | return scheduleRealInfos; | 502 | return scheduleRealInfos; |
| 470 | } | 503 | } |
| 471 | 504 | ||
| 472 | @Override | 505 | @Override |
| 473 | - public List<Map<String, Object>> dailyInfo(String line, String date) { | 506 | + public List<Map<String, Object>> dailyInfo(String line, String date,String type) { |
| 474 | DecimalFormat format = new DecimalFormat("0.00"); | 507 | DecimalFormat format = new DecimalFormat("0.00"); |
| 508 | + ReportUtils ee = new ReportUtils(); | ||
| 509 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | ||
| 475 | List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date); | 510 | List<Map<String, Object>> list = scheduleRealInfoRepository.dailyInfo(line, date); |
| 511 | + | ||
| 512 | + double totalZGL = 0,totalKSGL=0,totalYH=0; | ||
| 513 | + int totalBCS=0; | ||
| 476 | for(int i = 0;i < list.size();i++){ | 514 | for(int i = 0;i < list.size();i++){ |
| 477 | - list.get(i).put("zgl", format.format(Double.parseDouble(list.get(i).get("zgl")==null?"0":list.get(i).get("zgl").toString()))); | ||
| 478 | - list.get(i).put("ksgl", format.format(Double.parseDouble(list.get(i).get("ksgl")==null?"0":list.get(i).get("ksgl").toString()))); | 515 | + String zgl = format.format(Double.parseDouble(list.get(i).get("zgl")==null?"0":list.get(i).get("zgl").toString())); |
| 516 | + String ksgl = format.format(Double.parseDouble(list.get(i).get("ksgl")==null?"0":list.get(i).get("ksgl").toString())); | ||
| 517 | + if(type.equals("export")){ | ||
| 518 | + totalZGL += Double.parseDouble(zgl); | ||
| 519 | + totalKSGL += Double.parseDouble(ksgl); | ||
| 520 | + totalBCS += Integer.parseInt(list.get(i).get("bcs").toString()); | ||
| 521 | + } | ||
| 522 | + list.get(i).put("zgl", zgl); | ||
| 523 | + list.get(i).put("ksgl", ksgl); | ||
| 524 | + } | ||
| 525 | + if(type.equals("export")){ | ||
| 526 | + Map<String,Object> map = new HashMap<String, Object>(); | ||
| 527 | + map.put("line", line); | ||
| 528 | + map.put("date", date); | ||
| 529 | + map.put("totalZGL", totalZGL); | ||
| 530 | + map.put("totalKSGL", totalKSGL); | ||
| 531 | + map.put("totalYH", totalYH); | ||
| 532 | + map.put("totalBCS", totalBCS); | ||
| 533 | + | ||
| 534 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | ||
| 535 | + | ||
| 536 | + listI.add(list.iterator()); | ||
| 537 | + try { | ||
| 538 | + ee.excelReplace(listI, new Object[] { map }, path+"mould\\daily.xls", | ||
| 539 | + path+"export\\班次日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | ||
| 540 | + } catch (ParseException e) { | ||
| 541 | + e.printStackTrace(); | ||
| 542 | + } | ||
| 479 | } | 543 | } |
| 480 | return list; | 544 | return list; |
| 481 | } | 545 | } |
| @@ -907,9 +971,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -907,9 +971,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 907 | map.put("jhlc", format.format(jhlc)); | 971 | map.put("jhlc", format.format(jhlc)); |
| 908 | map.put("remMileage", format.format(remMileage)); | 972 | map.put("remMileage", format.format(remMileage)); |
| 909 | map.put("addMileage", format.format(addMileage)); | 973 | map.put("addMileage", format.format(addMileage)); |
| 910 | - map.put("yygl", format.format(realMileage-addMileage)); | 974 | + map.put("yygl", format.format(jhlc)); |
| 911 | map.put("ksgl", format.format(realMileage-addMileage)); | 975 | map.put("ksgl", format.format(realMileage-addMileage)); |
| 912 | - map.put("realMileage", format.format(realMileage)); | 976 | + map.put("realMileage", format.format(jhlc)); |
| 913 | map.put("jhbc", jhbc); | 977 | map.put("jhbc", jhbc); |
| 914 | map.put("cjbc", cjbc); | 978 | map.put("cjbc", cjbc); |
| 915 | map.put("ljbc", ljbc); | 979 | map.put("ljbc", ljbc); |
| @@ -967,4 +1031,40 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -967,4 +1031,40 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 967 | } | 1031 | } |
| 968 | return rs; | 1032 | return rs; |
| 969 | } | 1033 | } |
| 1034 | + | ||
| 1035 | + @Override | ||
| 1036 | + public List<Map<String, Object>> statisticsDaily(String line, String date, | ||
| 1037 | + String xlName) { | ||
| 1038 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.statisticsDaily(line, date); | ||
| 1039 | + double jhlc = 0.00; | ||
| 1040 | + float realMileage = 0l; | ||
| 1041 | + for(ScheduleRealInfo scheduleRealInfo: list){ | ||
| 1042 | + if(scheduleRealInfo != null){ | ||
| 1043 | + jhlc += scheduleRealInfo.getJhlc(); | ||
| 1044 | + if(scheduleRealInfo.getsName().equals("1")){ | ||
| 1045 | + realMileage += scheduleRealInfo.getRealMileage(); | ||
| 1046 | + } | ||
| 1047 | + } | ||
| 1048 | + } | ||
| 1049 | + return null; | ||
| 1050 | + } | ||
| 1051 | + | ||
| 1052 | + @Override | ||
| 1053 | + public List<Object> scheduleDaily(String line, String date) { | ||
| 1054 | + Map<String,String> tempMap = null; | ||
| 1055 | + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.scheduleDaily(line, date); | ||
| 1056 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 1057 | + Double jhlc = 0.00; | ||
| 1058 | + for(ScheduleRealInfo scheduleRealInfo:scheduleRealInfos){ | ||
| 1059 | + if(scheduleRealInfo != null){ | ||
| 1060 | + jhlc += scheduleRealInfo.getJhlc(); | ||
| 1061 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | ||
| 1062 | + if(childTaskPlans.isEmpty()){ | ||
| 1063 | + | ||
| 1064 | + } | ||
| 1065 | + } | ||
| 1066 | + } | ||
| 1067 | + map.put("jhlc", jhlc); | ||
| 1068 | + return null; | ||
| 1069 | + } | ||
| 970 | } | 1070 | } |
src/main/java/com/bsth/service/sys/SysUserService.java
| @@ -6,4 +6,8 @@ import com.bsth.service.BaseService; | @@ -6,4 +6,8 @@ import com.bsth.service.BaseService; | ||
| 6 | public interface SysUserService extends BaseService<SysUser, Integer>{ | 6 | public interface SysUserService extends BaseService<SysUser, Integer>{ |
| 7 | 7 | ||
| 8 | SysUser findByUserName(String name); | 8 | SysUser findByUserName(String name); |
| 9 | + | ||
| 10 | + int changeEnabled(int id,int enabled); | ||
| 11 | + | ||
| 12 | + int changePWD(int id,String newPWD); | ||
| 9 | } | 13 | } |
src/main/java/com/bsth/service/sys/impl/SysUserServiceImpl.java
| 1 | package com.bsth.service.sys.impl; | 1 | package com.bsth.service.sys.impl; |
| 2 | 2 | ||
| 3 | +import java.util.Map; | ||
| 4 | + | ||
| 3 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
| 4 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
| 5 | 8 | ||
| 6 | import com.bsth.entity.sys.SysUser; | 9 | import com.bsth.entity.sys.SysUser; |
| @@ -18,4 +21,22 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implem | @@ -18,4 +21,22 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUser, Integer> implem | ||
| 18 | public SysUser findByUserName(String name) { | 21 | public SysUser findByUserName(String name) { |
| 19 | return sysUserRepository.findByUserName(name); | 22 | return sysUserRepository.findByUserName(name); |
| 20 | } | 23 | } |
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public Map<String, Object> save(SysUser t) { | ||
| 27 | + // | ||
| 28 | + t.setPassword(new BCryptPasswordEncoder(4).encode(t.getPassword())); | ||
| 29 | + return super.save(t); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public int changeEnabled(int id, int enabled) { | ||
| 34 | + sysUserRepository.changeEnabled(id,enabled); | ||
| 35 | + return 0; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public int changePWD(int id,String newPWD) { | ||
| 40 | + return sysUserRepository.changePWD(id,new BCryptPasswordEncoder(4).encode(newPWD)); | ||
| 41 | + } | ||
| 21 | } | 42 | } |
src/main/java/com/bsth/util/ReportRelatedUtils.java
| 1 | package com.bsth.util; | 1 | package com.bsth.util; |
| 2 | 2 | ||
| 3 | +import java.lang.reflect.Field; | ||
| 3 | import java.lang.reflect.InvocationTargetException; | 4 | import java.lang.reflect.InvocationTargetException; |
| 4 | import java.lang.reflect.Method; | 5 | import java.lang.reflect.Method; |
| 6 | +import java.util.HashMap; | ||
| 7 | +import java.util.Map; | ||
| 8 | + | ||
| 9 | +import org.apache.poi.ss.formula.functions.T; | ||
| 5 | 10 | ||
| 6 | import com.bsth.entity.Line; | 11 | import com.bsth.entity.Line; |
| 7 | 12 | ||
| @@ -52,6 +57,42 @@ public class ReportRelatedUtils { | @@ -52,6 +57,42 @@ public class ReportRelatedUtils { | ||
| 52 | } | 57 | } |
| 53 | return value; | 58 | return value; |
| 54 | } | 59 | } |
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 通过字段名取到对象中该字段的相应值 | ||
| 63 | + * | ||
| 64 | + * @param t | ||
| 65 | + * 对象 | ||
| 66 | + * @param fieldName | ||
| 67 | + * 字段名 | ||
| 68 | + * @return | ||
| 69 | + * @throws ClassNotFoundException | ||
| 70 | + * @throws IllegalAccessException | ||
| 71 | + * @throws InvocationTargetException | ||
| 72 | + * @throws NoSuchMethodException | ||
| 73 | + * @throws NoSuchFieldException | ||
| 74 | + */ | ||
| 75 | + public Map<String,Object> getMapValue(Object t) | ||
| 76 | + throws ClassNotFoundException, IllegalAccessException, | ||
| 77 | + InvocationTargetException, NoSuchMethodException, | ||
| 78 | + NoSuchFieldException { | ||
| 79 | + Map<String,Object> map = new HashMap<String, Object>(); | ||
| 80 | + Object value = ""; | ||
| 81 | + Field[] fields = t.getClass().getDeclaredFields(); | ||
| 82 | + for(Field field:fields){ | ||
| 83 | + String fieldName = field.getName(); | ||
| 84 | + String tmpFieldName = firstCharToUpperCase(fieldName); | ||
| 85 | + Method method = null; | ||
| 86 | + try { | ||
| 87 | + method = t.getClass().getMethod("get" + tmpFieldName); | ||
| 88 | + value = method.invoke(t)==null?"":method.invoke(t); | ||
| 89 | + } catch (NoSuchMethodException e) { | ||
| 90 | + value = ""; | ||
| 91 | + } | ||
| 92 | + map.put(fieldName, value); | ||
| 93 | + } | ||
| 94 | + return map; | ||
| 95 | + } | ||
| 55 | 96 | ||
| 56 | /** | 97 | /** |
| 57 | * 首字母大写 | 98 | * 首字母大写 |
src/main/java/com/bsth/util/ReportUtils.java
| @@ -279,6 +279,9 @@ public class ReportUtils { | @@ -279,6 +279,9 @@ public class ReportUtils { | ||
| 279 | } | 279 | } |
| 280 | } else if (obj.getClass().getName().equals(classWholeName)) { | 280 | } else if (obj.getClass().getName().equals(classWholeName)) { |
| 281 | cellValue = cellValue.replace("$" + tmpKey + "$",getKeyValue(obj, fieldName) + ""); | 281 | cellValue = cellValue.replace("$" + tmpKey + "$",getKeyValue(obj, fieldName) + ""); |
| 282 | + } else if (obj.getClass().getName().equals("java.util.HashMap")){ | ||
| 283 | + Map<String,Object> map = (HashMap<String,Object>)obj; | ||
| 284 | + cellValue = cellValue.replace("$" + tmpKey + "$",map.get(fieldName)+""); | ||
| 282 | } | 285 | } |
| 283 | } | 286 | } |
| 284 | } | 287 | } |
src/main/java/com/bsth/util/TimeUtils.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +public class TimeUtils { | ||
| 4 | + public static String getTimeDifference(String date1,String date2){ | ||
| 5 | + String[] temp1 = date1.split(":"); | ||
| 6 | + String[] temp2 = date2.split(":"); | ||
| 7 | + int m1 = Integer.parseInt(temp1[0])*60; | ||
| 8 | + int s1 = Integer.parseInt(temp1[1]); | ||
| 9 | + int m2 = Integer.parseInt(temp2[0])*60; | ||
| 10 | + int s2 = Integer.parseInt(temp2[1]); | ||
| 11 | + if(date1.compareTo(date2) > 0){ | ||
| 12 | + return ((m1+s1)-(m2+s2))+""; | ||
| 13 | + } else { | ||
| 14 | + return ((m2+s2)-(m1+s1))+""; | ||
| 15 | + } | ||
| 16 | + } | ||
| 17 | +} |
src/main/resources/static/index.html
| @@ -166,6 +166,10 @@ tr.row-active td { | @@ -166,6 +166,10 @@ tr.row-active td { | ||
| 166 | <a href="javascript:;"> | 166 | <a href="javascript:;"> |
| 167 | <i class="fa fa-user"></i> 我的信息 </a> | 167 | <i class="fa fa-user"></i> 我的信息 </a> |
| 168 | </li> | 168 | </li> |
| 169 | + <li> | ||
| 170 | + <a href="javascript:;" id="changePWD"> | ||
| 171 | + <i class="fa fa-unlock-alt"></i> 修改密码</a> | ||
| 172 | + </li> | ||
| 169 | <li class="divider"> </li> | 173 | <li class="divider"> </li> |
| 170 | <li> | 174 | <li> |
| 171 | <a href="javascript:;"> | 175 | <a href="javascript:;"> |
| @@ -391,6 +395,22 @@ $(function(){ | @@ -391,6 +395,22 @@ $(function(){ | ||
| 391 | loadPage('/pages/home.html'); | 395 | loadPage('/pages/home.html'); |
| 392 | } | 396 | } |
| 393 | }); | 397 | }); |
| 398 | + | ||
| 399 | + //修改密码 | ||
| 400 | + $('#changePWD').on('click', function(){ | ||
| 401 | + $.get('/pages/permission/user/changePWD.html', function(content){ | ||
| 402 | + layer.open({ | ||
| 403 | + type: 1, | ||
| 404 | + area: ['600px','360px'], | ||
| 405 | + content: content, | ||
| 406 | + title : '修改密码', | ||
| 407 | + shift: 5, | ||
| 408 | + scrollbar: false, | ||
| 409 | + success: function(){ | ||
| 410 | + } | ||
| 411 | + }); | ||
| 412 | + }); | ||
| 413 | + }); | ||
| 394 | }); | 414 | }); |
| 395 | 415 | ||
| 396 | //modal关闭时销毁dom | 416 | //modal关闭时销毁dom |
src/main/resources/static/pages/forms/mould/daily.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/waybill.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/daily.html
| @@ -130,10 +130,12 @@ | @@ -130,10 +130,12 @@ | ||
| 130 | } | 130 | } |
| 131 | }); | 131 | }); |
| 132 | 132 | ||
| 133 | + var line; | ||
| 134 | + var date; | ||
| 133 | $("#query").on("click",function(){ | 135 | $("#query").on("click",function(){ |
| 134 | - var line = $("#line").val(); | ||
| 135 | - var date = $("#date").val(); | ||
| 136 | - $get('/realSchedule/dailyInfo',{line:line,date:date},function(result){ | 136 | + line = $("#line").val(); |
| 137 | + date = $("#date").val(); | ||
| 138 | + $get('/realSchedule/dailyInfo',{line:line,date:date,type:'query'},function(result){ | ||
| 137 | $("#form_line").text(line); | 139 | $("#form_line").text(line); |
| 138 | $("#form_date").text(date); | 140 | $("#form_date").text(date); |
| 139 | var total_zgl = 0,total_ksgl = 0,total_yh = 0,total_bcs = 0; | 141 | var total_zgl = 0,total_ksgl = 0,total_yh = 0,total_bcs = 0; |
| @@ -153,6 +155,11 @@ | @@ -153,6 +155,11 @@ | ||
| 153 | // 把渲染好的模版html文本追加到表格中 | 155 | // 把渲染好的模版html文本追加到表格中 |
| 154 | $('#forms .dailyInfo').html(tbodyHtml); | 156 | $('#forms .dailyInfo').html(tbodyHtml); |
| 155 | }); | 157 | }); |
| 158 | + }); | ||
| 159 | + $("#export").on("click",function(){ | ||
| 160 | + $get('/realSchedule/dailyInfo',{line:line,date:date,type:'export'},function(result){ | ||
| 161 | + window.open("/downloadFile/download?fileName=班次日报"+moment(date).format("YYYYMMDD")); | ||
| 162 | + }); | ||
| 156 | }); | 163 | }); |
| 157 | }); | 164 | }); |
| 158 | </script> | 165 | </script> |
src/main/resources/static/pages/forms/statement/historyMessage.html
| @@ -168,8 +168,8 @@ | @@ -168,8 +168,8 @@ | ||
| 168 | $('#forms tbody').html(tbodyHtml); | 168 | $('#forms tbody').html(tbodyHtml); |
| 169 | }); | 169 | }); |
| 170 | }); | 170 | }); |
| 171 | - $("#export").click(function(){ | ||
| 172 | - $('#forms').tableExport({ type: 'excel', escape: 'false' }); | 171 | + $("#export").on("click",function(){ |
| 172 | + $('#forms').tableExport({ type: 'excel', escape: 'false',filename:'(2016-02-29_2016-03-06)'}); | ||
| 173 | }); | 173 | }); |
| 174 | 174 | ||
| 175 | }); | 175 | }); |
| @@ -191,7 +191,4 @@ | @@ -191,7 +191,4 @@ | ||
| 191 | <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> | 191 | <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> |
| 192 | </tr> | 192 | </tr> |
| 193 | {{/if}} | 193 | {{/if}} |
| 194 | -</script> | ||
| 195 | - | ||
| 196 | -<script src="/pages/forms/statement/js/tableExport.js"></script> | ||
| 197 | -<script src="/pages/forms/statement/js/jquery.base64.js"></script> | ||
| 198 | \ No newline at end of file | 194 | \ No newline at end of file |
| 195 | +</script> | ||
| 199 | \ No newline at end of file | 196 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/js/tableExport.js
| 1 | -/*The MIT License (MIT) | ||
| 2 | - | ||
| 3 | -Copyright (c) 2014 https://github.com/kayalshri/ | ||
| 4 | - | ||
| 5 | -Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 6 | -of this software and associated documentation files (the "Software"), to deal | ||
| 7 | -in the Software without restriction, including without limitation the rights | ||
| 8 | -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 9 | -copies of the Software, and to permit persons to whom the Software is | ||
| 10 | -furnished to do so, subject to the following conditions: | ||
| 11 | - | ||
| 12 | -The above copyright notice and this permission notice shall be included in | ||
| 13 | -all copies or substantial portions of the Software. | ||
| 14 | - | ||
| 15 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 18 | -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 20 | -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 21 | -THE SOFTWARE.*/ | ||
| 22 | - | 1 | +// 此函数引用自: http://www.alloyteam.com/2014/01/use-js-file-download/ |
| 2 | +function downloadFile(fileName, content){ | ||
| 3 | + var aLink = document.createElement('a'); | ||
| 4 | + var blob = new Blob([content]); | ||
| 5 | + var evt = document.createEvent("HTMLEvents"); | ||
| 6 | + evt.initEvent("click", false, false);//initEvent 不加后两个参数在FF下会报错, 感谢 Barret Lee 的反馈 | ||
| 7 | + aLink.download = fileName; | ||
| 8 | + aLink.href = URL.createObjectURL(blob); | ||
| 9 | + aLink.dispatchEvent(evt); | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | + | ||
| 23 | (function($){ | 13 | (function($){ |
| 24 | - $.fn.extend({ | ||
| 25 | - tableExport: function(options) { | ||
| 26 | - var defaults = { | ||
| 27 | - separator: ',', | ||
| 28 | - ignoreColumn: [], | ||
| 29 | - tableName:'yourTableName', | ||
| 30 | - type:'csv', | ||
| 31 | - pdfFontSize:14, | ||
| 32 | - pdfLeftMargin:20, | ||
| 33 | - escape:'true', | ||
| 34 | - htmlContent:'false', | ||
| 35 | - consoleLog:'false' | ||
| 36 | - }; | ||
| 37 | - | ||
| 38 | - var options = $.extend(defaults, options); | ||
| 39 | - var el = this; | ||
| 40 | - | ||
| 41 | - if(defaults.type == 'csv' || defaults.type == 'txt'){ | ||
| 42 | - | ||
| 43 | - // Header | ||
| 44 | - var tdData =""; | ||
| 45 | - $(el).find('thead').find('tr').each(function() { | ||
| 46 | - tdData += "\n"; | ||
| 47 | - $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 48 | - if ($(this).css('display') != 'none'){ | ||
| 49 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 50 | - tdData += '"' + parseString($(this)) + '"' + defaults.separator; | ||
| 51 | - } | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - }); | ||
| 55 | - tdData = $.trim(tdData); | ||
| 56 | - tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 57 | - }); | ||
| 58 | - | ||
| 59 | - // Row vs Column | ||
| 60 | - $(el).find('tbody').find('tr').each(function() { | ||
| 61 | - tdData += "\n"; | ||
| 62 | - $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 63 | - if ($(this).css('display') != 'none'){ | ||
| 64 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 65 | - tdData += '"'+ parseString($(this)) + '"'+ defaults.separator; | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - }); | ||
| 69 | - //tdData = $.trim(tdData); | ||
| 70 | - tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 71 | - }); | ||
| 72 | - | ||
| 73 | - //output | ||
| 74 | - if(defaults.consoleLog == 'true'){ | ||
| 75 | - console.log(tdData); | ||
| 76 | - } | ||
| 77 | - var base64data = "base64," + $.base64.encode(tdData); | ||
| 78 | - window.open('data:application/'+defaults.type+';filename=exportData;' + base64data); | ||
| 79 | - }else if(defaults.type == 'sql'){ | ||
| 80 | - | ||
| 81 | - // Header | ||
| 82 | - var tdData ="INSERT INTO `"+defaults.tableName+"` ("; | ||
| 83 | - $(el).find('thead').find('tr').each(function() { | ||
| 84 | - | ||
| 85 | - $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 86 | - if ($(this).css('display') != 'none'){ | ||
| 87 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 88 | - tdData += '`' + parseString($(this)) + '`,' ; | ||
| 89 | - } | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - }); | ||
| 93 | - tdData = $.trim(tdData); | ||
| 94 | - tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 95 | - }); | ||
| 96 | - tdData += ") VALUES "; | ||
| 97 | - // Row vs Column | ||
| 98 | - $(el).find('tbody').find('tr').each(function() { | ||
| 99 | - tdData += "("; | ||
| 100 | - $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 101 | - if ($(this).css('display') != 'none'){ | ||
| 102 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 103 | - tdData += '"'+ parseString($(this)) + '",'; | ||
| 104 | - } | ||
| 105 | - } | ||
| 106 | - }); | ||
| 107 | - | ||
| 108 | - tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 109 | - tdData += "),"; | ||
| 110 | - }); | ||
| 111 | - tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 112 | - tdData += ";"; | ||
| 113 | - | ||
| 114 | - //output | ||
| 115 | - //console.log(tdData); | ||
| 116 | - | ||
| 117 | - if(defaults.consoleLog == 'true'){ | ||
| 118 | - console.log(tdData); | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - var base64data = "base64," + $.base64.encode(tdData); | ||
| 122 | - window.open('data:application/sql;filename=exportData;' + base64data); | ||
| 123 | - | ||
| 124 | - | ||
| 125 | - }else if(defaults.type == 'json'){ | ||
| 126 | - | ||
| 127 | - var jsonHeaderArray = []; | ||
| 128 | - $(el).find('thead').find('tr').each(function() { | ||
| 129 | - var tdData =""; | ||
| 130 | - var jsonArrayTd = []; | ||
| 131 | - | ||
| 132 | - $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 133 | - if ($(this).css('display') != 'none'){ | ||
| 134 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 135 | - jsonArrayTd.push(parseString($(this))); | ||
| 136 | - } | ||
| 137 | - } | ||
| 138 | - }); | ||
| 139 | - jsonHeaderArray.push(jsonArrayTd); | ||
| 140 | - | ||
| 141 | - }); | ||
| 142 | - | ||
| 143 | - var jsonArray = []; | ||
| 144 | - $(el).find('tbody').find('tr').each(function() { | ||
| 145 | - var tdData =""; | ||
| 146 | - var jsonArrayTd = []; | ||
| 147 | - | ||
| 148 | - $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 149 | - if ($(this).css('display') != 'none'){ | ||
| 150 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 151 | - jsonArrayTd.push(parseString($(this))); | ||
| 152 | - } | ||
| 153 | - } | ||
| 154 | - }); | ||
| 155 | - jsonArray.push(jsonArrayTd); | ||
| 156 | - | ||
| 157 | - }); | ||
| 158 | - | ||
| 159 | - var jsonExportArray =[]; | ||
| 160 | - jsonExportArray.push({header:jsonHeaderArray,data:jsonArray}); | ||
| 161 | - | ||
| 162 | - //Return as JSON | ||
| 163 | - //console.log(JSON.stringify(jsonExportArray)); | ||
| 164 | - | ||
| 165 | - //Return as Array | ||
| 166 | - //console.log(jsonExportArray); | ||
| 167 | - if(defaults.consoleLog == 'true'){ | ||
| 168 | - console.log(JSON.stringify(jsonExportArray)); | ||
| 169 | - } | ||
| 170 | - var base64data = "base64," + $.base64.encode(JSON.stringify(jsonExportArray)); | ||
| 171 | - window.open('data:application/json;filename=exportData;' + base64data); | ||
| 172 | - }else if(defaults.type == 'xml'){ | ||
| 173 | - | ||
| 174 | - var xml = '<?xml version="1.0" encoding="utf-8"?>'; | ||
| 175 | - xml += '<tabledata><fields>'; | ||
| 176 | - // Header | ||
| 177 | - $(el).find('thead').find('tr').each(function() { | ||
| 178 | - $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 179 | - if ($(this).css('display') != 'none'){ | ||
| 180 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 181 | - xml += "<field>" + parseString($(this)) + "</field>"; | ||
| 182 | - } | ||
| 183 | - } | ||
| 184 | - }); | ||
| 185 | - }); | ||
| 186 | - xml += '</fields><data>'; | ||
| 187 | - | ||
| 188 | - // Row Vs Column | ||
| 189 | - var rowCount=1; | ||
| 190 | - $(el).find('tbody').find('tr').each(function() { | ||
| 191 | - xml += '<row id="'+rowCount+'">'; | ||
| 192 | - var colCount=0; | ||
| 193 | - $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 194 | - if ($(this).css('display') != 'none'){ | ||
| 195 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 196 | - xml += "<column-"+colCount+">"+parseString($(this))+"</column-"+colCount+">"; | ||
| 197 | - } | ||
| 198 | - } | ||
| 199 | - colCount++; | ||
| 200 | - }); | ||
| 201 | - rowCount++; | ||
| 202 | - xml += '</row>'; | ||
| 203 | - }); | ||
| 204 | - xml += '</data></tabledata>' | ||
| 205 | - | ||
| 206 | - if(defaults.consoleLog == 'true'){ | ||
| 207 | - console.log(xml); | ||
| 208 | - } | ||
| 209 | - | ||
| 210 | - var base64data = "base64," + $.base64.encode(xml); | ||
| 211 | - window.open('data:application/xml;filename=exportData;' + base64data); | ||
| 212 | - }else if(defaults.type == 'excel' || defaults.type == 'doc'|| defaults.type == 'powerpoint' ){ | ||
| 213 | - //console.log($(this).html()); | ||
| 214 | - var excel="<table>"; | ||
| 215 | - // Header | ||
| 216 | - $(el).find('thead').find('tr').each(function() { | ||
| 217 | - excel += "<tr>"; | ||
| 218 | - $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 219 | - if ($(this).css('display') != 'none'){ | ||
| 220 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 221 | - excel += "<td>" + parseString($(this))+ "</td>"; | ||
| 222 | - } | ||
| 223 | - } | ||
| 224 | - }); | ||
| 225 | - excel += '</tr>'; | ||
| 226 | - | ||
| 227 | - }); | ||
| 228 | - | ||
| 229 | - | ||
| 230 | - // Row Vs Column | ||
| 231 | - var rowCount=1; | ||
| 232 | - $(el).find('tbody').find('tr').each(function() { | ||
| 233 | - excel += "<tr>"; | ||
| 234 | - var colCount=0; | ||
| 235 | - $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 236 | - if ($(this).css('display') != 'none'){ | ||
| 237 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 238 | - excel += "<td>"+parseString($(this))+"</td>"; | ||
| 239 | - } | ||
| 240 | - } | ||
| 241 | - colCount++; | ||
| 242 | - }); | ||
| 243 | - rowCount++; | ||
| 244 | - excel += '</tr>'; | ||
| 245 | - }); | ||
| 246 | - excel += '</table>' | ||
| 247 | - | ||
| 248 | - if(defaults.consoleLog == 'true'){ | ||
| 249 | - console.log(excel); | ||
| 250 | - } | ||
| 251 | - | ||
| 252 | - var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:"+defaults.type+"' xmlns='http://www.w3.org/TR/REC-html40'>"; | ||
| 253 | - excelFile += "<head>"; | ||
| 254 | - excelFile += "<!--[if gte mso 9]>"; | ||
| 255 | - excelFile += "<xml>"; | ||
| 256 | - excelFile += "<x:ExcelWorkbook>"; | ||
| 257 | - excelFile += "<x:ExcelWorksheets>"; | ||
| 258 | - excelFile += "<x:ExcelWorksheet>"; | ||
| 259 | - excelFile += "<x:Name>"; | ||
| 260 | - excelFile += "{worksheet}"; | ||
| 261 | - excelFile += "</x:Name>"; | ||
| 262 | - excelFile += "<x:WorksheetOptions>"; | ||
| 263 | - excelFile += "<x:DisplayGridlines/>"; | ||
| 264 | - excelFile += "</x:WorksheetOptions>"; | ||
| 265 | - excelFile += "</x:ExcelWorksheet>"; | ||
| 266 | - excelFile += "</x:ExcelWorksheets>"; | ||
| 267 | - excelFile += "</x:ExcelWorkbook>"; | ||
| 268 | - excelFile += "</xml>"; | ||
| 269 | - excelFile += "<![endif]-->"; | ||
| 270 | - excelFile += "</head>"; | ||
| 271 | - excelFile += "<body>"; | ||
| 272 | - excelFile += excel; | ||
| 273 | - excelFile += "</body>"; | ||
| 274 | - excelFile += "</html>"; | ||
| 275 | - var base64data = "base64," + $.base64({ data: excelFile, type: 0 }); | ||
| 276 | - window.open('data:application/vnd.ms-'+defaults.type+';filename=exportData.doc;' + base64data); | ||
| 277 | - | ||
| 278 | - }else if(defaults.type == 'png'){ | ||
| 279 | - html2canvas($(el), { | ||
| 280 | - onrendered: function(canvas) { | ||
| 281 | - var img = canvas.toDataURL("image/png"); | ||
| 282 | - window.open(img); | ||
| 283 | - | ||
| 284 | - | ||
| 285 | - } | ||
| 286 | - }); | ||
| 287 | - }else if(defaults.type == 'pdf'){ | ||
| 288 | - | ||
| 289 | - var doc = new jsPDF('p','pt', 'a4', true); | ||
| 290 | - doc.setFontSize(defaults.pdfFontSize); | ||
| 291 | - | ||
| 292 | - // Header | ||
| 293 | - var startColPosition=defaults.pdfLeftMargin; | ||
| 294 | - $(el).find('thead').find('tr').each(function() { | ||
| 295 | - $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 296 | - if ($(this).css('display') != 'none'){ | ||
| 297 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 298 | - var colPosition = startColPosition+ (index * 50); | ||
| 299 | - doc.text(colPosition,20, parseString($(this))); | ||
| 300 | - } | ||
| 301 | - } | ||
| 302 | - }); | ||
| 303 | - }); | ||
| 304 | - | ||
| 305 | - | ||
| 306 | - // Row Vs Column | ||
| 307 | - var startRowPosition = 20; var page =1;var rowPosition=0; | ||
| 308 | - $(el).find('tbody').find('tr').each(function(index,data) { | ||
| 309 | - rowCalc = index+1; | ||
| 310 | - | ||
| 311 | - if (rowCalc % 26 == 0){ | ||
| 312 | - doc.addPage(); | ||
| 313 | - page++; | ||
| 314 | - startRowPosition=startRowPosition+10; | ||
| 315 | - } | ||
| 316 | - rowPosition=(startRowPosition + (rowCalc * 10)) - ((page -1) * 280); | ||
| 317 | - | ||
| 318 | - $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 319 | - if ($(this).css('display') != 'none'){ | ||
| 320 | - if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 321 | - var colPosition = startColPosition+ (index * 50); | ||
| 322 | - doc.text(colPosition,rowPosition, parseString($(this))); | 14 | + $.fn.extend({ |
| 15 | + tableExport: function(options) { | ||
| 16 | + var defaults = { | ||
| 17 | + separator: ',', | ||
| 18 | + ignoreColumn: [], | ||
| 19 | + tableName:'yourTableName', | ||
| 20 | + type:'csv', | ||
| 21 | + pdfFontSize:14, | ||
| 22 | + pdfLeftMargin:20, | ||
| 23 | + escape:'true', | ||
| 24 | + htmlContent:'false', | ||
| 25 | + consoleLog:'false' | ||
| 26 | + }; | ||
| 27 | + | ||
| 28 | + var options = $.extend(defaults, options); | ||
| 29 | + var el = this; | ||
| 30 | + | ||
| 31 | + if(defaults.type == 'csv' || defaults.type == 'txt'){ | ||
| 32 | + | ||
| 33 | + // Header | ||
| 34 | + var tdData =""; | ||
| 35 | + $(el).find('thead').find('tr').each(function() { | ||
| 36 | + tdData += "\n"; | ||
| 37 | + $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 38 | + if ($(this).css('display') != 'none'){ | ||
| 39 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 40 | + tdData += '"' + parseString($(this)) + '"' + defaults.separator; | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + }); | ||
| 45 | + tdData = $.trim(tdData); | ||
| 46 | + tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 47 | + }); | ||
| 48 | + | ||
| 49 | + // Row vs Column | ||
| 50 | + $(el).find('tbody').find('tr').each(function() { | ||
| 51 | + tdData += "\n"; | ||
| 52 | + $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 53 | + if ($(this).css('display') != 'none'){ | ||
| 54 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 55 | + tdData += '"'+ parseString($(this)) + '"'+ defaults.separator; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + }); | ||
| 59 | + //tdData = $.trim(tdData); | ||
| 60 | + tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 61 | + }); | ||
| 62 | + | ||
| 63 | + //output | ||
| 64 | + if(defaults.consoleLog == 'true'){ | ||
| 65 | + console.log(tdData); | ||
| 66 | + } | ||
| 67 | + var base64data = "base64," + $.base64({ data: tdData, type: 0 }); | ||
| 68 | + //window.open('data:application/'+defaults.type+';filename=exportData;' + base64data); | ||
| 69 | + downloadFile(defaults.filename + '.' + defaults.type, tdData); | ||
| 70 | + }else if(defaults.type == 'sql'){ | ||
| 71 | + | ||
| 72 | + // Header | ||
| 73 | + var tdData ="INSERT INTO `"+defaults.tableName+"` ("; | ||
| 74 | + $(el).find('thead').find('tr').each(function() { | ||
| 75 | + | ||
| 76 | + $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 77 | + if ($(this).css('display') != 'none'){ | ||
| 78 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 79 | + tdData += '`' + parseString($(this)) + '`,' ; | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + }); | ||
| 84 | + tdData = $.trim(tdData); | ||
| 85 | + tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 86 | + }); | ||
| 87 | + tdData += ") VALUES "; | ||
| 88 | + // Row vs Column | ||
| 89 | + $(el).find('tbody').find('tr').each(function() { | ||
| 90 | + tdData += "("; | ||
| 91 | + $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 92 | + if ($(this).css('display') != 'none'){ | ||
| 93 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 94 | + tdData += '"'+ parseString($(this)) + '",'; | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + }); | ||
| 98 | + | ||
| 99 | + tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 100 | + tdData += "),"; | ||
| 101 | + }); | ||
| 102 | + tdData = $.trim(tdData).substring(0, tdData.length -1); | ||
| 103 | + tdData += ";"; | ||
| 104 | + | ||
| 105 | + //output | ||
| 106 | + //console.log(tdData); | ||
| 107 | + | ||
| 108 | + if(defaults.consoleLog == 'true'){ | ||
| 109 | + console.log(tdData); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + var base64data = "base64," + $.base64.encode(tdData); | ||
| 113 | + window.open('data:application/sql;filename=exportData;' + base64data); | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + }else if(defaults.type == 'json'){ | ||
| 117 | + | ||
| 118 | + var jsonHeaderArray = []; | ||
| 119 | + $(el).find('thead').find('tr').each(function() { | ||
| 120 | + var tdData =""; | ||
| 121 | + var jsonArrayTd = []; | ||
| 122 | + | ||
| 123 | + $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 124 | + if ($(this).css('display') != 'none'){ | ||
| 125 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 126 | + jsonArrayTd.push(parseString($(this))); | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + }); | ||
| 130 | + jsonHeaderArray.push(jsonArrayTd); | ||
| 131 | + | ||
| 132 | + }); | ||
| 133 | + | ||
| 134 | + var jsonArray = []; | ||
| 135 | + $(el).find('tbody').find('tr').each(function() { | ||
| 136 | + var tdData =""; | ||
| 137 | + var jsonArrayTd = []; | ||
| 138 | + | ||
| 139 | + $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 140 | + if ($(this).css('display') != 'none'){ | ||
| 141 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 142 | + jsonArrayTd.push(parseString($(this))); | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + }); | ||
| 146 | + jsonArray.push(jsonArrayTd); | ||
| 147 | + | ||
| 148 | + }); | ||
| 149 | + | ||
| 150 | + var jsonExportArray =[]; | ||
| 151 | + jsonExportArray.push({header:jsonHeaderArray,data:jsonArray}); | ||
| 152 | + | ||
| 153 | + //Return as JSON | ||
| 154 | + //console.log(JSON.stringify(jsonExportArray)); | ||
| 155 | + | ||
| 156 | + //Return as Array | ||
| 157 | + //console.log(jsonExportArray); | ||
| 158 | + if(defaults.consoleLog == 'true'){ | ||
| 159 | + console.log(JSON.stringify(jsonExportArray)); | ||
| 160 | + } | ||
| 161 | + var base64data = "base64," + $.base64.encode(JSON.stringify(jsonExportArray)); | ||
| 162 | + window.open('data:application/json;filename=exportData;' + base64data); | ||
| 163 | + }else if(defaults.type == 'xml'){ | ||
| 164 | + | ||
| 165 | + var xml = '<?xml version="1.0" encoding="utf-8"?>'; | ||
| 166 | + xml += '<tabledata><fields>'; | ||
| 167 | + // Header | ||
| 168 | + $(el).find('thead').find('tr').each(function() { | ||
| 169 | + $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 170 | + if ($(this).css('display') != 'none'){ | ||
| 171 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 172 | + xml += "<field>" + parseString($(this)) + "</field>"; | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + }); | ||
| 176 | + }); | ||
| 177 | + xml += '</fields><data>'; | ||
| 178 | + | ||
| 179 | + // Row Vs Column | ||
| 180 | + var rowCount=1; | ||
| 181 | + $(el).find('tbody').find('tr').each(function() { | ||
| 182 | + xml += '<row id="'+rowCount+'">'; | ||
| 183 | + var colCount=0; | ||
| 184 | + $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 185 | + if ($(this).css('display') != 'none'){ | ||
| 186 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 187 | + xml += "<column-"+colCount+">"+parseString($(this))+"</column-"+colCount+">"; | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + colCount++; | ||
| 191 | + }); | ||
| 192 | + rowCount++; | ||
| 193 | + xml += '</row>'; | ||
| 194 | + }); | ||
| 195 | + xml += '</data></tabledata>' | ||
| 196 | + | ||
| 197 | + if(defaults.consoleLog == 'true'){ | ||
| 198 | + console.log(xml); | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + var base64data = "base64," + $.base64.encode(xml); | ||
| 202 | + window.open('data:application/xml;filename=exportData;' + base64data); | ||
| 203 | + }else if(defaults.type == 'excel' || defaults.type == 'doc'|| defaults.type == 'powerpoint' ){ | ||
| 204 | + //console.log($(this).html()); | ||
| 205 | + var excel="<table>"; | ||
| 206 | + // Header | ||
| 207 | + $(el).find('thead').find('tr').each(function() { | ||
| 208 | + excel += "<tr>"; | ||
| 209 | + $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 210 | + if ($(this).css('display') != 'none'){ | ||
| 211 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 212 | + excel += "<td>" + parseString($(this))+ "</td>"; | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + }); | ||
| 216 | + excel += '</tr>'; | ||
| 217 | + | ||
| 218 | + }); | ||
| 219 | + | ||
| 220 | + | ||
| 221 | + // Row Vs Column | ||
| 222 | + var rowCount=1; | ||
| 223 | + $(el).find('tbody').find('tr').each(function() { | ||
| 224 | + excel += "<tr>"; | ||
| 225 | + var colCount=0; | ||
| 226 | + $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 227 | + if ($(this).css('display') != 'none'){ | ||
| 228 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 229 | + excel += "<td>"+parseString($(this))+"</td>"; | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + colCount++; | ||
| 233 | + }); | ||
| 234 | + rowCount++; | ||
| 235 | + excel += '</tr>'; | ||
| 236 | + }); | ||
| 237 | + excel += '</table>' | ||
| 238 | + | ||
| 239 | + if(defaults.consoleLog == 'true'){ | ||
| 240 | + console.log(excel); | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:"+defaults.type+"' xmlns='http://www.w3.org/TR/REC-html40'>"; | ||
| 244 | + excelFile += "<head>"; | ||
| 245 | + excelFile += "<!--[if gte mso 9]>"; | ||
| 246 | + excelFile += "<xml>"; | ||
| 247 | + excelFile += "<x:ExcelWorkbook>"; | ||
| 248 | + excelFile += "<x:ExcelWorksheets>"; | ||
| 249 | + excelFile += "<x:ExcelWorksheet>"; | ||
| 250 | + excelFile += "<x:Name>"; | ||
| 251 | + excelFile += "{worksheet}"; | ||
| 252 | + excelFile += "</x:Name>"; | ||
| 253 | + excelFile += "<x:WorksheetOptions>"; | ||
| 254 | + excelFile += "<x:DisplayGridlines/>"; | ||
| 255 | + excelFile += "</x:WorksheetOptions>"; | ||
| 256 | + excelFile += "</x:ExcelWorksheet>"; | ||
| 257 | + excelFile += "</x:ExcelWorksheets>"; | ||
| 258 | + excelFile += "</x:ExcelWorkbook>"; | ||
| 259 | + excelFile += "</xml>"; | ||
| 260 | + excelFile += "<![endif]-->"; | ||
| 261 | + excelFile += "</head>"; | ||
| 262 | + excelFile += "<body>"; | ||
| 263 | + excelFile += excel; | ||
| 264 | + excelFile += "</body>"; | ||
| 265 | + excelFile += "</html>"; | ||
| 266 | + var base64data = "base64," + $.base64({ data: excelFile, type: 0 }); | ||
| 267 | + | ||
| 268 | + if(defaults.type == "doc") { | ||
| 269 | + window.open('data:application/msword;filename=exportData.'+defaults.type+';' + base64data); | ||
| 270 | + } | ||
| 271 | + else { | ||
| 272 | + window.open('data:application/vnd.ms-'+defaults.type+';filename=exportData.'+defaults.type+';' + base64data); | ||
| 273 | + } | ||
| 274 | + }else if(defaults.type == 'png'){ | ||
| 275 | + html2canvas($(el), { | ||
| 276 | + onrendered: function(canvas) { | ||
| 277 | + var img = canvas.toDataURL("image/png"); | ||
| 278 | + window.open(img); | ||
| 279 | + | ||
| 280 | + | ||
| 281 | + } | ||
| 282 | + }); | ||
| 283 | + }else if(defaults.type == 'pdf'){ | ||
| 284 | + | ||
| 285 | + var doc = new jsPDF('p','pt', 'a4', true); | ||
| 286 | + doc.setFontSize(defaults.pdfFontSize); | ||
| 287 | + | ||
| 288 | + // Header | ||
| 289 | + var startColPosition=defaults.pdfLeftMargin; | ||
| 290 | + $(el).find('thead').find('tr').each(function() { | ||
| 291 | + $(this).filter(':visible').find('th').each(function(index,data) { | ||
| 292 | + if ($(this).css('display') != 'none'){ | ||
| 293 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 294 | + var colPosition = startColPosition+ (index * 50); | ||
| 295 | + doc.text(colPosition,20, parseString($(this))); | ||
| 296 | + } | ||
| 297 | + } | ||
| 298 | + }); | ||
| 299 | + }); | ||
| 300 | + | ||
| 301 | + | ||
| 302 | + // Row Vs Column | ||
| 303 | + var startRowPosition = 20; var page =1;var rowPosition=0; | ||
| 304 | + $(el).find('tbody').find('tr').each(function(index,data) { | ||
| 305 | + rowCalc = index+1; | ||
| 306 | + | ||
| 307 | + if (rowCalc % 26 == 0){ | ||
| 308 | + doc.addPage(); | ||
| 309 | + page++; | ||
| 310 | + startRowPosition=startRowPosition+10; | ||
| 311 | + } | ||
| 312 | + rowPosition=(startRowPosition + (rowCalc * 10)) - ((page -1) * 280); | ||
| 313 | + | ||
| 314 | + $(this).filter(':visible').find('td').each(function(index,data) { | ||
| 315 | + if ($(this).css('display') != 'none'){ | ||
| 316 | + if(defaults.ignoreColumn.indexOf(index) == -1){ | ||
| 317 | + var colPosition = startColPosition+ (index * 50); | ||
| 318 | + doc.text(colPosition,rowPosition, parseString($(this))); | ||
| 319 | + } | ||
| 320 | + } | ||
| 321 | + | ||
| 322 | + }); | ||
| 323 | + | ||
| 324 | + }); | ||
| 325 | + | ||
| 326 | + // Output as Data URI | ||
| 327 | + doc.output('datauri'); | ||
| 328 | + | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + | ||
| 332 | + function parseString(data){ | ||
| 333 | + | ||
| 334 | + if(defaults.htmlContent == 'true'){ | ||
| 335 | + content_data = data.html().trim(); | ||
| 336 | + }else{ | ||
| 337 | + content_data = data.text().trim(); | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + if(defaults.escape == 'true'){ | ||
| 341 | + content_data = escape(content_data); | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + | ||
| 345 | + | ||
| 346 | + return content_data; | ||
| 347 | + } | ||
| 348 | + | ||
| 323 | } | 349 | } |
| 324 | - } | ||
| 325 | - | ||
| 326 | - }); | ||
| 327 | - | ||
| 328 | - }); | ||
| 329 | - | ||
| 330 | - // Output as Data URI | ||
| 331 | - doc.output('datauri'); | ||
| 332 | - | ||
| 333 | - } | ||
| 334 | - | ||
| 335 | - | ||
| 336 | - function parseString(data){ | ||
| 337 | - | ||
| 338 | - if(defaults.htmlContent == 'true'){ | ||
| 339 | - content_data = data.html().trim(); | ||
| 340 | - }else{ | ||
| 341 | - content_data = data.text().trim(); | ||
| 342 | - } | ||
| 343 | - | ||
| 344 | - if(defaults.escape == 'true'){ | ||
| 345 | - content_data = escape(content_data); | ||
| 346 | - } | ||
| 347 | - | ||
| 348 | - | ||
| 349 | - | ||
| 350 | - return content_data; | ||
| 351 | - } | ||
| 352 | - | ||
| 353 | - } | ||
| 354 | - }); | ||
| 355 | - })(jQuery); | ||
| 356 | - | 350 | + }); |
| 351 | +})(jQuery); | ||
| 357 | \ No newline at end of file | 352 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/scheduleDaily_minhang.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;"> | ||
| 31 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 32 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 33 | + </div> | ||
| 34 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 35 | + <span class="item-label" style="width: 80px;">时间: </span> | ||
| 36 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 37 | + </div> | ||
| 38 | + <div class="form-group"> | ||
| 39 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 40 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 41 | + </div> | ||
| 42 | + </form> | ||
| 43 | + </div> | ||
| 44 | + <div class="portlet-body"> | ||
| 45 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 46 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 47 | + <thead> | ||
| 48 | + <tr> | ||
| 49 | + <th colspan="40">线路调度日报</th> | ||
| 50 | + </tr> | ||
| 51 | + <tr> | ||
| 52 | + <td rowspan="3">路线别</td> | ||
| 53 | + <td colspan="15">全日营运里程(公里)</td> | ||
| 54 | + <td colspan="15">全日营运班次</td> | ||
| 55 | + <td colspan="9">大间隔情况</td> | ||
| 56 | + </tr> | ||
| 57 | + <tr> | ||
| 58 | + <td rowspan="2">计划</td> | ||
| 59 | + <td rowspan="2">实驶</td> | ||
| 60 | + <td rowspan="2">少驶</td> | ||
| 61 | + <td colspan="11">少驶原因(公里)</td> | ||
| 62 | + <td rowspan="2">临加公里</td> | ||
| 63 | + <td colspan="3">计划班次</td> | ||
| 64 | + <td colspan="3">实际班次</td> | ||
| 65 | + <td colspan="3">临加班次</td> | ||
| 66 | + <td colspan="3">放站班次</td> | ||
| 67 | + <td colspan="3">调头班次</td> | ||
| 68 | + <td colspan="3">发生次数</td> | ||
| 69 | + <td rowspan="2">最大间隔时间(秒)</td> | ||
| 70 | + <td colspan="5" rowspan="2">原因</td> | ||
| 71 | + </tr> | ||
| 72 | + <tr> | ||
| 73 | + <td>路阻</td> | ||
| 74 | + <td>吊慢</td> | ||
| 75 | + <td>故障</td> | ||
| 76 | + <td>纠纷</td> | ||
| 77 | + <td>肇事</td> | ||
| 78 | + <td>缺人</td> | ||
| 79 | + <td>缺车</td> | ||
| 80 | + <td>客稀</td> | ||
| 81 | + <td>气候</td> | ||
| 82 | + <td>援外</td> | ||
| 83 | + <td>其他</td> | ||
| 84 | + <td>全日</td> | ||
| 85 | + <td>6:31~8:30</td> | ||
| 86 | + <td>16:01~18:00</td> | ||
| 87 | + <td>全日</td> | ||
| 88 | + <td>6:31~8:30</td> | ||
| 89 | + <td>16:01~18:00</td> | ||
| 90 | + <td>全日</td> | ||
| 91 | + <td>6:31~8:30</td> | ||
| 92 | + <td>16:01~18:00</td> | ||
| 93 | + <td>全日</td> | ||
| 94 | + <td>6:31~8:30</td> | ||
| 95 | + <td>16:01~18:00</td> | ||
| 96 | + <td>全日</td> | ||
| 97 | + <td>6:31~8:30</td> | ||
| 98 | + <td>16:01~18:00</td> | ||
| 99 | + <td>全日</td> | ||
| 100 | + <td>6:31~8:30</td> | ||
| 101 | + <td>16:01~18:00</td> | ||
| 102 | + </tr> | ||
| 103 | + </thead> | ||
| 104 | + <tr> | ||
| 105 | + <td colspan="40"> </td> | ||
| 106 | + </tr> | ||
| 107 | + <tr> | ||
| 108 | + <td colspan="40">合计</td> | ||
| 109 | + </tr> | ||
| 110 | + <tr> | ||
| 111 | + <td colspan="40"> </td> | ||
| 112 | + </tr> | ||
| 113 | + <tr> | ||
| 114 | + <td colspan="2">班次</td> | ||
| 115 | + <td colspan="2">车号</td> | ||
| 116 | + <td>司早</td> | ||
| 117 | + <td>售早</td> | ||
| 118 | + <td>司晚</td> | ||
| 119 | + <td>售晚</td> | ||
| 120 | + <td colspan="2">班次</td> | ||
| 121 | + <td colspan="2">车号</td> | ||
| 122 | + <td>司早</td> | ||
| 123 | + <td>售早</td> | ||
| 124 | + <td>司晚</td> | ||
| 125 | + <td>售晚</td> | ||
| 126 | + <td colspan="2">班次</td> | ||
| 127 | + <td colspan="2">车号</td> | ||
| 128 | + <td>司早</td> | ||
| 129 | + <td>售早</td> | ||
| 130 | + <td>司晚</td> | ||
| 131 | + <td>售晚</td> | ||
| 132 | + <td colspan="2">班次</td> | ||
| 133 | + <td colspan="2">车号</td> | ||
| 134 | + <td>司早</td> | ||
| 135 | + <td>售早</td> | ||
| 136 | + <td>司晚</td> | ||
| 137 | + <td>售晚</td> | ||
| 138 | + <td colspan="2">班次</td> | ||
| 139 | + <td colspan="2">车号</td> | ||
| 140 | + <td>司早</td> | ||
| 141 | + <td>售早</td> | ||
| 142 | + <td>司晚</td> | ||
| 143 | + <td>售晚</td> | ||
| 144 | + </tr> | ||
| 145 | + <tr> | ||
| 146 | + <td colspan="40"> </td> | ||
| 147 | + </tr> | ||
| 148 | + <tr> | ||
| 149 | + <td rowspan="2">路牌</td> | ||
| 150 | + <td colspan="2" rowspan="2">起点站</td> | ||
| 151 | + <td colspan="4">到达时间</td> | ||
| 152 | + <td colspan="4">发车时间</td> | ||
| 153 | + <td colspan="2" rowspan="2">备注</td> | ||
| 154 | + <td rowspan="2">路牌</td> | ||
| 155 | + <td colspan="2" rowspan="2">起点站</td> | ||
| 156 | + <td colspan="4">到达时间</td> | ||
| 157 | + <td colspan="4">发车时间</td> | ||
| 158 | + <td colspan="2" rowspan="2">备注</td> | ||
| 159 | + <td rowspan="2">路牌</td> | ||
| 160 | + <td colspan="2" rowspan="2">起点站</td> | ||
| 161 | + <td colspan="4">到达时间</td> | ||
| 162 | + <td colspan="4">发车时间</td> | ||
| 163 | + <td colspan="2" rowspan="2">备注</td> | ||
| 164 | + <td> </td> | ||
| 165 | + </tr> | ||
| 166 | + <tr> | ||
| 167 | + <td>应到</td> | ||
| 168 | + <td>实到</td> | ||
| 169 | + <td>快</td> | ||
| 170 | + <td>慢</td> | ||
| 171 | + <td>应发</td> | ||
| 172 | + <td>实发</td> | ||
| 173 | + <td>快</td> | ||
| 174 | + <td>慢</td> | ||
| 175 | + <td>应到</td> | ||
| 176 | + <td>实到</td> | ||
| 177 | + <td>快</td> | ||
| 178 | + <td>慢</td> | ||
| 179 | + <td>应发</td> | ||
| 180 | + <td>实发</td> | ||
| 181 | + <td>快</td> | ||
| 182 | + <td>慢</td> | ||
| 183 | + <td>应到</td> | ||
| 184 | + <td>实到</td> | ||
| 185 | + <td>快</td> | ||
| 186 | + <td>慢</td> | ||
| 187 | + <td>应发</td> | ||
| 188 | + <td>实发</td> | ||
| 189 | + <td>快</td> | ||
| 190 | + <td>慢</td> | ||
| 191 | + <td> </td> | ||
| 192 | + </tr> | ||
| 193 | + <tbody> | ||
| 194 | + | ||
| 195 | + </tbody> | ||
| 196 | + </table> | ||
| 197 | + </div> | ||
| 198 | + </div> | ||
| 199 | + </div> | ||
| 200 | + </div> | ||
| 201 | +</div> | ||
| 202 | + | ||
| 203 | +<script> | ||
| 204 | + $(function(){ | ||
| 205 | + // 关闭左侧栏 | ||
| 206 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 207 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 208 | + | ||
| 209 | + $("#date").datetimepicker({ | ||
| 210 | + format : 'YYYY-MM-DD', | ||
| 211 | + locale : 'zh-cn' | ||
| 212 | + }); | ||
| 213 | + | ||
| 214 | + $('#line').select2({ | ||
| 215 | + ajax: { | ||
| 216 | + url: '/realSchedule/findLine', | ||
| 217 | + dataType: 'json', | ||
| 218 | + delay: 150, | ||
| 219 | + data: function(params){ | ||
| 220 | + return{line: params.term}; | ||
| 221 | + }, | ||
| 222 | + processResults: function (data) { | ||
| 223 | + return { | ||
| 224 | + results: data | ||
| 225 | + }; | ||
| 226 | + }, | ||
| 227 | + cache: true | ||
| 228 | + }, | ||
| 229 | + templateResult: function(repo){ | ||
| 230 | + if (repo.loading) return repo.text; | ||
| 231 | + var h = '<span>'+repo.text+'</span>'; | ||
| 232 | + return h; | ||
| 233 | + }, | ||
| 234 | + escapeMarkup: function (markup) { return markup; }, | ||
| 235 | + minimumInputLength: 1, | ||
| 236 | + templateSelection: function(repo){ | ||
| 237 | + return repo.text; | ||
| 238 | + }, | ||
| 239 | + language: { | ||
| 240 | + noResults: function(){ | ||
| 241 | + return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>'; | ||
| 242 | + }, | ||
| 243 | + inputTooShort : function(e) { | ||
| 244 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>'; | ||
| 245 | + }, | ||
| 246 | + searching : function() { | ||
| 247 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; | ||
| 248 | + } | ||
| 249 | + } | ||
| 250 | + }); | ||
| 251 | + | ||
| 252 | + //查询 | ||
| 253 | + $("#query").on('click',function(){ | ||
| 254 | + var line = $("#line").val(); | ||
| 255 | + var date = $("#date").val(); | ||
| 256 | + $.get('/realSchedule/scheduleDaily',{line:line,date:date},function(result){ | ||
| 257 | + | ||
| 258 | + }); | ||
| 259 | + }); | ||
| 260 | + }); | ||
| 261 | +</script> | ||
| 262 | +<script type="text/html" id="list_forms"> | ||
| 263 | + {{each list as obj i}} | ||
| 264 | + <tr> | ||
| 265 | + | ||
| 266 | + </tr> | ||
| 267 | + {{/each}} | ||
| 268 | + {{if list.length == 0}} | ||
| 269 | + <tr> | ||
| 270 | + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 271 | + </tr> | ||
| 272 | + {{/if}} | ||
| 273 | +</script> | ||
| 0 | \ No newline at end of file | 274 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/scheduleRealDaily.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;"> | ||
| 31 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 32 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 33 | + </div> | ||
| 34 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 35 | + <span class="item-label" style="width: 80px;">时间: </span> | ||
| 36 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 37 | + </div> | ||
| 38 | + <div class="form-group"> | ||
| 39 | + <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 40 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 41 | + </div> | ||
| 42 | + </form> | ||
| 43 | + </div> | ||
| 44 | + <div class="portlet-body"> | ||
| 45 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 46 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 47 | + <thead> | ||
| 48 | + <tr> | ||
| 49 | + <th colspan="7">计划实际日报</th> | ||
| 50 | + </tr> | ||
| 51 | + <tr> | ||
| 52 | + <td>路线:</td> | ||
| 53 | + <td colspan="2"><span id="form_line"> </span></td> | ||
| 54 | + <td>时间:</td> | ||
| 55 | + <td colspan="3"><span id="form_date"> </span></td> | ||
| 56 | + </tr> | ||
| 57 | + <tr> | ||
| 58 | + <td>计划里程</td> | ||
| 59 | + <td>实际计划里程</td> | ||
| 60 | + <td>营运里程</td> | ||
| 61 | + <td>空驶里程</td> | ||
| 62 | + <td>抽减里程</td> | ||
| 63 | + <td>增加里程</td> | ||
| 64 | + <td>总里程</td> | ||
| 65 | + <td>计划班次</td> | ||
| 66 | + <td>实际计划班次</td> | ||
| 67 | + <td>抽减班次</td> | ||
| 68 | + <td>增加班次</td> | ||
| 69 | + <td>实际班次</td> | ||
| 70 | + </tr> | ||
| 71 | + </thead> | ||
| 72 | + <tbody class="scheduleRealDaily"> | ||
| 73 | + | ||
| 74 | + </tbody> | ||
| 75 | + </table> | ||
| 76 | + </div> | ||
| 77 | + </div> | ||
| 78 | + </div> | ||
| 79 | + </div> | ||
| 80 | +</div> | ||
| 81 | + | ||
| 82 | +<script> | ||
| 83 | + $(function(){ | ||
| 84 | + // 关闭左侧栏 | ||
| 85 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 86 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 87 | + | ||
| 88 | + $("#date").datetimepicker({ | ||
| 89 | + format : 'YYYY-MM-DD', | ||
| 90 | + locale : 'zh-cn' | ||
| 91 | + }); | ||
| 92 | + | ||
| 93 | + $('#line').select2({ | ||
| 94 | + ajax: { | ||
| 95 | + url: '/realSchedule/findLine', | ||
| 96 | + dataType: 'json', | ||
| 97 | + delay: 150, | ||
| 98 | + data: function(params){ | ||
| 99 | + return{line: params.term}; | ||
| 100 | + }, | ||
| 101 | + processResults: function (data) { | ||
| 102 | + return { | ||
| 103 | + results: data | ||
| 104 | + }; | ||
| 105 | + }, | ||
| 106 | + cache: true | ||
| 107 | + }, | ||
| 108 | + templateResult: function(repo){ | ||
| 109 | + if (repo.loading) return repo.text; | ||
| 110 | + var h = '<span>'+repo.text+'</span>'; | ||
| 111 | + return h; | ||
| 112 | + }, | ||
| 113 | + escapeMarkup: function (markup) { return markup; }, | ||
| 114 | + minimumInputLength: 1, | ||
| 115 | + templateSelection: function(repo){ | ||
| 116 | + return repo.text; | ||
| 117 | + }, | ||
| 118 | + language: { | ||
| 119 | + noResults: function(){ | ||
| 120 | + return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>'; | ||
| 121 | + }, | ||
| 122 | + inputTooShort : function(e) { | ||
| 123 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>'; | ||
| 124 | + }, | ||
| 125 | + searching : function() { | ||
| 126 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + }); | ||
| 130 | + | ||
| 131 | + var line; | ||
| 132 | + var date; | ||
| 133 | + $("#query").on("click",function(){ | ||
| 134 | + line = $("#line").val(); | ||
| 135 | + date = $("#date").val(); | ||
| 136 | + | ||
| 137 | + }); | ||
| 138 | + }); | ||
| 139 | +</script> | ||
| 140 | +<script type="text/html" id="scheduleRealDaily"> | ||
| 141 | + {{each list as obj i}} | ||
| 142 | + <tr> | ||
| 143 | + <td></td> | ||
| 144 | + </tr> | ||
| 145 | + {{/each}} | ||
| 146 | + {{if list.length == 0}} | ||
| 147 | + <tr> | ||
| 148 | + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 149 | + </tr> | ||
| 150 | + {{/if}} | ||
| 151 | +</script> | ||
| 0 | \ No newline at end of file | 152 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/statisticsDaily .html
| @@ -200,7 +200,18 @@ | @@ -200,7 +200,18 @@ | ||
| 200 | return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; | 200 | return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; |
| 201 | } | 201 | } |
| 202 | } | 202 | } |
| 203 | - }); | 203 | + }); |
| 204 | + $("#query").on("click",function(){ | ||
| 205 | + var line = $("#line").val(); | ||
| 206 | + var xlName = $("#line").text(); | ||
| 207 | + var date = $("#date").val(); | ||
| 208 | + $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName},function(result){ | ||
| 209 | + // 把数据填充到模版中 | ||
| 210 | + var tbodyHtml = template('list_account',{list:result}); | ||
| 211 | + // 把渲染好的模版html文本追加到表格中 | ||
| 212 | + $('#forms tbody').html(tbodyHtml); | ||
| 213 | + }); | ||
| 214 | + }); | ||
| 204 | }); | 215 | }); |
| 205 | </script> | 216 | </script> |
| 206 | <script type="text/html" id="list_forms"> | 217 | <script type="text/html" id="list_forms"> |
src/main/resources/static/pages/forms/statement/waybill.html
| @@ -99,6 +99,7 @@ | @@ -99,6 +99,7 @@ | ||
| 99 | $('#line').select2({ | 99 | $('#line').select2({ |
| 100 | ajax: { | 100 | ajax: { |
| 101 | url: '/realSchedule/findLine', | 101 | url: '/realSchedule/findLine', |
| 102 | + type: 'post', | ||
| 102 | dataType: 'json', | 103 | dataType: 'json', |
| 103 | delay: 150, | 104 | delay: 150, |
| 104 | data: function(params){ | 105 | data: function(params){ |
| @@ -165,18 +166,18 @@ | @@ -165,18 +166,18 @@ | ||
| 165 | $get('/realSchedule/'+id,null,function(result){ | 166 | $get('/realSchedule/'+id,null,function(result){ |
| 166 | result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); | 167 | result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); |
| 167 | var ludan_1 = template('ludan_1',result); | 168 | var ludan_1 = template('ludan_1',result); |
| 168 | - var ludan_4 = template('ludan_4',result); | 169 | + //var ludan_4 = template('ludan_4',result); |
| 169 | // 把渲染好的模版html文本追加到表格中 | 170 | // 把渲染好的模版html文本追加到表格中 |
| 170 | $('#forms .ludan_1').append(ludan_1); | 171 | $('#forms .ludan_1').append(ludan_1); |
| 171 | - $('#forms .ludan_4').append(ludan_4); | 172 | + //$('#forms .ludan_4').append(ludan_4); |
| 172 | }); | 173 | }); |
| 173 | - $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ | 174 | + $post('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ |
| 174 | getTime(result); | 175 | getTime(result); |
| 175 | var ludan_2 = template('ludan_2',{list:result}); | 176 | var ludan_2 = template('ludan_2',{list:result}); |
| 176 | // 把渲染好的模版html文本追加到表格中 | 177 | // 把渲染好的模版html文本追加到表格中 |
| 177 | $('#forms .ludan_2').append(ludan_2); | 178 | $('#forms .ludan_2').append(ludan_2); |
| 178 | }); | 179 | }); |
| 179 | - $get('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ | 180 | + $post('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ |
| 180 | var ludan_3 = template('ludan_3',result); | 181 | var ludan_3 = template('ludan_3',result); |
| 181 | $('#forms .ludan_3').append(ludan_3); | 182 | $('#forms .ludan_3').append(ludan_3); |
| 182 | }); | 183 | }); |
| @@ -184,8 +185,8 @@ | @@ -184,8 +185,8 @@ | ||
| 184 | }); | 185 | }); |
| 185 | 186 | ||
| 186 | $("#export").on("click",function(){ | 187 | $("#export").on("click",function(){ |
| 187 | - $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ | ||
| 188 | - window.open("/downloadFile/download?jName="+jName+"&lpName="+params[2]); | 188 | + $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ |
| 189 | + window.open("/downloadFile/download?fileName="+jName); | ||
| 189 | }); | 190 | }); |
| 190 | }); | 191 | }); |
| 191 | 192 | ||
| @@ -198,11 +199,11 @@ | @@ -198,11 +199,11 @@ | ||
| 198 | if(obj.zdsj != null && obj.zdsjActual != null ){ | 199 | if(obj.zdsj != null && obj.zdsjActual != null ){ |
| 199 | var zdsjActual = (obj.zdsjActual).split(":"); | 200 | var zdsjActual = (obj.zdsjActual).split(":"); |
| 200 | var zdsj = (obj.zdsj).split(":"); | 201 | var zdsj = (obj.zdsj).split(":"); |
| 201 | - if(zdsjActual[0]*60+zdsjActual[1] > zdsj[0]*60+zdsj[1]){ | ||
| 202 | - obj["slow"] = (zdsjActual[0]*60+zdsjActual[1]) - (zdsj[0]*60+zdsj[1]); | 202 | + if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){ |
| 203 | + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])); | ||
| 203 | } | 204 | } |
| 204 | - else{ | ||
| 205 | - obj["fast"] = (zdsj[0]*60+zdsj[1]) - (zdsjActual[0]*60+zdsjActual[1]); | 205 | + else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){ |
| 206 | + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])); | ||
| 206 | } | 207 | } |
| 207 | } | 208 | } |
| 208 | }); | 209 | }); |
| @@ -228,7 +229,7 @@ | @@ -228,7 +229,7 @@ | ||
| 228 | <td colspan="14">行车路单</td> | 229 | <td colspan="14">行车路单</td> |
| 229 | </tr> | 230 | </tr> |
| 230 | <tr> | 231 | <tr> |
| 231 | - <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}} 出场时间:{{ccTime}} 到达站名:{{zdzName}} 当班调派: 日期:{{scheduleDate}}</td> | 232 | + <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}} 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调派: 日期:{{scheduleDate}}</td> |
| 232 | </tr> | 233 | </tr> |
| 233 | <tr> | 234 | <tr> |
| 234 | <td colspan="2">出场存油 升</td> | 235 | <td colspan="2">出场存油 升</td> |
src/main/resources/static/pages/forms/statement/waybill_minhang.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;"> | ||
| 31 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 32 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 33 | + </div> | ||
| 34 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 35 | + <span class="item-label" style="width: 80px;">时间: </span> | ||
| 36 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 37 | + </div> | ||
| 38 | + <div class="form-group" style="display: inline-block;margin-left: 15px;"> | ||
| 39 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 40 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 41 | + <input class="btn btn-default" type="button" id="print" value="打印"/> | ||
| 42 | + <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> | ||
| 43 | + </div> | ||
| 44 | + </form> | ||
| 45 | + </div> | ||
| 46 | + <div class="portlet-body"> | ||
| 47 | + <div class="row"> | ||
| 48 | + <div class="col-md-3"> | ||
| 49 | + <div class="" style="margin-top: 10px;overflow:auto;height: 860px"> | ||
| 50 | + <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info"> | ||
| 51 | + <thead> | ||
| 52 | + <tr class="hidden"> | ||
| 53 | + <th>人员</th> | ||
| 54 | + <th>自编号</th> | ||
| 55 | + <th>路牌</th> | ||
| 56 | + </tr> | ||
| 57 | + </thead> | ||
| 58 | + <tbody> | ||
| 59 | + | ||
| 60 | + </tbody> | ||
| 61 | + </table> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + <div class="col-md-9" id="printArea"> | ||
| 65 | + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 66 | + <table class="table table-bordered table-checkable" id="forms"> | ||
| 67 | + <tbody class="ludan_1"> | ||
| 68 | + | ||
| 69 | + </tbody> | ||
| 70 | + <tbody class="ludan_2"> | ||
| 71 | + | ||
| 72 | + </tbody> | ||
| 73 | + <tbody class="ludan_3"> | ||
| 74 | + | ||
| 75 | + </tbody> | ||
| 76 | + <tbody class="ludan_4"> | ||
| 77 | + | ||
| 78 | + </tbody> | ||
| 79 | + </table> | ||
| 80 | + </div> | ||
| 81 | + </div> | ||
| 82 | + </div> | ||
| 83 | + </div> | ||
| 84 | + </div> | ||
| 85 | + </div> | ||
| 86 | +</div> | ||
| 87 | + | ||
| 88 | +<script> | ||
| 89 | + $(function(){ | ||
| 90 | + // 关闭左侧栏 | ||
| 91 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 92 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 93 | + | ||
| 94 | + $("#date").datetimepicker({ | ||
| 95 | + format : 'YYYY-MM-DD', | ||
| 96 | + locale : 'zh-cn' | ||
| 97 | + }); | ||
| 98 | + | ||
| 99 | + $('#line').select2({ | ||
| 100 | + ajax: { | ||
| 101 | + url: '/realSchedule/findLine', | ||
| 102 | + dataType: 'json', | ||
| 103 | + delay: 150, | ||
| 104 | + data: function(params){ | ||
| 105 | + return{line: params.term}; | ||
| 106 | + }, | ||
| 107 | + processResults: function (data) { | ||
| 108 | + return { | ||
| 109 | + results: data | ||
| 110 | + }; | ||
| 111 | + }, | ||
| 112 | + cache: true | ||
| 113 | + }, | ||
| 114 | + templateResult: function(repo){ | ||
| 115 | + if (repo.loading) return repo.text; | ||
| 116 | + var h = '<span>'+repo.text+'</span>'; | ||
| 117 | + return h; | ||
| 118 | + }, | ||
| 119 | + escapeMarkup: function (markup) { return markup; }, | ||
| 120 | + minimumInputLength: 1, | ||
| 121 | + templateSelection: function(repo){ | ||
| 122 | + return repo.text; | ||
| 123 | + }, | ||
| 124 | + language: { | ||
| 125 | + noResults: function(){ | ||
| 126 | + return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>'; | ||
| 127 | + }, | ||
| 128 | + inputTooShort : function(e) { | ||
| 129 | + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>'; | ||
| 130 | + }, | ||
| 131 | + searching : function() { | ||
| 132 | + return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + }); | ||
| 136 | + | ||
| 137 | + $("#query").on("click",function(){ | ||
| 138 | + var line = $("#line").val(); | ||
| 139 | + var date = $("#date").val(); | ||
| 140 | + $(".hidden").removeClass("hidden"); | ||
| 141 | + $get('/realSchedule/queryUserInfo',{line:line,date:date},function(result){ | ||
| 142 | + // 把数据填充到模版中 | ||
| 143 | + var tbodyHtml = template('list_info',{list:result}); | ||
| 144 | + // 把渲染好的模版html文本追加到表格中 | ||
| 145 | + $('#info tbody').html(tbodyHtml); | ||
| 146 | + }); | ||
| 147 | + }); | ||
| 148 | + | ||
| 149 | + var params = {}; | ||
| 150 | + var jName; | ||
| 151 | + $("#info tbody").on("click","tr",function(){ | ||
| 152 | + $('#forms .ludan_1').html(''); | ||
| 153 | + $('#forms .ludan_2').html(''); | ||
| 154 | + $('#forms .ludan_3').html(''); | ||
| 155 | + $('#forms .ludan_4').html(''); | ||
| 156 | + if($(this).children().size() < 2){ | ||
| 157 | + return; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + $(this).children().each(function(index){ | ||
| 161 | + params[index] = $(this).text(); | ||
| 162 | + }); | ||
| 163 | + jName = params[0].split("\\")[0]; | ||
| 164 | + var id = $("#"+params[1]).val(); | ||
| 165 | + $get('/realSchedule/'+id,null,function(result){ | ||
| 166 | + result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD"); | ||
| 167 | + var ludan_1 = template('ludan_1',result); | ||
| 168 | + //var ludan_4 = template('ludan_4',result); | ||
| 169 | + // 把渲染好的模版html文本追加到表格中 | ||
| 170 | + $('#forms .ludan_1').append(ludan_1); | ||
| 171 | + //$('#forms .ludan_4').append(ludan_4); | ||
| 172 | + }); | ||
| 173 | + $get('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ | ||
| 174 | + getTime(result); | ||
| 175 | + var ludan_2 = template('ludan_2',{list:result}); | ||
| 176 | + // 把渲染好的模版html文本追加到表格中 | ||
| 177 | + $('#forms .ludan_2').append(ludan_2); | ||
| 178 | + }); | ||
| 179 | + $get('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ | ||
| 180 | + var ludan_3 = template('ludan_3',result); | ||
| 181 | + $('#forms .ludan_3').append(ludan_3); | ||
| 182 | + }); | ||
| 183 | + | ||
| 184 | + }); | ||
| 185 | + | ||
| 186 | + $("#export").on("click",function(){ | ||
| 187 | + $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){ | ||
| 188 | + window.open("/downloadFile/download?fileName="+jName); | ||
| 189 | + }); | ||
| 190 | + }); | ||
| 191 | + | ||
| 192 | + $("#print").click(function(){ | ||
| 193 | + $("#printArea").printArea(); | ||
| 194 | + }); | ||
| 195 | + | ||
| 196 | + function getTime(list){ | ||
| 197 | + $.each(list, function(i, obj) { | ||
| 198 | + if(obj.zdsj != null && obj.zdsjActual != null ){ | ||
| 199 | + var zdsjActual = (obj.zdsjActual).split(":"); | ||
| 200 | + var zdsj = (obj.zdsj).split(":"); | ||
| 201 | + if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){ | ||
| 202 | + obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1])); | ||
| 203 | + } | ||
| 204 | + else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){ | ||
| 205 | + obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1])); | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + }); | ||
| 209 | + } | ||
| 210 | + }); | ||
| 211 | +</script> | ||
| 212 | +<script type="text/html" id="list_info"> | ||
| 213 | + {{each list as obj i}} | ||
| 214 | + <tr> | ||
| 215 | + <td width="45%">{{obj.jName}}\{{obj.jGh}}</td> | ||
| 216 | + <td width="32%">{{obj.clZbh}}</td> | ||
| 217 | + <td width="23%">{{obj.lpName}}<input type="hidden" id="{{obj.clZbh}}" value="{{obj.id}}"></td> | ||
| 218 | + </tr> | ||
| 219 | + {{/each}} | ||
| 220 | + {{if list.length == 0}} | ||
| 221 | + <tr> | ||
| 222 | + <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 223 | + </tr> | ||
| 224 | + {{/if}} | ||
| 225 | +</script> | ||
| 226 | +<script type="text/html" id="ludan_1"> | ||
| 227 | + <tr> | ||
| 228 | + <td colspan="13">行车路单</td> | ||
| 229 | + </tr> | ||
| 230 | + <tr> | ||
| 231 | + <td colspan="13">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}} 出场时间:{{fcsjActual}} 到达站名:{{zdzName}} 当班调度: 日期:{{scheduleDate}} 本日耗油: 升</td> | ||
| 232 | + </tr> | ||
| 233 | +<!-- | ||
| 234 | + <tr> | ||
| 235 | + <td rowspan="2">调度章</td> | ||
| 236 | + <td colspan="1"> </td> | ||
| 237 | + <td rowspan="2">早班</td> | ||
| 238 | + <td colspan="1"> </td> | ||
| 239 | + <td rowspan="2">夜班</td> | ||
| 240 | + <td colspan="1"> </td> | ||
| 241 | + <td rowspan="2" colspan="2">交叉</td> | ||
| 242 | + <td colspan="2"> </td> | ||
| 243 | + <td rowspan="2">其他</td> | ||
| 244 | + <td colspan="1"> </td> | ||
| 245 | + <td colspan="1"> </td> | ||
| 246 | + <td colspan="1"> </td> | ||
| 247 | + </tr> | ||
| 248 | + <tr> | ||
| 249 | + <td colspan="1"> </td> | ||
| 250 | + <td colspan="1"> </td> | ||
| 251 | + <td colspan="1"> </td> | ||
| 252 | + <td colspan="2"> </td> | ||
| 253 | + <td colspan="1"> </td> | ||
| 254 | + <td colspan="1"> </td> | ||
| 255 | + <td colspan="1"> </td> | ||
| 256 | + </tr> | ||
| 257 | +--> | ||
| 258 | + <tr> | ||
| 259 | + <td rowspan="2">车次</td> | ||
| 260 | + <td colspan="2">工号</td> | ||
| 261 | + <!-- <td rowspan="2">公里耗油</td> --> | ||
| 262 | + <td colspan="2">起讫站</td> | ||
| 263 | + <td colspan="4">时间</td> | ||
| 264 | + <td colspan="2">误点</td> | ||
| 265 | + <td rowspan="2" width="66px">里程(公里)计划</td> | ||
| 266 | + <td rowspan="2">备注</td> | ||
| 267 | + </tr> | ||
| 268 | + <tr> | ||
| 269 | + <td colspan="1" width="60px">司 机</td> | ||
| 270 | + <td colspan="1" width="60px">售 票</td> | ||
| 271 | + <td colspan="1">起点</td> | ||
| 272 | + <td colspan="1">终点</td> | ||
| 273 | + <td colspan="1">计发</td> | ||
| 274 | + <td colspan="1">实发</td> | ||
| 275 | + <td colspan="1">应到</td> | ||
| 276 | + <td colspan="1">实到</td> | ||
| 277 | + <td colspan="1">快</td> | ||
| 278 | + <td colspan="1">慢</td> | ||
| 279 | + </tr> | ||
| 280 | +</script> | ||
| 281 | +<script type="text/html" id="ludan_2"> | ||
| 282 | + {{each list as obj i}} | ||
| 283 | + <tr> | ||
| 284 | + <td>{{i+1}}</td> | ||
| 285 | + <td>{{obj.jName}}</td> | ||
| 286 | + <td>{{obj.sName}}</td> | ||
| 287 | + <td>{{obj.qdzName}}</td> | ||
| 288 | + <td>{{obj.zdzName}}</td> | ||
| 289 | + <td>{{obj.fcsj}}</td> | ||
| 290 | + <td>{{obj.fcsjActual}}</td> | ||
| 291 | + <td>{{obj.zdsj}}</td> | ||
| 292 | + <td>{{obj.zdsjActual}}</td> | ||
| 293 | + <td>{{obj.fast}}</td> | ||
| 294 | + <td>{{obj.slow}}</td> | ||
| 295 | + <td>{{obj.jhlc}}</td> | ||
| 296 | + <td>{{obj.remarks}}</td> | ||
| 297 | + </tr> | ||
| 298 | + {{/each}} | ||
| 299 | + {{if list.length == 0}} | ||
| 300 | + <tr> | ||
| 301 | + <td colspan="13"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 302 | + </tr> | ||
| 303 | + {{/if}} | ||
| 304 | +</script> | ||
| 305 | +<script type="text/html" id="ludan_3"> | ||
| 306 | + <tr> | ||
| 307 | + <td colspan="2">计划公里</td> | ||
| 308 | + <td>{{jhlc}}</td> | ||
| 309 | + <td>抽减公里</td> | ||
| 310 | + <td>{{remMileage}}</td> | ||
| 311 | + <td colspan="2">增加公里</td> | ||
| 312 | + <td>{{addMileage}}</td> | ||
| 313 | + <td colspan="2">实际计划公里</td> | ||
| 314 | + <td colspan="3">{{jhlc}}</td> | ||
| 315 | + </tr> | ||
| 316 | + <tr> | ||
| 317 | + <td colspan="2">营运公里</td> | ||
| 318 | + <td>{{realMileage}}</td> | ||
| 319 | + <td>空驶公里</td> | ||
| 320 | + <td>{{ksgl}}</td> | ||
| 321 | + <td colspan="2">总公里</td> | ||
| 322 | + <td>{{realMileage}}</td> | ||
| 323 | + <td colspan="2">计划班次</td> | ||
| 324 | + <td colspan="3">{{jhbc}}</td> | ||
| 325 | + </tr> | ||
| 326 | + <tr> | ||
| 327 | + <td colspan="2">抽减班次</td> | ||
| 328 | + <td>{{cjbc}}</td> | ||
| 329 | + <td>增加班次</td> | ||
| 330 | + <td>{{ljbc}}</td> | ||
| 331 | + <td colspan="2">实际计划班次</td> | ||
| 332 | + <td>{{jhbc}}</td> | ||
| 333 | + <td colspan="2">实际班次</td> | ||
| 334 | + <td colspan="3">{{sjbc}}</td> | ||
| 335 | + </tr> | ||
| 336 | +</script> | ||
| 337 | +<script type="text/html" id="ludan_4"> | ||
| 338 | + <tr> | ||
| 339 | + <td colspan="12">认真做好终点项目的例保保修工作,杜绝机械火警事故!</td> | ||
| 340 | + <td>轮胎</td> | ||
| 341 | + <td> </td> | ||
| 342 | + </tr> | ||
| 343 | + <tr> | ||
| 344 | + <td colspan="3">重点例保项目</td> | ||
| 345 | + <td>1</td> | ||
| 346 | + <td>2</td> | ||
| 347 | + <td>3</td> | ||
| 348 | + <td colspan="3">重点例保项目</td> | ||
| 349 | + <td>1</td> | ||
| 350 | + <td>2</td> | ||
| 351 | + <td>3</td> | ||
| 352 | + <td>灭火机</td> | ||
| 353 | + <td> </td> | ||
| 354 | + </tr> | ||
| 355 | + <tr> | ||
| 356 | + <td colspan="3">各类制动</td> | ||
| 357 | + <td> </td> | ||
| 358 | + <td> </td> | ||
| 359 | + <td> </td> | ||
| 360 | + <td colspan="3">各类灯光</td> | ||
| 361 | + <td> </td> | ||
| 362 | + <td> </td> | ||
| 363 | + <td> </td> | ||
| 364 | + <td colspan="2">出场路码表里程</td> | ||
| 365 | + </tr> | ||
| 366 | + <tr> | ||
| 367 | + <td colspan="3">方向机</td> | ||
| 368 | + <td> </td> | ||
| 369 | + <td> </td> | ||
| 370 | + <td> </td> | ||
| 371 | + <td colspan="3">各类仪表</td> | ||
| 372 | + <td> </td> | ||
| 373 | + <td> </td> | ||
| 374 | + <td> </td> | ||
| 375 | + <td colspan="2" rowspan="2"> </td> | ||
| 376 | + </tr> | ||
| 377 | + <tr> | ||
| 378 | + <td colspan="3">欠压报警器</td> | ||
| 379 | + <td> </td> | ||
| 380 | + <td> </td> | ||
| 381 | + <td> </td> | ||
| 382 | + <td colspan="3">各类皮带</td> | ||
| 383 | + <td> </td> | ||
| 384 | + <td> </td> | ||
| 385 | + <td> </td> | ||
| 386 | + </tr> | ||
| 387 | + <tr> | ||
| 388 | + <td colspan="3">发动机清洁及响声</td> | ||
| 389 | + <td> </td> | ||
| 390 | + <td> </td> | ||
| 391 | + <td> </td> | ||
| 392 | + <td colspan="3">油箱及托架</td> | ||
| 393 | + <td> </td> | ||
| 394 | + <td> </td> | ||
| 395 | + <td> </td> | ||
| 396 | + <td colspan="2">出场路码表里程</td> | ||
| 397 | + </tr> | ||
| 398 | + <tr> | ||
| 399 | + <td colspan="3">地盘响声</td> | ||
| 400 | + <td> </td> | ||
| 401 | + <td> </td> | ||
| 402 | + <td> </td> | ||
| 403 | + <td colspan="3">轮胎、半轴螺栓螺母</td> | ||
| 404 | + <td> </td> | ||
| 405 | + <td> </td> | ||
| 406 | + <td> </td> | ||
| 407 | + <td colspan="2" rowspan="3"> </td> | ||
| 408 | + </tr> | ||
| 409 | + <tr> | ||
| 410 | + <td colspan="3">化油器及油路</td> | ||
| 411 | + <td> </td> | ||
| 412 | + <td> </td> | ||
| 413 | + <td> </td> | ||
| 414 | + <td colspan="3">油、电、水、气</td> | ||
| 415 | + <td> </td> | ||
| 416 | + <td> </td> | ||
| 417 | + <td> </td> | ||
| 418 | + </tr> | ||
| 419 | + <tr> | ||
| 420 | + <td colspan="3">进排歧管及排气管</td> | ||
| 421 | + <td> </td> | ||
| 422 | + <td> </td> | ||
| 423 | + <td> </td> | ||
| 424 | + <td colspan="3">内外车身及附件</td> | ||
| 425 | + <td> </td> | ||
| 426 | + <td> </td> | ||
| 427 | + <td> </td> | ||
| 428 | + </tr> | ||
| 429 | + <tr> | ||
| 430 | + <td colspan="14">1 首次出场,2 复使中途,3 某次进场。√正常,ⓧ报修,×尚未报修</td> | ||
| 431 | + </tr> | ||
| 432 | +</script> | ||
| 0 | \ No newline at end of file | 433 | \ No newline at end of file |
src/main/resources/static/pages/permission/user/add.html
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | </div> | 19 | </div> |
| 20 | </div> | 20 | </div> |
| 21 | <div class="portlet-body form"> | 21 | <div class="portlet-body form"> |
| 22 | - <form action="/resource" class="form-horizontal" id="resource_add_form" > | 22 | + <form action="/addUser" class="form-horizontal" id="user_add_form" > |
| 23 | <div class="alert alert-danger display-hide"> | 23 | <div class="alert alert-danger display-hide"> |
| 24 | <button class="close" data-close="alert"></button> | 24 | <button class="close" data-close="alert"></button> |
| 25 | 您的输入有误,请检查下面的输入项 | 25 | 您的输入有误,请检查下面的输入项 |
| @@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
| 41 | <div class="form-group"> | 41 | <div class="form-group"> |
| 42 | <label class="col-md-3 control-label">密码</label> | 42 | <label class="col-md-3 control-label">密码</label> |
| 43 | <div class="col-md-4"> | 43 | <div class="col-md-4"> |
| 44 | - <input type="password" class="form-control" name="password" > | 44 | + <input type="password" class="form-control" id="password" name="password" > |
| 45 | <span class="help-block"> 请输入6位以上密码</span> | 45 | <span class="help-block"> 请输入6位以上密码</span> |
| 46 | </div> | 46 | </div> |
| 47 | </div> | 47 | </div> |
| @@ -62,8 +62,8 @@ | @@ -62,8 +62,8 @@ | ||
| 62 | <div class="form-group"> | 62 | <div class="form-group"> |
| 63 | <label class="col-md-3 control-label">角色</label> | 63 | <label class="col-md-3 control-label">角色</label> |
| 64 | <div class="col-md-4"> | 64 | <div class="col-md-4"> |
| 65 | - <select class="form-control" name="role[]" style="width: 160px;" multiple="multiple"> | ||
| 66 | - <option>请选择...</option> | 65 | + <select class="form-control" id="role" name="roles[]" style="width: 160px;" multiple="multiple"> |
| 66 | + | ||
| 67 | </select> | 67 | </select> |
| 68 | </div> | 68 | </div> |
| 69 | </div> | 69 | </div> |
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | <label class="col-md-3 control-label">是否启用</label> | 72 | <label class="col-md-3 control-label">是否启用</label> |
| 73 | <div class="col-md-4"> | 73 | <div class="col-md-4"> |
| 74 | <div class="input-group"> | 74 | <div class="input-group"> |
| 75 | - <select class="form-control" name="enable" style="width: 160px;"> | 75 | + <select class="form-control" name="enabled" style="width: 160px;"> |
| 76 | <option value="1">可用</option> | 76 | <option value="1">可用</option> |
| 77 | <option value="0">禁用</option> | 77 | <option value="0">禁用</option> |
| 78 | </select> | 78 | </select> |
| @@ -93,5 +93,88 @@ | @@ -93,5 +93,88 @@ | ||
| 93 | </div> | 93 | </div> |
| 94 | </div> | 94 | </div> |
| 95 | <script> | 95 | <script> |
| 96 | - | 96 | + $(function(){ |
| 97 | + $get('/role/all',null,function(result){ | ||
| 98 | + $.each(result,function(i,obj){ | ||
| 99 | + $("#role").append("<option value='"+obj.id+"'>"+obj.roleName+"</option>"); | ||
| 100 | + }); | ||
| 101 | + }); | ||
| 102 | + | ||
| 103 | + var form = $('#user_add_form'); | ||
| 104 | + var error = $('.alert-danger', form); | ||
| 105 | + | ||
| 106 | + //表单 validate | ||
| 107 | + form.validate({ | ||
| 108 | + errorElement : 'span', | ||
| 109 | + errorClass : 'help-block help-block-error', | ||
| 110 | + focusInvalid : false, | ||
| 111 | + rules : { | ||
| 112 | + 'userName' : { | ||
| 113 | + required : true, | ||
| 114 | + maxlength: 25 | ||
| 115 | + }, | ||
| 116 | + 'name' : { | ||
| 117 | + required : true, | ||
| 118 | + maxlength: 25 | ||
| 119 | + }, | ||
| 120 | + 'password' : { | ||
| 121 | + required : true, | ||
| 122 | + minlength: 6, | ||
| 123 | + maxlength: 25 | ||
| 124 | + }, | ||
| 125 | + 'cfmPassword' : { | ||
| 126 | + equalTo: '#password' | ||
| 127 | + }, | ||
| 128 | + 'role' : { | ||
| 129 | + required : true, | ||
| 130 | + minlength: 1 | ||
| 131 | + } | ||
| 132 | + }, | ||
| 133 | + invalidHandler : function(event, validator) { | ||
| 134 | + error.show(); | ||
| 135 | + App.scrollTo(error, -200); | ||
| 136 | + }, | ||
| 137 | + | ||
| 138 | + highlight : function(element) { | ||
| 139 | + $(element).closest('.form-group').addClass('has-error'); | ||
| 140 | + }, | ||
| 141 | + | ||
| 142 | + unhighlight : function(element) { | ||
| 143 | + $(element).closest('.form-group').removeClass('has-error'); | ||
| 144 | + }, | ||
| 145 | + | ||
| 146 | + success : function(label) { | ||
| 147 | + label.closest('.form-group').removeClass('has-error'); | ||
| 148 | + }, | ||
| 149 | + | ||
| 150 | + submitHandler : function(f) { | ||
| 151 | + var params = form.serializeJSON(); | ||
| 152 | + error.hide(); | ||
| 153 | + console.log(params); | ||
| 154 | + | ||
| 155 | + //检查一下用户是否存在 | ||
| 156 | + $get('/user/all', {userName_eq: params.userName}, function(list){ | ||
| 157 | + if(!list || list.length == 0){ | ||
| 158 | + console.log(params); | ||
| 159 | + $.ajax({ | ||
| 160 | + url: '/user', | ||
| 161 | + type: 'POST', | ||
| 162 | + traditional: true, | ||
| 163 | + data: params, | ||
| 164 | + success: function(res){ | ||
| 165 | + layer.msg('添加用户成功.'); | ||
| 166 | + loadPage('list.html'); | ||
| 167 | + } | ||
| 168 | + }); | ||
| 169 | + /* $post('/user', params, function(res){ | ||
| 170 | + layer.msg('添加用户成功.'); | ||
| 171 | + loadPage('list.html'); | ||
| 172 | + }); */ | ||
| 173 | + } | ||
| 174 | + else | ||
| 175 | + layer.alert('用户【' + params.userName + '】已存在', {icon: 2, title: '提交被拒绝'}); | ||
| 176 | + }); | ||
| 177 | + } | ||
| 178 | + }); | ||
| 179 | + }); | ||
| 97 | </script> | 180 | </script> |
| 98 | \ No newline at end of file | 181 | \ No newline at end of file |
src/main/resources/static/pages/permission/user/changePWD.html
0 → 100644
| 1 | +<div class="row"> | ||
| 2 | +<div class="col-md-12"> | ||
| 3 | +<!-- BEGIN VALIDATION STATES--> | ||
| 4 | +<div class="portlet light portlet-fit portlet-form bordered"> | ||
| 5 | +<div class="portlet-body"> | ||
| 6 | + <form action="/user/changePWD" class="form-horizontal" id="changePWD"> | ||
| 7 | + <div class="form-group" style="margin-top: 60px"> | ||
| 8 | + <label class="control-label col-md-5">原始密码: | ||
| 9 | + </label> | ||
| 10 | + <div class="col-md-4"> | ||
| 11 | + <div class="input-icon right"> | ||
| 12 | + <i class="fa"></i> | ||
| 13 | + <input type="password" class="form-control" name="oldPWD" /> </div> | ||
| 14 | + </div> | ||
| 15 | + </div> | ||
| 16 | + <div class="form-group"> | ||
| 17 | + <label class="control-label col-md-5">输入新密码: | ||
| 18 | + </label> | ||
| 19 | + <div class="col-md-4"> | ||
| 20 | + <div class="input-icon right"> | ||
| 21 | + <i class="fa"></i> | ||
| 22 | + <input type="password" class="form-control" name="newPWD" /> </div> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 25 | + <div class="form-group"> | ||
| 26 | + <label class="control-label col-md-5">确认新密码: | ||
| 27 | + </label> | ||
| 28 | + <div class="col-md-4"> | ||
| 29 | + <div class="input-icon right"> | ||
| 30 | + <i class="fa"></i> | ||
| 31 | + <input type="password" class="form-control" name="cnewPWD" /> </div> | ||
| 32 | + </div> | ||
| 33 | + </div> | ||
| 34 | + <div class="form-actions"> | ||
| 35 | + <div class="row"> | ||
| 36 | + <div class="col-md-offset-5 col-md-7"> | ||
| 37 | + <button type="button" id="confirm" class="btn green">确定</button> | ||
| 38 | + <button type="reset" class="btn default">取消</button> | ||
| 39 | + </div> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + </form> | ||
| 43 | +</div> | ||
| 44 | +</div> | ||
| 45 | +</div> | ||
| 46 | +</div> | ||
| 47 | + | ||
| 48 | +<script> | ||
| 49 | +$(function(){ | ||
| 50 | + $("#confirm").on("click",function(){ | ||
| 51 | + $.get('/user/changePWD',null,function(){ | ||
| 52 | + | ||
| 53 | + }); | ||
| 54 | + }); | ||
| 55 | +}); | ||
| 56 | +</script> | ||
| 0 | \ No newline at end of file | 57 | \ No newline at end of file |
src/main/resources/static/pages/permission/user/list.html
| @@ -75,7 +75,7 @@ | @@ -75,7 +75,7 @@ | ||
| 75 | </td> | 75 | </td> |
| 76 | <td></td> | 76 | <td></td> |
| 77 | <td> | 77 | <td> |
| 78 | - <select class="form-control form-filter " name="enable_eq"> | 78 | + <select class="form-control form-filter " name="enabled_eq"> |
| 79 | <option value="">请选择...</option> | 79 | <option value="">请选择...</option> |
| 80 | <option value="1">可用</option> | 80 | <option value="1">可用</option> |
| 81 | <option value="0">禁用</option> | 81 | <option value="0">禁用</option> |
| @@ -132,7 +132,13 @@ | @@ -132,7 +132,13 @@ | ||
| 132 | <td> | 132 | <td> |
| 133 | {{obj.lastLoginDate}} | 133 | {{obj.lastLoginDate}} |
| 134 | </td> | 134 | </td> |
| 135 | - <td><a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a></td> | 135 | + <td> |
| 136 | + {{if obj.enabled}} | ||
| 137 | + <button type="button" onclick="changeEnabled({{obj.id}},0)" class="btn btn-warning btn-sm">禁用</button> | ||
| 138 | + {{else}} | ||
| 139 | + <button type="button" onclick="changeEnabled({{obj.id}},1)" class="btn btn-success btn-sm">启用</button> | ||
| 140 | + {{/if}} | ||
| 141 | + </td> | ||
| 136 | </tr> | 142 | </tr> |
| 137 | {{/each}} | 143 | {{/each}} |
| 138 | {{if list.length == 0}} | 144 | {{if list.length == 0}} |
| @@ -252,4 +258,11 @@ $(function(){ | @@ -252,4 +258,11 @@ $(function(){ | ||
| 252 | }); | 258 | }); |
| 253 | }); | 259 | }); |
| 254 | }); | 260 | }); |
| 261 | +//改变状态 | ||
| 262 | +function changeEnabled(id,enabled){ | ||
| 263 | + debugger | ||
| 264 | + $get('/user/changeEnabled',{id:id,enabled:enabled},function(result){ | ||
| 265 | + jsDoQuery(null, true); | ||
| 266 | + }) | ||
| 267 | +} | ||
| 255 | </script> | 268 | </script> |
| 256 | \ No newline at end of file | 269 | \ No newline at end of file |