Commit 136a8f3a0600c9b14ce7e16a61110c54a54ff875

Authored by 潘钊
2 parents 4c9efba6 47b86d05

Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang

# Conflicts:
#	src/main/java/com/bsth/data/schedule/edit_logs/ScheduleModifyLogger.java
src/main/java/com/bsth/controller/schedule/core/TTInfoDetailController.java
@@ -4,6 +4,7 @@ import com.bsth.common.ResponseCode; @@ -4,6 +4,7 @@ import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 4 import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.TTInfoDetail; 5 import com.bsth.entity.schedule.TTInfoDetail;
6 import com.bsth.service.schedule.TTInfoDetailService; 6 import com.bsth.service.schedule.TTInfoDetailService;
  7 +import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.web.bind.annotation.*; 9 import org.springframework.web.bind.annotation.*;
9 10
@@ -73,9 +74,13 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> { @@ -73,9 +74,13 @@ public class TTInfoDetailController extends BController<TTInfoDetail, Long> {
73 @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET) 74 @RequestMapping(value = "/edit/{xlid}/{ttid}", method = RequestMethod.GET)
74 public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid, 75 public Map<String, Object> getEditInfo(@PathVariable("xlid") Integer xlid,
75 @PathVariable("ttid") Long ttid) { 76 @PathVariable("ttid") Long ttid) {
  77 +
  78 + // 获取最大的发车数,用于输出数据的数量
  79 + Long maxfcno = ttInfoDetailService.findMaxFcno(xlid, ttid);
  80 +
76 Map<String, Object> rtn = new HashMap<>(); 81 Map<String, Object> rtn = new HashMap<>();
77 try { 82 try {
78 - TTInfoDetailService.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid); 83 + TTInfoDetailForEdit.EditInfo editInfo = ttInfoDetailService.getEditInfo(xlid, ttid, maxfcno);
79 rtn.put("status", ResponseCode.SUCCESS); 84 rtn.put("status", ResponseCode.SUCCESS);
80 rtn.put("data", editInfo); 85 rtn.put("data", editInfo);
81 } catch (Exception exp) { 86 } catch (Exception exp) {
src/main/java/com/bsth/data/schedule/edit_logs/FormLogger.java
1 -package com.bsth.data.schedule.edit_logs;  
2 -  
3 -import com.bsth.controller.realcontrol.dto.ChangePersonCar;  
4 -import com.bsth.entity.mcy_forms.Changetochange;  
5 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
6 -import com.bsth.entity.sys.SysUser;  
7 -import com.bsth.repository.form.ChangetochangeRepository;  
8 -import com.bsth.security.util.SecurityUtils;  
9 -import org.apache.commons.lang3.StringUtils;  
10 -import org.joda.time.format.DateTimeFormat;  
11 -import org.joda.time.format.DateTimeFormatter;  
12 -import org.slf4j.Logger;  
13 -import org.slf4j.LoggerFactory;  
14 -import org.springframework.beans.factory.annotation.Autowired;  
15 -import org.springframework.stereotype.Service;  
16 -  
17 -import java.util.Date;  
18 -  
19 -/**  
20 - * 为报表写入相关的班次修改记录  
21 - * Created by panzhao on 2017/5/7.  
22 - */  
23 -@Service  
24 -public class FormLogger {  
25 -  
26 - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");  
27 -  
28 - Logger log = LoggerFactory.getLogger(this.getClass());  
29 -  
30 - @Autowired  
31 - ChangetochangeRepository changetochangeRepository;  
32 -  
33 - /**  
34 - * 换人换车情况表  
35 - */  
36 - public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc){  
37 - try {  
38 - String newNbbm = cpc.getClZbh();  
39 - String newJsy = cpc.getJsy();  
40 - String oldJsy = sch.getjGh()+"/"+sch.getjName();  
41 -  
42 - if(newNbbm == null && newJsy == null)  
43 - return;  
44 -  
45 - if(newNbbm != null && newJsy != null  
46 - && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy))  
47 - return;  
48 -  
49 - Date d = new Date();  
50 - SysUser user = SecurityUtils.getCurrentUser();  
51 - Changetochange cc = new Changetochange();  
52 - cc.setRq(sch.getScheduleDateStr());  
53 - cc.setGs(sch.getGsBm());  
54 - cc.setFgs(sch.getFgsBm());  
55 - cc.setXl(sch.getXlBm());  
56 - cc.setLp(sch.getLpName());  
57 - cc.setFssj(fmtHHmm.print(d.getTime()));  
58 - cc.setXgsj(fmtHHmm.print(d.getTime()));  
59 - if(user != null)  
60 - cc.setXgr(user.getUserName());  
61 -  
62 - cc.setPcch(sch.getClZbh());  
63 - cc.setPcry(oldJsy);  
64 - cc.setJhch(sch.getClZbh());  
65 - cc.setJhgh(sch.getjGh());  
66 -  
67 - if(StringUtils.isNotEmpty(newNbbm))  
68 - cc.setSjch(newNbbm);  
69 - if(StringUtils.isNotEmpty(newJsy))  
70 - cc.setSjgh(newJsy);  
71 -  
72 - changetochangeRepository.save(cc);  
73 - }catch (Exception e){  
74 - log.error("纪录换人换车情况表", e);  
75 - }  
76 - }  
77 -  
78 - public void saveChangetochange(ScheduleRealInfo sch, String nbbm, String jsy){  
79 - ChangePersonCar cpc = new ChangePersonCar();  
80 - cpc.setClZbh(nbbm);  
81 - cpc.setJsy(jsy);  
82 - saveChangetochange(sch, cpc);  
83 - }  
84 -} 1 +package com.bsth.data.schedule.edit_logs;
  2 +
  3 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  4 +import com.bsth.entity.mcy_forms.Changetochange;
  5 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  6 +import com.bsth.entity.sys.SysUser;
  7 +import com.bsth.repository.form.ChangetochangeRepository;
  8 +import com.bsth.security.util.SecurityUtils;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.joda.time.format.DateTimeFormat;
  11 +import org.joda.time.format.DateTimeFormatter;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Service;
  16 +
  17 +import java.util.Date;
  18 +
  19 +/**
  20 + * 为报表写入相关的班次修改记录
  21 + * Created by panzhao on 2017/5/7.
  22 + */
  23 +@Service
  24 +public class FormLogger {
  25 +
  26 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  27 +
  28 + Logger log = LoggerFactory.getLogger(this.getClass());
  29 +
  30 + @Autowired
  31 + ChangetochangeRepository changetochangeRepository;
  32 +
  33 + /**
  34 + * 换人换车情况表
  35 + */
  36 + public void saveChangetochange(ScheduleRealInfo sch, ChangePersonCar cpc){
  37 + try {
  38 + String newNbbm = cpc.getClZbh();
  39 + String newJsy = cpc.getJsy();
  40 + String oldJsy = sch.getjGh()+"/"+sch.getjName();
  41 +
  42 + if(newNbbm == null && newJsy == null)
  43 + return;
  44 +
  45 + if(newNbbm != null && newJsy != null
  46 + && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy))
  47 + return;
  48 +
  49 + Date d = new Date();
  50 + SysUser user = SecurityUtils.getCurrentUser();
  51 + Changetochange cc = new Changetochange();
  52 + cc.setRq(sch.getScheduleDateStr());
  53 + cc.setGs(sch.getGsBm());
  54 + cc.setFgs(sch.getFgsBm());
  55 + cc.setXl(sch.getXlBm());
  56 + cc.setLp(sch.getLpName());
  57 + cc.setFssj(fmtHHmm.print(d.getTime()));
  58 + cc.setXgsj(fmtHHmm.print(d.getTime()));
  59 + if(user != null)
  60 + cc.setXgr(user.getUserName());
  61 +
  62 + cc.setPcch(sch.getClZbh());
  63 + cc.setPcry(oldJsy);
  64 + cc.setJhch(sch.getClZbh());
  65 + cc.setJhgh(sch.getjGh());
  66 +
  67 + if(StringUtils.isNotEmpty(newNbbm))
  68 + cc.setSjch(newNbbm);
  69 + if(StringUtils.isNotEmpty(newJsy))
  70 + cc.setSjgh(newJsy);
  71 +
  72 + changetochangeRepository.save(cc);
  73 + }catch (Exception e){
  74 + log.error("纪录换人换车情况表", e);
  75 + }
  76 + }
  77 +
  78 + public void saveChangetochange(ScheduleRealInfo sch, String nbbm, String jsy){
  79 + ChangePersonCar cpc = new ChangePersonCar();
  80 + cpc.setClZbh(nbbm);
  81 + cpc.setJsy(jsy);
  82 + saveChangetochange(sch, cpc);
  83 + }
  84 +}
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -1016,18 +1016,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1016,18 +1016,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1016 if(nbbm.trim()!=""){ 1016 if(nbbm.trim()!=""){
1017 stringList.add(nbbm); 1017 stringList.add(nbbm);
1018 List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm); 1018 List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);
1019 - int cs=Integer.parseInt(objectLists.get(0)[1].toString());  
1020 - if(sxtj.equals("1")){  
1021 - if(cs==1){ 1019 + if(objectLists.size()>0){
  1020 + int cs=Integer.parseInt(objectLists.get(0)[1].toString());
  1021 + if(sxtj.equals("1")){
  1022 + if(cs==1){
  1023 + listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1024 + }
  1025 + }else if(sxtj.equals("2")){
  1026 + if(cs>1){
  1027 + listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1028 + }
  1029 + }else{
1022 listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); 1030 listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
1023 } 1031 }
1024 } 1032 }
1025 1033
1026 - if(sxtj.equals("2")){  
1027 - if(cs>1){  
1028 - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);  
1029 - }  
1030 - }  
1031 }else{ 1034 }else{
1032 //全部 1035 //全部
1033 if(sxtj.equals("0")){ 1036 if(sxtj.equals("0")){
@@ -1248,17 +1251,18 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1248,17 +1251,18 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1248 if(zlc>0){ 1251 if(zlc>0){
1249 long l=0l; 1252 long l=0l;
1250 double ylxs=0.0; 1253 double ylxs=0.0;
1251 - if(i==iterator2.size()){ 1254 + if(i==iterator2.size()-1){
1252 ylxs=czyl; 1255 ylxs=czyl;
1253 }else{ 1256 }else{
1254 l=Math.round(nextJzyl); 1257 l=Math.round(nextJzyl);
1255 ylxs=l*100/100; 1258 ylxs=l*100/100;
1256 } 1259 }
1257 -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));  
1258 yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); 1260 yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
1259 t.setYh(yh); 1261 t.setYh(yh);
1260 t.setJzyl(ylxs); 1262 t.setJzyl(ylxs);
1261 nextJzyl=ylxs; 1263 nextJzyl=ylxs;
  1264 +
  1265 +
1262 }else{ 1266 }else{
1263 t.setYh(yh); 1267 t.setYh(yh);
1264 t.setJzyl(nextJzyl); 1268 t.setJzyl(nextJzyl);
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -573,191 +573,77 @@ public class ReportServiceImpl implements ReportService{ @@ -573,191 +573,77 @@ public class ReportServiceImpl implements ReportService{
573 573
574 //查询全程 574 //查询全程
575 String sqlqc="select t.*,x.station_name as qdz_name from ( " 575 String sqlqc="select t.*,x.station_name as qdz_name from ( "
576 - + "(SELECT fcsj,qdz,2 as xh,xl_dir FROM bsth_c_s_ttinfo_detail "  
577 - + " where ttinfo ='"+ttinfo+"' and bc_type='normal' and fcsj <='"+minfcsj+"' ) " 576 + + " (SELECT bc_type, fcsj,qdz,2 as xh,xl_dir FROM bsth_c_s_ttinfo_detail "
  577 + + " where ttinfo ='"+ttinfo+"' and (bc_type='normal' || bc_type='region') "
  578 + + " and fcsj <='"+minfcsj+"') "
578 + " union " 579 + " union "
579 - + " (SELECT fcsj,qdz,1 as xh,xl_dir FROM bsth_c_s_ttinfo_detail "  
580 - + " where ttinfo ='"+ttinfo+"' and bc_type='normal' and fcsj > '"+minfcsj+"') "  
581 - + "order by xl_dir,xh,fcsj ) t left join bsth_c_station x on t.qdz=x.id"; 580 + + " (SELECT bc_type, fcsj,qdz,1 as xh,xl_dir FROM bsth_c_s_ttinfo_detail "
  581 + + " where ttinfo ='"+ttinfo+"' and (bc_type='normal' || bc_type='region') "
  582 + + " and fcsj > '"+minfcsj+"') "
  583 + + "order by xl_dir,xh,fcsj ) t left join bsth_c_station x on t.qdz=x.id";
582 List<Map<String, String>> qclist= jdbcTemplate.query(sqlqc, 584 List<Map<String, String>> qclist= jdbcTemplate.query(sqlqc,
583 new RowMapper<Map<String, String>>(){ 585 new RowMapper<Map<String, String>>(){
584 @Override 586 @Override
585 - public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {  
586 - Map<String, String> m=new HashMap<String,String>();  
587 - m.put("qdz_name", rs.getString("qdz_name"));  
588 - m.put("fcsj", rs.getString("fcsj"));  
589 - m.put("xl", rs.getString("xl_dir"));  
590 - return m;  
591 - } 587 + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {
  588 + Map<String, String> m=new HashMap<String,String>();
  589 + m.put("qdz_name", rs.getString("qdz_name"));
  590 + m.put("bcType", rs.getString("bc_type"));
  591 + m.put("fcsj", rs.getString("fcsj"));
  592 + m.put("xl", rs.getString("xl_dir"));
  593 + m.put("xh", rs.getString("xh"));
  594 + return m;
  595 + }
592 596
593 }); 597 });
594 -  
595 - Map<String, Object> qcMap=new HashMap<String,Object>();  
596 - int num=0;  
597 - String sxfcsj="";  
598 - String xxfcsj="";  
599 - String sxzd="";  
600 - String xxzd="";  
601 - for (int i = 0; i < qclist.size(); i++) {  
602 - Map<String, String> map=qclist.get(i);  
603 - if(map.get("xl").equals("0")){  
604 - if(sxzd.equals("")){  
605 - sxzd=map.get("qdz_name").toString();  
606 - qcMap.put("sxzm", sxzd);  
607 - sxfcsj +=map.get("fcsj").toString()+"-";  
608 - }  
609 - if(!(qclist.get(i+1).get("xl").equals("0"))){  
610 - sxfcsj +=map.get("fcsj").toString();  
611 - qcMap.put("sxsj",sxfcsj);  
612 - qcMap.put("sxbc", i+1);  
613 - num=i+1;  
614 - }  
615 - }  
616 - if(map.get("xl").equals("1")){  
617 - if(xxzd.equals("")){  
618 - xxzd=map.get("qdz_name").toString();  
619 - xxfcsj+=map.get("fcsj").toString()+"-";  
620 - qcMap.put("xxzm", xxzd);  
621 - } 598 +
  599 + List<List<Map<String, String>>> mapList = new ArrayList<List<Map<String,String>>>();
  600 + mapList.add(new ArrayList<Map<String, String>>());
  601 + mapList.add(new ArrayList<Map<String, String>>());
  602 + for(Map<String, String> m : qclist){
  603 + String bcType = m.get("bcType");
  604 + if(bcType.equals("normal")){
  605 + mapList.get(0).add(m);
  606 + } else {
  607 + mapList.get(1).add(m);
622 } 608 }
623 } 609 }
624 - xxfcsj +=qclist.get(qclist.size()-1).get("fcsj").toString();  
625 - qcMap.put("xxsj", xxfcsj);  
626 - qcMap.put("xxbc", qclist.size()-num);  
627 - list.add(qcMap);  
628 610
629 -  
630 - //查询区间  
631 - String sqlqj="select t.*,x.station_name as qdz_name from ( "  
632 - + "(SELECT fcsj,qdz,'1' as gf,xl_dir FROM bsth_c_s_ttinfo_detail "  
633 - + "where ttinfo ='"+ttinfo+"' and bc_type='region' and fcsj >='06:31'"  
634 - + "and fcsj <'08:30')"  
635 - + " union ( SELECT fcsj,qdz,'2' as gf,xl_dir FROM bsth_c_s_ttinfo_detail "  
636 - + "where ttinfo ='"+ttinfo+"' and bc_type='region' "  
637 - + "and fcsj > '16:01' and fcsj < '18:00') order by xl_dir,gf,fcsj ) t "  
638 - + "left join bsth_c_station x on t.qdz=x.id";  
639 -  
640 - List<Map<String, String>> qjlist= jdbcTemplate.query(sqlqj,  
641 - new RowMapper<Map<String, String>>(){  
642 - @Override  
643 - public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {  
644 - Map<String, String> m=new HashMap<String,String>();  
645 - m.put("qdz_name", rs.getString("qdz_name"));  
646 - m.put("fcsj", rs.getString("fcsj"));  
647 - m.put("xl", rs.getString("xl_dir"));  
648 - m.put("gf", rs.getString("gf"));  
649 - return m;  
650 - }  
651 - });  
652 -  
653 - Map<String, Object> qjzMap=new HashMap<String,Object>();  
654 - Map<String, Object> qjwMap=new HashMap<String,Object>();  
655 - int numqj=0;  
656 - String sxfcsjqj="";  
657 - String xxfcsjqj="";  
658 - String sxzdqj="";  
659 - String xxzdqj="";  
660 - for(int i=0;i<qjlist.size();i++){  
661 - Map<String, String> map=qjlist.get(i);  
662 - if(map.get("xl").toString().equals("0")){  
663 - if(map.get("gf").toString().equals("1")){  
664 - if(sxzdqj.equals("")){  
665 - sxzdqj =map.get("qdz_name").toString();  
666 - qjzMap.put("sxzm", sxzdqj);  
667 - sxfcsjqj +=map.get("fcsj").toString()+"-";  
668 - }  
669 - if(i<qjlist.size()-1){  
670 - if(!(qjlist.get(i+1).get("gf").equals("1"))){  
671 - sxfcsjqj +=map.get("fcsj").toString();  
672 - qjzMap.put("sxsj",sxfcsjqj);  
673 - qjzMap.put("sxbc", i+1);  
674 - numqj=i+1;  
675 - sxzdqj ="";  
676 - sxfcsjqj="";  
677 - }  
678 - }else{  
679 - qjzMap.put("sxsj",sxfcsjqj+"-"+map.get("fcsj").toString());  
680 - qjzMap.put("sxbc", i+1);  
681 - numqj=i+1;  
682 - sxzdqj ="";  
683 - sxfcsjqj="";  
684 - }  
685 - }  
686 - if(map.get("gf").toString().equals("2")){  
687 - if(sxzdqj.equals("")){  
688 - sxzdqj =map.get("qdz_name").toString();  
689 - qjwMap.put("sxzm", sxzdqj);  
690 - sxfcsjqj +=map.get("fcsj").toString()+"-";  
691 - }  
692 - if(i<qjlist.size()-1){  
693 - if(!(qjlist.get(i+1).get("xl").equals("0"))){  
694 - sxfcsjqj +=map.get("fcsj").toString();  
695 - qjwMap.put("sxsj",sxfcsjqj);  
696 - qjwMap.put("sxbc", i+1-numqj);  
697 - numqj=i+1;  
698 - }  
699 - }else{  
700 - qjwMap.put("sxsj",sxfcsjqj+"-"+map.get("fcsj").toString());  
701 - qjwMap.put("sxbc", i+1-numqj);  
702 - numqj=i+1;  
703 - }  
704 - }  
705 -  
706 - }else{  
707 - if(map.get("gf").toString().equals("1")){  
708 - if(xxzdqj.equals("")){  
709 - xxzdqj =map.get("qdz_name").toString();  
710 - qjzMap.put("xxzm", xxzdqj);  
711 - xxfcsjqj +=map.get("fcsj").toString()+"-";  
712 - }  
713 - if(i<qjlist.size()-1){  
714 - if(!(qjlist.get(i+1).get("gf").equals("1"))){  
715 - xxfcsjqj +=map.get("fcsj").toString();  
716 - qjzMap.put("xxsj",xxfcsjqj);  
717 - qjzMap.put("xxbc", i+1-numqj);  
718 - numqj=i+1;  
719 - xxzdqj ="";  
720 - xxfcsjqj="";  
721 - }  
722 - }else{  
723 - qjzMap.put("xxsj",xxfcsjqj+"-"+map.get("fcsj").toString());  
724 - qjzMap.put("xxbc", i+1-numqj);  
725 - numqj=i+1;  
726 - xxzdqj ="";  
727 - xxfcsjqj="";  
728 - }  
729 - }  
730 - if(map.get("gf").toString().equals("2")){  
731 - if(xxzdqj.equals("")){  
732 - xxzdqj =map.get("qdz_name").toString();  
733 - qjwMap.put("xxzm", xxzdqj);  
734 - xxfcsjqj +=map.get("fcsj").toString()+"-";  
735 - }  
736 - if(i<qjlist.size()){  
737 - if(i==qjlist.size()-1){  
738 - xxfcsjqj +=map.get("fcsj").toString();  
739 - qjwMap.put("xxsj",xxfcsjqj);  
740 - qjwMap.put("xxbc", i+1-numqj);  
741 - numqj=i+1;  
742 - }  
743 - }else{  
744 - qjwMap.put("xxsj",xxfcsjqj+"-"+xxfcsjqj);  
745 - qjwMap.put("xxbc", i+1-numqj);  
746 - numqj=i+1;  
747 - } 611 + for(int i = 0; i < mapList.size(); i++){
  612 + List<Map<String, String>> l = mapList.get(i);
  613 + Map<String, Object> tempMap = new HashMap<String, Object>();
  614 + List<String> upfcsj = new ArrayList<String>();
  615 + List<String> downfcsj = new ArrayList<String>();
  616 + String sxqdz = "", xxqdz = "";
  617 + String sxfcsj = "", xxfcsj = "";
  618 + int sxbc = 0, xxbc = 0;
  619 + for(Map<String, String> m : l){
  620 + if(m.get("xl").equals("0")){
  621 + sxbc++;
  622 + upfcsj.add(m.get("fcsj"));
  623 + if(sxqdz.length() == 0 && m.containsKey("qdz_name"))
  624 + sxqdz = m.get("qdz_name");
  625 + } else {
  626 + xxbc++;
  627 + downfcsj.add(m.get("fcsj"));
  628 + if(xxqdz.length() == 0 && m.containsKey("qdz_name"))
  629 + xxqdz = m.get("qdz_name");
748 } 630 }
749 -  
750 -  
751 } 631 }
  632 + if(upfcsj.size() != 0)
  633 + sxfcsj = upfcsj.get(0) + "-" + upfcsj.get(upfcsj.size() - 1);
  634 + if(downfcsj.size() != 0)
  635 + xxfcsj = downfcsj.get(0) + "-" + downfcsj.get(downfcsj.size() - 1);
  636 + tempMap.put("sxqdz", sxqdz);
  637 + tempMap.put("sxfcsj", i==0?sxfcsj:"");
  638 + tempMap.put("sxbc", sxbc!=0?sxbc:"");
  639 + tempMap.put("xxqdz", xxqdz);
  640 + tempMap.put("xxfcsj", i==0?xxfcsj:"");
  641 + tempMap.put("xxbc", xxbc!=0?xxbc:"");
  642 + tempMap.put("bcType", i);
  643 + if(sxqdz.length()!=0 || xxqdz.length()!=0)
  644 + list.add(tempMap);
752 } 645 }
753 646
754 - if(!qjzMap.isEmpty()){  
755 - list.add(qjzMap);  
756 - }  
757 - if(!qjwMap.isEmpty()){  
758 - list.add(qjwMap);  
759 -  
760 - }  
761 return list; 647 return list;
762 } 648 }
763 @Override 649 @Override
@@ -769,15 +655,14 @@ public class ReportServiceImpl implements ReportService{ @@ -769,15 +655,14 @@ public class ReportServiceImpl implements ReportService{
769 String[] minSjs = minfcsj.split(":"); 655 String[] minSjs = minfcsj.split(":");
770 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]); 656 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
771 //查询时间里程 657 //查询时间里程
772 - String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,2 as xh FROM " 658 + String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM "
773 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " 659 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
774 - + " fcsj <='"+minfcsj+"' and bc_type = 'normal') " 660 + + " fcsj <='"+minfcsj+"' and bc_type!='in' and bc_type!='out' and bc_type!='ldks') "
775 + " union " 661 + " union "
776 - + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,1 as xh FROM " 662 + + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM "
777 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and " 663 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
778 - + " fcsj >'"+minfcsj+"' and bc_type ='normal') " 664 + + " fcsj > '"+minfcsj+"' and bc_type!='in' and bc_type!='out' and bc_type!='ldks') "
779 + " order by xl_dir, xh,fcsj"; 665 + " order by xl_dir, xh,fcsj";
780 -  
781 Map<String, Object> map=new HashMap<String,Object>(); 666 Map<String, Object> map=new HashMap<String,Object>();
782 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc, 667 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
783 new RowMapper<Map<String, Object>>(){ 668 new RowMapper<Map<String, Object>>(){
@@ -790,9 +675,10 @@ public class ReportServiceImpl implements ReportService{ @@ -790,9 +675,10 @@ public class ReportServiceImpl implements ReportService{
790 m.put("bcType", rs.getString("bc_type")); 675 m.put("bcType", rs.getString("bc_type"));
791 m.put("lp", rs.getString("lp")); 676 m.put("lp", rs.getString("lp"));
792 m.put("dir", rs.getString("xl_dir")); 677 m.put("dir", rs.getString("xl_dir"));
  678 + m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):"");
793 return m; 679 return m;
794 } 680 }
795 - }); 681 + });
796 682
797 List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>(); 683 List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>();
798 Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>(); 684 Map<String, List<Map<String, Object>>> keyMap = new HashMap<String, List<Map<String, Object>>>();
@@ -824,8 +710,9 @@ public class ReportServiceImpl implements ReportService{ @@ -824,8 +710,9 @@ public class ReportServiceImpl implements ReportService{
824 Map<String, Object> tempMap = new HashMap<String, Object>(); 710 Map<String, Object> tempMap = new HashMap<String, Object>();
825 List<Map<String, Object>> list2 = keyMap.get(key); 711 List<Map<String, Object>> list2 = keyMap.get(key);
826 List<Integer> cjs = new ArrayList<Integer>(); 712 List<Integer> cjs = new ArrayList<Integer>();
827 - int sxsj = 0, xxsj = 0, zcj = 0; 713 + int sxsj = 0, xxsj = 0, zcj = 0, tssj = 0;
828 int temp = 24*60+1; 714 int temp = 24*60+1;
  715 + boolean ists = false;
829 for(Map<String, Object> m : list2){ 716 for(Map<String, Object> m : list2){
830 String[] split = m.get("fcsj").toString().split(":"); 717 String[] split = m.get("fcsj").toString().split(":");
831 int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); 718 int fcsj = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
@@ -838,9 +725,18 @@ public class ReportServiceImpl implements ReportService{ @@ -838,9 +725,18 @@ public class ReportServiceImpl implements ReportService{
838 } 725 }
839 if(temp >= fcsj){ 726 if(temp >= fcsj){
840 temp = fcsj; 727 temp = fcsj;
  728 + ists = false;
841 } else { 729 } else {
842 - cjs.add(fcsj - temp); 730 + if(ists){
  731 + tssj += fcsj - temp;
  732 + ists = false;
  733 + } else {
  734 + cjs.add(fcsj - temp);
  735 + }
843 temp = fcsj; 736 temp = fcsj;
  737 + if(m.get("ists").equals("1")){
  738 + ists = true;
  739 + }
844 } 740 }
845 } 741 }
846 Collections.sort(cjs); 742 Collections.sort(cjs);
@@ -852,7 +748,8 @@ public class ReportServiceImpl implements ReportService{ @@ -852,7 +748,8 @@ public class ReportServiceImpl implements ReportService{
852 tempMap.put("xxsj", xxsj); 748 tempMap.put("xxsj", xxsj);
853 tempMap.put("fqsj", sxsj + xxsj); 749 tempMap.put("fqsj", sxsj + xxsj);
854 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——"); 750 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
855 - tempMap.put("pjcj", cjs.size()>0?zcj/(cjs.size()-1):"/"); 751 + tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
  752 + tempMap.put("tssj", tssj);
856 maps.put(key, tempMap); 753 maps.put(key, tempMap);
857 } 754 }
858 newList.add(maps.get("(首)——6:30")); 755 newList.add(maps.get("(首)——6:30"));
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 import com.bsth.entity.schedule.TTInfoDetail; 3 import com.bsth.entity.schedule.TTInfoDetail;
  4 +import com.bsth.service.schedule.datatools.TTInfoDetailForEdit;
4 import com.bsth.service.schedule.exception.ScheduleException; 5 import com.bsth.service.schedule.exception.ScheduleException;
5 -import org.apache.commons.lang3.StringUtils;  
6 6
7 -import java.util.ArrayList;  
8 import java.util.List; 7 import java.util.List;
9 import java.util.Map; 8 import java.util.Map;
10 9
@@ -14,157 +13,21 @@ import java.util.Map; @@ -14,157 +13,21 @@ import java.util.Map;
14 public interface TTInfoDetailService extends BService<TTInfoDetail, Long> { 13 public interface TTInfoDetailService extends BService<TTInfoDetail, Long> {
15 14
16 /** 15 /**
17 - * 发车信息内部类。  
18 - */  
19 - public static class FcInfo {  
20 - /** 时刻明细id */  
21 - private Long ttdid;  
22 - /** 发车时间 */  
23 - private String fcsj;  
24 - /** 班次类型 */  
25 - private String bc_type;  
26 - /** 线路上下行 */  
27 - private String xldir;  
28 - /** 是偶分班 */  
29 - private Boolean isfb;  
30 -  
31 - /** 起点站code */  
32 - private String qdzCode;  
33 - /** 终点站code */  
34 - private String zdzCode;  
35 -  
36 - public FcInfo() {  
37 - }  
38 -  
39 - public FcInfo(  
40 - String ttdid_str,  
41 - String bc_type,  
42 - String fcsj,  
43 - String xldir,  
44 - String isfb,  
45 - String qdzCode,  
46 - String zdzCode) {  
47 - this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str);  
48 - this.bc_type = bc_type;  
49 - this.fcsj = fcsj;  
50 - this.xldir = xldir;  
51 - if ("N".equals(isfb))  
52 - this.isfb = false;  
53 - else if ("Y".equals(isfb) || "true".equals(isfb))  
54 - this.isfb = true;  
55 - else  
56 - this.isfb = false;  
57 -  
58 - if (StringUtils.isNotEmpty(qdzCode) && !"null".equals(qdzCode)) {  
59 - this.qdzCode = qdzCode;  
60 - }  
61 - if (StringUtils.isNotEmpty(zdzCode) && !"null".equals(zdzCode)) {  
62 - this.zdzCode = zdzCode;  
63 - }  
64 -  
65 - }  
66 -  
67 - public Long getTtdid() {  
68 - return ttdid;  
69 - }  
70 -  
71 - public void setTtdid(Long ttdid) {  
72 - this.ttdid = ttdid;  
73 - }  
74 -  
75 - public String getFcsj() {  
76 - return fcsj;  
77 - }  
78 -  
79 - public void setFcsj(String fcsj) {  
80 - this.fcsj = fcsj;  
81 - }  
82 -  
83 - public String getBc_type() {  
84 - return bc_type;  
85 - }  
86 -  
87 - public void setBc_type(String bc_type) {  
88 - this.bc_type = bc_type;  
89 - }  
90 -  
91 - public String getXldir() {  
92 - return xldir;  
93 - }  
94 -  
95 - public void setXldir(String xldir) {  
96 - this.xldir = xldir;  
97 - }  
98 -  
99 - public Boolean getIsfb() {  
100 - return isfb;  
101 - }  
102 -  
103 - public void setIsfb(Boolean isfb) {  
104 - this.isfb = isfb;  
105 - }  
106 -  
107 - public String getQdzCode() {  
108 - return qdzCode;  
109 - }  
110 -  
111 - public void setQdzCode(String qdzCode) {  
112 - this.qdzCode = qdzCode;  
113 - }  
114 -  
115 - public String getZdzCode() {  
116 - return zdzCode;  
117 - }  
118 -  
119 - public void setZdzCode(String zdzCode) {  
120 - this.zdzCode = zdzCode;  
121 - }  
122 - }  
123 -  
124 - /**  
125 - * 时刻表编辑用的返回数据。 16 + * 获取待编辑的数据。
  17 + * @param xlid 线路id
  18 + * @param ttid 时刻表id
  19 + * @param maxfcno 最大发车顺序号
  20 + * @return
126 */ 21 */
127 - public static class EditInfo {  
128 - /** 标题数据 */  
129 - private List<String> header = new ArrayList<>();  
130 - /** 内容数据 */  
131 - private List<List<FcInfo>> contents = new ArrayList<>();  
132 -  
133 - /** 营运描述 */  
134 - private String yy_desc;  
135 -  
136 - public List<String> getHeader() {  
137 - return header;  
138 - }  
139 -  
140 - public void setHeader(List<String> header) {  
141 - this.header = header;  
142 - }  
143 -  
144 - public List<List<FcInfo>> getContents() {  
145 - return contents;  
146 - }  
147 -  
148 - public void setContents(List<List<FcInfo>> contents) {  
149 - this.contents = contents;  
150 - }  
151 -  
152 - public String getYy_desc() {  
153 - return yy_desc;  
154 - }  
155 -  
156 - public void setYy_desc(String yy_desc) {  
157 - this.yy_desc = yy_desc;  
158 - }  
159 - } 22 + TTInfoDetailForEdit.EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException;
160 23
161 /** 24 /**
162 - * 获取待编辑的数据。 25 + * 获取时刻表最大发车顺序号
163 * @param xlid 线路id 26 * @param xlid 线路id
164 - * @param ttid 时刻表id 27 + * @param ttinfoid 时刻表id
165 * @return 28 * @return
166 */ 29 */
167 - EditInfo getEditInfo(Integer xlid, Long ttid) throws ScheduleException; 30 + Long findMaxFcno(Integer xlid, Long ttinfoid);
168 31
169 /** 32 /**
170 * 验证sheet(以后放到规则引擎里去做)。 33 * 验证sheet(以后放到规则引擎里去做)。
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
@@ -21,10 +21,7 @@ import org.springframework.stereotype.Service; @@ -21,10 +21,7 @@ import org.springframework.stereotype.Service;
21 import java.io.File; 21 import java.io.File;
22 import java.io.PrintWriter; 22 import java.io.PrintWriter;
23 import java.io.StringWriter; 23 import java.io.StringWriter;
24 -import java.util.ArrayList;  
25 -import java.util.HashMap;  
26 -import java.util.List;  
27 -import java.util.Map; 24 +import java.util.*;
28 25
29 /** 26 /**
30 * Created by xu on 17/5/16. 27 * Created by xu on 17/5/16.
@@ -206,8 +203,10 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -206,8 +203,10 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
206 } 203 }
207 204
208 @Override 205 @Override
209 - public File exportDataForEdit(Integer xlid, Long ttid) throws ScheduleException { 206 + public EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException {
210 try { 207 try {
  208 + LOGGER.info("//---------------- 时刻表编辑用数据输出 start... ----------------//");
  209 +
211 // 创建ktr转换所需参数 210 // 创建ktr转换所需参数
212 Map<String, Object> ktrParms = new HashMap<>(); 211 Map<String, Object> ktrParms = new HashMap<>();
213 File ktrFile = new File(this.getClass().getResource( 212 File ktrFile = new File(this.getClass().getResource(
@@ -225,9 +224,115 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail @@ -225,9 +224,115 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail
225 ktrParms.put("xlid", String.valueOf(xlid)); 224 ktrParms.put("xlid", String.valueOf(xlid));
226 ktrParms.put("ttid", String.valueOf(ttid)); 225 ktrParms.put("ttid", String.valueOf(ttid));
227 226
228 - return dataToolsService.exportData(ktrParms); 227 + dataToolsService.exportData(ktrParms);
  228 +
  229 + EditInfo editInfo = new EditInfo(); // 输出数据
  230 +
  231 +
  232 + // 1.6、获取最大的发车数,用于输出数据的数量
  233 + LOGGER.info("最大发车顺序号={}", maxfcno);
  234 + if (maxfcno != null) {
  235 + // 2、读取ktr生成的excel数据,组织编辑用数据返回
  236 + // 2-1、读取Excel文件
  237 + Workbook book = Workbook.getWorkbook(new File(dataToolsProperties.getTransTempdir() +
  238 + File.separator + outputFilePath + ".xls"));
  239 + Sheet sheet = book.getSheet(0);
  240 +
  241 + // 2-2、处理数据
  242 + int all_bc_ks = 0; // 总空驶班次
  243 + int all_bc_yy = 0; // 总营运班次
  244 + double all_lc_ks = 0; // 总空驶里程
  245 + double all_lc_yy = 0; // 总营运里程
  246 +
  247 + String[] headarrays = new String[maxfcno.intValue() + 3];
  248 + headarrays[0] = "路牌";
  249 + headarrays[maxfcno.intValue() + 1] = "空驶班次/空驶里程";
  250 + headarrays[maxfcno.intValue() + 2] = "运营班次/运营里程";
  251 +
  252 + for (int r = 1; r < sheet.getRows(); r++) {
  253 + List<FcInfo> fcInfos = new ArrayList<>();
  254 + // 每行第一列都是路牌
  255 + fcInfos.add(new FcInfo(null, null, sheet.getCell(0, r).getContents(), null, null, null, null)); // 用fcsj放置路牌显示
  256 +
  257 + int bc_ks = 0; // 空驶班次
  258 + int bc_yy = 0; // 营运班次
  259 + double lc_ks = 0; // 空驶里程
  260 + double lc_yy = 0; // 营运里程
  261 +
  262 + for (int c = 1; c <= maxfcno; c++) {
  263 + String content_str = sheet.getCell(c, r).getContents();
  264 + try {
  265 + String[] content = StringUtils.isEmpty(content_str) ? null : content_str.split(","); // 总的内容
  266 +
  267 + String ttdid_str = content == null ? "" : content[0]; // 时刻表明细id
  268 + String fcsj = content == null ? "" : content[1]; // 发车时间
  269 + String jhlc = content == null ? "" : content[2]; // 计划里程
  270 + String fzdname = content == null ? "" : content[3]; // 发车站点名称
  271 + String bctype = content == null ? "" : content[4]; // 班次类型
  272 + String xldir = content == null ? "" : content[5]; // 线路上下行
  273 + String isfb = content == null ? "" : content[6]; // 是否分班
  274 +
  275 + String qdzCode = content == null ? "" : content[7]; // 起点站编码
  276 + String zdzCode = content == null ? "" : content[8]; // 终点站编码
  277 +
  278 + FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb, qdzCode, zdzCode);
  279 +
  280 + if (StringUtils.isNotEmpty(fzdname))
  281 + headarrays[c] = fzdname;
  282 + fcInfos.add(fcInfo);
  283 +
  284 +
  285 + // 计算班次里程
  286 + if (StringUtils.isNotEmpty(jhlc)) {
  287 + if ("in".equals(bctype) || "out".equals(bctype) || "ldks".equals(bctype)) {
  288 + bc_ks += 1;
  289 + lc_ks += Double.valueOf(jhlc);
  290 +
  291 + all_bc_ks += 1;
  292 + all_lc_ks += Double.valueOf(jhlc);
  293 +
  294 + } else {
  295 + bc_yy += 1;
  296 + lc_yy += Double.valueOf(jhlc);
  297 +
  298 + all_bc_yy += 1;
  299 + all_lc_yy += Double.valueOf(jhlc);
  300 + }
  301 + }
  302 +
  303 + } catch (Exception exp) {
  304 + exp.printStackTrace();
  305 + LOGGER.info("第{}行,第{}列数据有问题,数据={},异常message={}", r, c, content_str, exp.getCause());
  306 + break;
  307 + }
  308 +
  309 + }
  310 +
  311 + // 添加一列 空驶班次/空驶里程,fcsj放置数据
  312 + fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_ks, lc_ks), null, null, null, null));
  313 +
  314 + // 添加一列 营运班次/营运里程,fcsj放置数据
  315 + fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_yy, lc_yy), null, null, null, null));
  316 +
  317 + editInfo.getContents().add(fcInfos);
  318 + }
  319 + editInfo.getHeader().addAll(Arrays.asList(headarrays));
  320 +
  321 + editInfo.setYy_desc(String.format("空驶班次=%d,营运班次=%d,空驶里程=%.3f,营运里程=%.3f,总里程=%.3f", all_bc_ks, all_bc_yy, all_lc_ks, all_lc_yy, all_lc_ks + all_lc_yy));
  322 + }
  323 +
  324 + LOGGER.info("//---------------- 时刻表编辑用数据输出 success... ----------------//");
  325 +
  326 + return editInfo;
229 } catch (Exception exp) { 327 } catch (Exception exp) {
230 - throw new ScheduleException(exp); 328 + LOGGER.info("//---------------- 时刻表编辑用数据输出 failed... ----------------//");
  329 +
  330 + StringWriter sw = new StringWriter();
  331 + exp.printStackTrace(new PrintWriter(sw));
  332 + LOGGER.info(sw.toString());
  333 +
  334 + throw new ScheduleException(exp.getMessage());
231 } 335 }
232 } 336 }
  337 +
233 } 338 }
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailForEdit.java
1 package com.bsth.service.schedule.datatools; 1 package com.bsth.service.schedule.datatools;
2 2
3 import com.bsth.service.schedule.exception.ScheduleException; 3 import com.bsth.service.schedule.exception.ScheduleException;
  4 +import org.apache.commons.lang3.StringUtils;
4 5
5 -import java.io.File; 6 +import java.util.ArrayList;
  7 +import java.util.List;
6 8
7 /** 9 /**
8 * Created by xu on 17/5/16. 10 * Created by xu on 17/5/16.
9 */ 11 */
10 public interface TTInfoDetailForEdit { 12 public interface TTInfoDetailForEdit {
11 - File exportDataForEdit(Integer xlid, Long ttid) throws ScheduleException; 13 + /**
  14 + * 发车信息内部类。
  15 + */
  16 + public static class FcInfo {
  17 + /** 时刻明细id */
  18 + private Long ttdid;
  19 + /** 发车时间 */
  20 + private String fcsj;
  21 + /** 班次类型 */
  22 + private String bc_type;
  23 + /** 线路上下行 */
  24 + private String xldir;
  25 + /** 是偶分班 */
  26 + private Boolean isfb;
  27 +
  28 + /** 起点站code */
  29 + private String qdzCode;
  30 + /** 终点站code */
  31 + private String zdzCode;
  32 +
  33 + public FcInfo() {
  34 + }
  35 +
  36 + public FcInfo(
  37 + String ttdid_str,
  38 + String bc_type,
  39 + String fcsj,
  40 + String xldir,
  41 + String isfb,
  42 + String qdzCode,
  43 + String zdzCode) {
  44 + this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str);
  45 + this.bc_type = bc_type;
  46 + this.fcsj = fcsj;
  47 + this.xldir = xldir;
  48 + if ("N".equals(isfb))
  49 + this.isfb = false;
  50 + else if ("Y".equals(isfb) || "true".equals(isfb))
  51 + this.isfb = true;
  52 + else
  53 + this.isfb = false;
  54 +
  55 + if (StringUtils.isNotEmpty(qdzCode) && !"null".equals(qdzCode)) {
  56 + this.qdzCode = qdzCode;
  57 + }
  58 + if (StringUtils.isNotEmpty(zdzCode) && !"null".equals(zdzCode)) {
  59 + this.zdzCode = zdzCode;
  60 + }
  61 +
  62 + }
  63 +
  64 + public Long getTtdid() {
  65 + return ttdid;
  66 + }
  67 +
  68 + public void setTtdid(Long ttdid) {
  69 + this.ttdid = ttdid;
  70 + }
  71 +
  72 + public String getFcsj() {
  73 + return fcsj;
  74 + }
  75 +
  76 + public void setFcsj(String fcsj) {
  77 + this.fcsj = fcsj;
  78 + }
  79 +
  80 + public String getBc_type() {
  81 + return bc_type;
  82 + }
  83 +
  84 + public void setBc_type(String bc_type) {
  85 + this.bc_type = bc_type;
  86 + }
  87 +
  88 + public String getXldir() {
  89 + return xldir;
  90 + }
  91 +
  92 + public void setXldir(String xldir) {
  93 + this.xldir = xldir;
  94 + }
  95 +
  96 + public Boolean getIsfb() {
  97 + return isfb;
  98 + }
  99 +
  100 + public void setIsfb(Boolean isfb) {
  101 + this.isfb = isfb;
  102 + }
  103 +
  104 + public String getQdzCode() {
  105 + return qdzCode;
  106 + }
  107 +
  108 + public void setQdzCode(String qdzCode) {
  109 + this.qdzCode = qdzCode;
  110 + }
  111 +
  112 + public String getZdzCode() {
  113 + return zdzCode;
  114 + }
  115 +
  116 + public void setZdzCode(String zdzCode) {
  117 + this.zdzCode = zdzCode;
  118 + }
  119 + }
  120 +
  121 + /**
  122 + * 时刻表编辑用的返回数据。
  123 + */
  124 + public static class EditInfo {
  125 + /** 标题数据 */
  126 + private List<String> header = new ArrayList<>();
  127 + /** 内容数据 */
  128 + private List<List<FcInfo>> contents = new ArrayList<>();
  129 +
  130 + /** 营运描述 */
  131 + private String yy_desc;
  132 +
  133 + public List<String> getHeader() {
  134 + return header;
  135 + }
  136 +
  137 + public void setHeader(List<String> header) {
  138 + this.header = header;
  139 + }
  140 +
  141 + public List<List<FcInfo>> getContents() {
  142 + return contents;
  143 + }
  144 +
  145 + public void setContents(List<List<FcInfo>> contents) {
  146 + this.contents = contents;
  147 + }
  148 +
  149 + public String getYy_desc() {
  150 + return yy_desc;
  151 + }
  152 +
  153 + public void setYy_desc(String yy_desc) {
  154 + this.yy_desc = yy_desc;
  155 + }
  156 + }
  157 +
  158 + /**
  159 + * 获取待编辑的数据。
  160 + * @param xlid 线路id
  161 + * @param ttid 时刻表id
  162 + * @param maxfcno 最大发车顺序号
  163 + * @return
  164 + */
  165 + EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException;
  166 +
12 } 167 }
  168 +
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
@@ -69,8 +69,6 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -69,8 +69,6 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
69 @Autowired 69 @Autowired
70 private TTInfoDetailRepository ttInfoDetailRepository; 70 private TTInfoDetailRepository ttInfoDetailRepository;
71 @Autowired 71 @Autowired
72 - private DataToolsProperties dataToolsProperties;  
73 - @Autowired  
74 private LineRepository lineRepository; 72 private LineRepository lineRepository;
75 @Autowired 73 @Autowired
76 private TTInfoRepository infoRepository; 74 private TTInfoRepository infoRepository;
@@ -114,6 +112,11 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -114,6 +112,11 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
114 } 112 }
115 113
116 @Override 114 @Override
  115 + public Long findMaxFcno(Integer xlid, Long ttinfoid) {
  116 + return ttInfoDetailRepository.findMaxFcno(xlid, ttinfoid);
  117 + }
  118 +
  119 + @Override
117 public TTInfoDetail findById(Long aLong) { 120 public TTInfoDetail findById(Long aLong) {
118 return ttInfoDetailRepository.findOneExtend(aLong); 121 return ttInfoDetailRepository.findOneExtend(aLong);
119 } 122 }
@@ -135,128 +138,12 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -135,128 +138,12 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
135 return dataToolsService.exportData(params); 138 return dataToolsService.exportData(params);
136 } 139 }
137 140
138 - @Override  
139 - public TTInfoDetailService.EditInfo getEditInfo(Integer xlid, Long ttid) throws ScheduleException {  
140 - try {  
141 - LOGGER.info("//---------------- 时刻表编辑用数据输出 start... ----------------//");  
142 -  
143 - // 附加参数  
144 - String outputFilePath = String.format("ttinfodetail_(id=%s)_foredit-%s",  
145 - String.valueOf(ttid), new DateTime().toString("yyyyMMddHHmmss"));  
146 -  
147 - ttInfoDetailForEdit.exportDataForEdit(xlid, ttid);  
148 -  
149 - TTInfoDetailService.EditInfo editInfo = new TTInfoDetailService.EditInfo(); // 输出数据  
150 -  
151 - // 1.6、获取最大的发车数,用于输出数据的数量  
152 - Long maxfcno = ttInfoDetailRepository.findMaxFcno(xlid, ttid);  
153 - LOGGER.info("最大发车顺序号={}", maxfcno);  
154 - if (maxfcno != null) {  
155 - // 2、读取ktr生成的excel数据,组织编辑用数据返回  
156 - // 2-1、读取Excel文件  
157 - Workbook book = Workbook.getWorkbook(new File(dataToolsProperties.getTransTempdir() +  
158 - File.separator + outputFilePath + ".xls"));  
159 - Sheet sheet = book.getSheet(0);  
160 -  
161 - // 2-2、处理数据  
162 - int all_bc_ks = 0; // 总空驶班次  
163 - int all_bc_yy = 0; // 总营运班次  
164 - double all_lc_ks = 0; // 总空驶里程  
165 - double all_lc_yy = 0; // 总营运里程  
166 -  
167 - String[] headarrays = new String[maxfcno.intValue() + 3];  
168 - headarrays[0] = "路牌";  
169 - headarrays[maxfcno.intValue() + 1] = "空驶班次/空驶里程";  
170 - headarrays[maxfcno.intValue() + 2] = "运营班次/运营里程";  
171 -  
172 - for (int r = 1; r < sheet.getRows(); r++) {  
173 - List<TTInfoDetailService.FcInfo> fcInfos = new ArrayList<>();  
174 - // 每行第一列都是路牌  
175 - fcInfos.add(new TTInfoDetailService.FcInfo(null, null, sheet.getCell(0, r).getContents(), null, null, null, null)); // 用fcsj放置路牌显示  
176 -  
177 - int bc_ks = 0; // 空驶班次  
178 - int bc_yy = 0; // 营运班次  
179 - double lc_ks = 0; // 空驶里程  
180 - double lc_yy = 0; // 营运里程  
181 -  
182 - for (int c = 1; c <= maxfcno; c++) {  
183 - String content_str = sheet.getCell(c, r).getContents();  
184 - try {  
185 - String[] content = StringUtils.isEmpty(content_str) ? null : content_str.split(","); // 总的内容  
186 -  
187 - String ttdid_str = content == null ? "" : content[0]; // 时刻表明细id  
188 - String fcsj = content == null ? "" : content[1]; // 发车时间  
189 - String jhlc = content == null ? "" : content[2]; // 计划里程  
190 - String fzdname = content == null ? "" : content[3]; // 发车站点名称  
191 - String bctype = content == null ? "" : content[4]; // 班次类型  
192 - String xldir = content == null ? "" : content[5]; // 线路上下行  
193 - String isfb = content == null ? "" : content[6]; // 是否分班  
194 -  
195 - String qdzCode = content == null ? "" : content[7]; // 起点站编码  
196 - String zdzCode = content == null ? "" : content[8]; // 终点站编码  
197 -  
198 - TTInfoDetailService.FcInfo fcInfo = new TTInfoDetailService.FcInfo(ttdid_str, bctype, fcsj, xldir, isfb, qdzCode, zdzCode);  
199 -  
200 - if (StringUtils.isNotEmpty(fzdname))  
201 - headarrays[c] = fzdname;  
202 - fcInfos.add(fcInfo);  
203 -  
204 -  
205 - // 计算班次里程  
206 - if (StringUtils.isNotEmpty(jhlc)) {  
207 - if ("in".equals(bctype) || "out".equals(bctype) || "ldks".equals(bctype)) {  
208 - bc_ks += 1;  
209 - lc_ks += Double.valueOf(jhlc);  
210 -  
211 - all_bc_ks += 1;  
212 - all_lc_ks += Double.valueOf(jhlc);  
213 -  
214 - } else {  
215 - bc_yy += 1;  
216 - lc_yy += Double.valueOf(jhlc);  
217 -  
218 - all_bc_yy += 1;  
219 - all_lc_yy += Double.valueOf(jhlc);  
220 - }  
221 - }  
222 -  
223 - } catch (Exception exp) {  
224 - exp.printStackTrace();  
225 - LOGGER.info("第{}行,第{}列数据有问题,数据={},异常message={}", r, c, content_str, exp.getCause());  
226 - break;  
227 - }  
228 -  
229 - }  
230 -  
231 - // 添加一列 空驶班次/空驶里程,fcsj放置数据  
232 - fcInfos.add(new TTInfoDetailService.FcInfo(null, null, String.format("%d/%.3f", bc_ks, lc_ks), null, null, null, null));  
233 -  
234 - // 添加一列 营运班次/营运里程,fcsj放置数据  
235 - fcInfos.add(new TTInfoDetailService.FcInfo(null, null, String.format("%d/%.3f", bc_yy, lc_yy), null, null, null, null));  
236 141
237 - editInfo.getContents().add(fcInfos);  
238 - }  
239 - editInfo.getHeader().addAll(Arrays.asList(headarrays));  
240 -  
241 - editInfo.setYy_desc(String.format("空驶班次=%d,营运班次=%d,空驶里程=%.3f,营运里程=%.3f,总里程=%.3f", all_bc_ks, all_bc_yy, all_lc_ks, all_lc_yy, all_lc_ks + all_lc_yy));  
242 - }  
243 -  
244 - LOGGER.info("//---------------- 时刻表编辑用数据输出 success... ----------------//");  
245 -  
246 - return editInfo;  
247 - } catch (Exception exp) {  
248 - LOGGER.info("//---------------- 时刻表编辑用数据输出 failed... ----------------//");  
249 -  
250 - StringWriter sw = new StringWriter();  
251 - exp.printStackTrace(new PrintWriter(sw));  
252 - LOGGER.info(sw.toString());  
253 -  
254 - throw new ScheduleException(exp.getMessage());  
255 - } 142 + @Override
  143 + public TTInfoDetailForEdit.EditInfo getEditInfo(Integer xlid, Long ttid, Long maxfcno) throws ScheduleException {
  144 + return ttInfoDetailForEdit.getEditInfo(xlid, ttid, maxfcno);
256 } 145 }
257 146
258 -  
259 -  
260 @Override 147 @Override
261 public void validateExcelSheet(String filename, String sheetname, Integer lineid, String linename) throws ScheduleException { 148 public void validateExcelSheet(String filename, String sheetname, Integer lineid, String linename) throws ScheduleException {
262 try { 149 try {
src/main/java/com/bsth/service/schedule/utils/DataToolsServiceImpl.java
@@ -125,7 +125,7 @@ public class DataToolsServiceImpl implements DataToolsService { @@ -125,7 +125,7 @@ public class DataToolsServiceImpl implements DataToolsService {
125 exp.printStackTrace(new PrintWriter(sw)); 125 exp.printStackTrace(new PrintWriter(sw));
126 LOGGER.info(sw.toString()); 126 LOGGER.info(sw.toString());
127 127
128 - throw new ScheduleException("上传文件错误!"); 128 + throw new ScheduleException(exp);
129 } 129 }
130 } 130 }
131 131
@@ -184,7 +184,7 @@ public class DataToolsServiceImpl implements DataToolsService { @@ -184,7 +184,7 @@ public class DataToolsServiceImpl implements DataToolsService {
184 exp.printStackTrace(new PrintWriter(sw)); 184 exp.printStackTrace(new PrintWriter(sw));
185 LOGGER.info(sw.toString()); 185 LOGGER.info(sw.toString());
186 186
187 - throw new ScheduleException("导入数据错误!"); 187 + throw new ScheduleException(exp);
188 } finally { 188 } finally {
189 // 清除日志操作 189 // 清除日志操作
190 KettleLogStore.discardLines(transLogId, true); 190 KettleLogStore.discardLines(transLogId, true);
@@ -259,7 +259,7 @@ public class DataToolsServiceImpl implements DataToolsService { @@ -259,7 +259,7 @@ public class DataToolsServiceImpl implements DataToolsService {
259 exp.printStackTrace(new PrintWriter(sw)); 259 exp.printStackTrace(new PrintWriter(sw));
260 LOGGER.info(sw.toString()); 260 LOGGER.info(sw.toString());
261 261
262 - throw new ScheduleException("导出数据错误!"); 262 + throw new ScheduleException(exp);
263 } finally { 263 } finally {
264 // 清除日志操作 264 // 清除日志操作
265 KettleLogStore.discardLines(transLogId, true); 265 KettleLogStore.discardLines(transLogId, true);
src/main/resources/application-dev.properties
@@ -6,7 +6,7 @@ spring.jpa.hibernate.ddl-auto= update @@ -6,7 +6,7 @@ spring.jpa.hibernate.ddl-auto= update
6 spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy 6 spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
7 #DATABASE 7 #DATABASE
8 spring.jpa.database= MYSQL 8 spring.jpa.database= MYSQL
9 -spring.jpa.show-sql= true 9 +spring.jpa.show-sql= false
10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver 10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false 11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
12 spring.datasource.username= root 12 spring.datasource.username= root
src/main/resources/static/pages/report/timetable/timetable.html
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 </div> 45 </div>
46 <div class="form-group"> 46 <div class="form-group">
47 <input class="btn btn-default" type="button" id="query" value="查询"/> 47 <input class="btn btn-default" type="button" id="query" value="查询"/>
48 - <input class="btn btn-default" type="button" id="export" value="导出"/> 48 +<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> -->
49 </div> 49 </div>
50 </form> 50 </form>
51 </div> 51 </div>
@@ -165,18 +165,19 @@ @@ -165,18 +165,19 @@
165 <div class="col-md-6" > 165 <div class="col-md-6" >
166 <table class="table table-bordered table-checkable" id="formsTime5"> 166 <table class="table table-bordered table-checkable" id="formsTime5">
167 <tr> 167 <tr>
168 - <td colspan="6">全日分组行驶时间(区间除外)</td> 168 + <td colspan="7">全日分组行驶时间(区间除外)</td>
169 </tr> 169 </tr>
170 <tr> 170 <tr>
171 <td width="20%" rowspan="2" style="text-align:center;vertical-align:middle;">分组 时间</td> 171 <td width="20%" rowspan="2" style="text-align:center;vertical-align:middle;">分组 时间</td>
172 - <td width="25%" colspan="2" style="text-align:center;vertical-align:middle;">计划行驶(分)</td>  
173 - <td width="20%" rowspan="2" style="text-align:center;vertical-align:middle;">分圈 时间</td>  
174 - <td width="20%" rowspan="2" style="text-align:center;vertical-align:middle;">车距区间</td>  
175 - <td width="15%" rowspan="2" style="text-align:center;vertical-align:middle;">平均车距</td> 172 + <td width="23%" colspan="2" style="text-align:center;vertical-align:middle;">计划行驶(分)</td>
  173 + <td width="15%" rowspan="2" style="text-align:center;vertical-align:middle;">分圈时间</td>
  174 + <td width="15%" rowspan="2" style="text-align:center;vertical-align:middle;">停驶时间</td>
  175 + <td width="15%" rowspan="2" style="text-align:center;vertical-align:middle;">车距区间</td>
  176 + <td width="12%" rowspan="2" style="text-align:center;vertical-align:middle;">平均车距</td>
176 </tr> 177 </tr>
177 <tr> 178 <tr>
178 <td>上行</td> 179 <td>上行</td>
179 - <td>下行</td> 180 + <td style="text-align:center;">下行</td>
180 </tr> 181 </tr>
181 <tbody class="tbody_time_5"> 182 <tbody class="tbody_time_5">
182 183
@@ -313,8 +314,8 @@ @@ -313,8 +314,8 @@
313 }); 314 });
314 315
315 $.get('/report/tbodyTime4',{line:line,ttinfo:ttinfo},function(result){ 316 $.get('/report/tbodyTime4',{line:line,ttinfo:ttinfo},function(result){
316 - $("#skb_sxzd").html(result[0].sxzm);  
317 - $("#skb_xxzd").html(result[0].xxzm); 317 + $("#skb_sxzd").html(result[0].sxqdz);
  318 + $("#skb_xxzd").html(result[0].xxqdz);
318 var tbodyTime4 = template('tbodyTime4',{list:result}); 319 var tbodyTime4 = template('tbodyTime4',{list:result});
319 $('#formsTime4 .tbody_time_4').html(tbodyTime4); 320 $('#formsTime4 .tbody_time_4').html(tbodyTime4);
320 }); 321 });
@@ -377,11 +378,11 @@ @@ -377,11 +378,11 @@
377 {{each list as result i}} 378 {{each list as result i}}
378 379
379 <tr> 380 <tr>
380 - <td align="center">{{result.sxzm}}</td>  
381 - <td align="center">{{result.sxsj}}</td> 381 + <td align="center">{{result.sxqdz}}</td>
  382 + <td align="center">{{result.sxfcsj}}</td>
382 <td align="center">{{result.sxbc}}</td> 383 <td align="center">{{result.sxbc}}</td>
383 - <td align="center">{{result.xxzm}}</td>  
384 - <td align="center">{{result.xxsj}}</td> 384 + <td align="center">{{result.xxqdz}}</td>
  385 + <td align="center">{{result.xxfcsj}}</td>
385 <td align="center">{{result.xxbc}}</td> 386 <td align="center">{{result.xxbc}}</td>
386 </tr> 387 </tr>
387 {{/each}} 388 {{/each}}
@@ -399,13 +400,14 @@ @@ -399,13 +400,14 @@
399 <td align="center">{{result.sxsj}}</td> 400 <td align="center">{{result.sxsj}}</td>
400 <td align="center">{{result.xxsj}}</td> 401 <td align="center">{{result.xxsj}}</td>
401 <td align="center">{{result.fqsj}}</td> 402 <td align="center">{{result.fqsj}}</td>
  403 + <td align="center">{{result.tssj}}</td>
402 <td align="center">{{result.cjqj}}</td> 404 <td align="center">{{result.cjqj}}</td>
403 <td align="center">{{result.pjcj}}</td> 405 <td align="center">{{result.pjcj}}</td>
404 </tr> 406 </tr>
405 {{/each}} 407 {{/each}}
406 {{if list.length == 0}} 408 {{if list.length == 0}}
407 <tr> 409 <tr>
408 - <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td> 410 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
409 </tr> 411 </tr>
410 {{/if}} 412 {{/if}}
411 </script> 413 </script>
src/main/resources/static/real_control_v2/assets/plugins/layer3.0.3/layer.js
1 -/**  
2 -  
3 - @Name:layer v3.0.3 Web弹层组件  
4 - @Author:贤心  
5 - @Site:http://layer.layui.com  
6 - @License:MIT  
7 -  
8 - */  
9 -  
10 -;!function(window, undefined){  
11 -"use strict";  
12 -  
13 -var isLayui = window.layui && layui.define, $, win, ready = {  
14 - getPath: function(){  
15 - var js = document.scripts, script = js[js.length - 1], jsPath = script.src;  
16 - if(script.getAttribute('merge')) return;  
17 - return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);  
18 - }(),  
19 -  
20 - config: {}, end: {}, minIndex: 0, minLeft: [],  
21 - btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],  
22 -  
23 - //五种原始层模式  
24 - type: ['dialog', 'page', 'iframe', 'loading', 'tips']  
25 -};  
26 -  
27 -//默认内置方法。  
28 -var layer = {  
29 - v: '3.0.3',  
30 - ie: function(){ //ie版本  
31 - var agent = navigator.userAgent.toLowerCase();  
32 - return (!!window.ActiveXObject || "ActiveXObject" in window) ? (  
33 - (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识  
34 - ) : false;  
35 - }(),  
36 - index: (window.layer && window.layer.v) ? 100000 : 0,  
37 - path: ready.getPath,  
38 - config: function(options, fn){  
39 - options = options || {};  
40 - layer.cache = ready.config = $.extend({}, ready.config, options);  
41 - layer.path = ready.config.path || layer.path;  
42 - typeof options.extend === 'string' && (options.extend = [options.extend]);  
43 -  
44 - if(ready.config.path) layer.ready();  
45 -  
46 - if(!options.extend) return this;  
47 -  
48 - isLayui  
49 - ? layui.addcss('modules/layer/' + options.extend)  
50 - : layer.link('skin/' + options.extend);  
51 -  
52 - return this;  
53 - },  
54 -  
55 - //载入CSS配件  
56 - link: function(href, fn, cssname){  
57 -  
58 - //未设置路径,则不主动加载css  
59 - if(!layer.path) return;  
60 -  
61 - var head = $('head')[0], link = document.createElement('link');  
62 - if(typeof fn === 'string') cssname = fn;  
63 - var app = (cssname || href).replace(/\.|\//g, '');  
64 - var id = 'layuicss-'+app, timeout = 0;  
65 -  
66 - link.rel = 'stylesheet';  
67 - link.href = layer.path + href;  
68 - link.id = id;  
69 -  
70 - if(!$('#'+ id)[0]){  
71 - head.appendChild(link);  
72 - }  
73 -  
74 - if(typeof fn !== 'function') return;  
75 -  
76 - //轮询css是否加载完毕  
77 -/* (function poll() {  
78 - if(++timeout > 8 * 1000 / 100){  
79 - return window.console && console.error('layer.css: Invalid');  
80 - };  
81 - parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);  
82 - }());*/  
83 - },  
84 -  
85 - ready: function(callback){  
86 - /*var cssname = 'skinlayercss', ver = '303';  
87 - isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)  
88 - : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);*/  
89 - return this;  
90 - },  
91 -  
92 - //各种快捷引用  
93 - alert: function(content, options, yes){  
94 - var type = typeof options === 'function';  
95 - if(type) yes = options;  
96 - return layer.open($.extend({  
97 - content: content,  
98 - yes: yes  
99 - }, type ? {} : options));  
100 - },  
101 -  
102 - confirm: function(content, options, yes, cancel){  
103 - var type = typeof options === 'function';  
104 - if(type){  
105 - cancel = yes;  
106 - yes = options;  
107 - }  
108 - return layer.open($.extend({  
109 - content: content,  
110 - btn: ready.btn,  
111 - yes: yes,  
112 - btn2: cancel  
113 - }, type ? {} : options));  
114 - },  
115 -  
116 - msg: function(content, options, end){ //最常用提示层  
117 - var type = typeof options === 'function', rskin = ready.config.skin;  
118 - var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';  
119 - var anim = doms.anim.length - 1;  
120 - if(type) end = options;  
121 - return layer.open($.extend({  
122 - content: content,  
123 - time: 3000,  
124 - shade: false,  
125 - skin: skin,  
126 - title: false,  
127 - closeBtn: false,  
128 - btn: false,  
129 - resize: false,  
130 - end: end  
131 - }, (type && !ready.config.skin) ? {  
132 - skin: skin + ' layui-layer-hui',  
133 - anim: anim  
134 - } : function(){  
135 - options = options || {};  
136 - if(options.icon === -1 || options.icon === undefined && !ready.config.skin){  
137 - options.skin = skin + ' ' + (options.skin||'layui-layer-hui');  
138 - }  
139 - return options;  
140 - }()));  
141 - },  
142 -  
143 - load: function(icon, options){  
144 - return layer.open($.extend({  
145 - type: 3,  
146 - icon: icon || 0,  
147 - resize: false,  
148 - shade: 0.01  
149 - }, options));  
150 - },  
151 -  
152 - tips: function(content, follow, options){  
153 - return layer.open($.extend({  
154 - type: 4,  
155 - content: [content, follow],  
156 - closeBtn: false,  
157 - time: 3000,  
158 - shade: false,  
159 - resize: false,  
160 - fixed: false,  
161 - maxWidth: 210  
162 - }, options));  
163 - }  
164 -};  
165 -  
166 -var Class = function(setings){  
167 - var that = this;  
168 - that.index = ++layer.index;  
169 - that.config = $.extend({}, that.config, ready.config, setings);  
170 - document.body ? that.creat() : setTimeout(function(){  
171 - that.creat();  
172 - }, 30);  
173 -};  
174 -  
175 -Class.pt = Class.prototype;  
176 -  
177 -//缓存常用字符  
178 -var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];  
179 -doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];  
180 -  
181 -//默认配置  
182 -Class.pt.config = {  
183 - type: 0,  
184 - shade: 0.3,  
185 - fixed: true,  
186 - move: doms[1],  
187 - title: '&#x4FE1;&#x606F;',  
188 - offset: 'auto',  
189 - area: 'auto',  
190 - closeBtn: 1,  
191 - time: 0, //0表示不自动关闭  
192 - zIndex: 19891014,  
193 - maxWidth: 360,  
194 - anim: 0,  
195 - isOutAnim: true,  
196 - icon: -1,  
197 - moveType: 1,  
198 - resize: true,  
199 - scrollbar: true, //是否允许浏览器滚动条  
200 - tips: 2  
201 -};  
202 -  
203 -//容器  
204 -Class.pt.vessel = function(conType, callback){  
205 - var that = this, times = that.index, config = that.config;  
206 - var zIndex = config.zIndex + times, titype = typeof config.title === 'object';  
207 - var ismax = config.maxmin && (config.type === 1 || config.type === 2);  
208 - var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'  
209 - + (titype ? config.title[0] : config.title)  
210 - + '</div>' : '');  
211 -  
212 - config.zIndex = zIndex;  
213 - callback([  
214 - //遮罩  
215 - config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',  
216 -  
217 - //主体  
218 - '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'  
219 - + (conType && config.type != 2 ? '' : titleHTML)  
220 - + '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'  
221 - + (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')  
222 - + (config.type == 1 && conType ? '' : (config.content||''))  
223 - + '</div>'  
224 - + '<span class="layui-layer-setwin">'+ function(){  
225 - var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';  
226 - config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');  
227 - return closebtn;  
228 - }() + '</span>'  
229 - + (config.btn ? function(){  
230 - var button = '';  
231 - typeof config.btn === 'string' && (config.btn = [config.btn]);  
232 - for(var i = 0, len = config.btn.length; i < len; i++){  
233 - button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'  
234 - }  
235 - return '<div class="'+ doms[6] + (config.btnAlign ? (' layui-layer-btn-' + config.btnAlign) : '') +'">'+ button +'</div>'  
236 - }() : '')  
237 - + (config.resize ? '<span class="layui-layer-resize"></span>' : '')  
238 - + '</div>'  
239 - ], titleHTML, $('<div class="layui-layer-move"></div>'));  
240 - return that;  
241 -};  
242 -  
243 -//创建骨架  
244 -Class.pt.creat = function(){  
245 - var that = this  
246 - ,config = that.config  
247 - ,times = that.index, nodeIndex  
248 - ,content = config.content  
249 - ,conType = typeof content === 'object'  
250 - ,body = $('body');  
251 -  
252 - if(config.id && $('#'+config.id)[0]) return;  
253 -  
254 - if(typeof config.area === 'string'){  
255 - config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];  
256 - }  
257 -  
258 - //anim兼容旧版shift  
259 - if(config.shift){  
260 - config.anim = config.shift;  
261 - }  
262 -  
263 - if(layer.ie == 6){  
264 - config.fixed = false;  
265 - }  
266 -  
267 - switch(config.type){  
268 - case 0:  
269 - config.btn = ('btn' in config) ? config.btn : ready.btn[0];  
270 - layer.closeAll('dialog');  
271 - break;  
272 - case 2:  
273 - var content = config.content = conType ? config.content : [config.content, 'auto'];  
274 - config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';  
275 - break;  
276 - case 3:  
277 - delete config.title;  
278 - delete config.closeBtn;  
279 - config.icon === -1 && (config.icon === 0);  
280 - layer.closeAll('loading');  
281 - break;  
282 - case 4:  
283 - conType || (config.content = [config.content, 'body']);  
284 - config.follow = config.content[1];  
285 - config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';  
286 - delete config.title;  
287 - config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];  
288 - config.tipsMore || layer.closeAll('tips');  
289 - break;  
290 - }  
291 -  
292 - //建立容器  
293 - that.vessel(conType, function(html, titleHTML, moveElem){  
294 - body.append(html[0]);  
295 - conType ? function(){  
296 - (config.type == 2 || config.type == 4) ? function(){  
297 - $('body').append(html[1]);  
298 - }() : function(){  
299 - if(!content.parents('.'+doms[0])[0]){  
300 - content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);  
301 - $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);  
302 - }  
303 - }();  
304 - }() : body.append(html[1]);  
305 - $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);  
306 - that.layero = $('#'+ doms[0] + times);  
307 - config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);  
308 - }).auto(times);  
309 -  
310 - config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);  
311 -  
312 - //坐标自适应浏览器窗口尺寸  
313 - config.type == 4 ? that.tips() : that.offset();  
314 - if(config.fixed){  
315 - win.on('resize', function(){  
316 - that.offset();  
317 - (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);  
318 - config.type == 4 && that.tips();  
319 - });  
320 - }  
321 -  
322 - config.time <= 0 || setTimeout(function(){  
323 - layer.close(that.index)  
324 - }, config.time);  
325 - that.move().callback();  
326 -  
327 - //为兼容jQuery3.0的css动画影响元素尺寸计算  
328 - if(doms.anim[config.anim]){  
329 - that.layero.addClass(doms.anim[config.anim]);  
330 - };  
331 -  
332 - //记录关闭动画  
333 - if(config.isOutAnim){  
334 - that.layero.data('isOutAnim', true);  
335 - }  
336 -};  
337 -  
338 -//自适应  
339 -Class.pt.auto = function(index){  
340 - var that = this, config = that.config, layero = $('#'+ doms[0] + index);  
341 - if(config.area[0] === '' && config.maxWidth > 0){  
342 - //为了修复IE7下一个让人难以理解的bug  
343 - if(layer.ie && layer.ie < 8 && config.btn){  
344 - layero.width(layero.innerWidth());  
345 - }  
346 - layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);  
347 - }  
348 - var area = [layero.innerWidth(), layero.innerHeight()];  
349 - var titHeight = layero.find(doms[1]).outerHeight() || 0;  
350 - var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;  
351 - function setHeight(elem){  
352 - elem = layero.find(elem);  
353 - elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));  
354 - }  
355 - switch(config.type){  
356 - case 2:  
357 - setHeight('iframe');  
358 - break;  
359 - default:  
360 - if(config.area[1] === ''){  
361 - if(config.fixed && area[1] >= win.height()){  
362 - area[1] = win.height();  
363 - setHeight('.'+doms[5]);  
364 - }  
365 - } else {  
366 - setHeight('.'+doms[5]);  
367 - }  
368 - break;  
369 - }  
370 - return that;  
371 -};  
372 -  
373 -//计算坐标  
374 -Class.pt.offset = function(){  
375 - var that = this, config = that.config, layero = that.layero;  
376 - var area = [layero.outerWidth(), layero.outerHeight()];  
377 - var type = typeof config.offset === 'object';  
378 - that.offsetTop = (win.height() - area[1])/2;  
379 - that.offsetLeft = (win.width() - area[0])/2;  
380 -  
381 - if(type){  
382 - that.offsetTop = config.offset[0];  
383 - that.offsetLeft = config.offset[1]||that.offsetLeft;  
384 - } else if(config.offset !== 'auto'){  
385 -  
386 - if(config.offset === 't'){ //上  
387 - that.offsetTop = 0;  
388 - } else if(config.offset === 'r'){ //右  
389 - that.offsetLeft = win.width() - area[0];  
390 - } else if(config.offset === 'b'){ //下  
391 - that.offsetTop = win.height() - area[1];  
392 - } else if(config.offset === 'l'){ //左  
393 - that.offsetLeft = 0;  
394 - } else if(config.offset === 'lt'){ //左上角  
395 - that.offsetTop = 0;  
396 - that.offsetLeft = 0;  
397 - } else if(config.offset === 'lb'){ //左下角  
398 - that.offsetTop = win.height() - area[1];  
399 - that.offsetLeft = 0;  
400 - } else if(config.offset === 'rt'){ //右上角  
401 - that.offsetTop = 0;  
402 - that.offsetLeft = win.width() - area[0];  
403 - } else if(config.offset === 'rb'){ //右下角  
404 - that.offsetTop = win.height() - area[1];  
405 - that.offsetLeft = win.width() - area[0];  
406 - } else {  
407 - that.offsetTop = config.offset;  
408 - }  
409 -  
410 - }  
411 -  
412 - if(!config.fixed){  
413 - that.offsetTop = /%$/.test(that.offsetTop) ?  
414 - win.height()*parseFloat(that.offsetTop)/100  
415 - : parseFloat(that.offsetTop);  
416 - that.offsetLeft = /%$/.test(that.offsetLeft) ?  
417 - win.width()*parseFloat(that.offsetLeft)/100  
418 - : parseFloat(that.offsetLeft);  
419 - that.offsetTop += win.scrollTop();  
420 - that.offsetLeft += win.scrollLeft();  
421 - }  
422 -  
423 - if(layero.attr('minLeft')){  
424 - that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);  
425 - that.offsetLeft = layero.css('left');  
426 - }  
427 -  
428 - layero.css({top: that.offsetTop, left: that.offsetLeft});  
429 -};  
430 -  
431 -//Tips  
432 -Class.pt.tips = function(){  
433 - var that = this, config = that.config, layero = that.layero;  
434 - var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);  
435 - if(!follow[0]) follow = $('body');  
436 - var goal = {  
437 - width: follow.outerWidth(),  
438 - height: follow.outerHeight(),  
439 - top: follow.offset().top,  
440 - left: follow.offset().left  
441 - }, tipsG = layero.find('.layui-layer-TipsG');  
442 -  
443 - var guide = config.tips[0];  
444 - config.tips[1] || tipsG.remove();  
445 -  
446 - goal.autoLeft = function(){  
447 - if(goal.left + layArea[0] - win.width() > 0){  
448 - goal.tipLeft = goal.left + goal.width - layArea[0];  
449 - tipsG.css({right: 12, left: 'auto'});  
450 - } else {  
451 - goal.tipLeft = goal.left;  
452 - };  
453 - };  
454 -  
455 - //辨别tips的方位  
456 - goal.where = [function(){ //上  
457 - goal.autoLeft();  
458 - goal.tipTop = goal.top - layArea[1] - 10;  
459 - tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);  
460 - }, function(){ //右  
461 - goal.tipLeft = goal.left + goal.width + 10;  
462 - goal.tipTop = goal.top;  
463 - tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);  
464 - }, function(){ //下  
465 - goal.autoLeft();  
466 - goal.tipTop = goal.top + goal.height + 10;  
467 - tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);  
468 - }, function(){ //左  
469 - goal.tipLeft = goal.left - layArea[0] - 10;  
470 - goal.tipTop = goal.top;  
471 - tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);  
472 - }];  
473 - goal.where[guide-1]();  
474 -  
475 - /* 8*2为小三角形占据的空间 */  
476 - if(guide === 1){  
477 - goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();  
478 - } else if(guide === 2){  
479 - win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()  
480 - } else if(guide === 3){  
481 - (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();  
482 - } else if(guide === 4){  
483 - layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()  
484 - }  
485 -  
486 - layero.find('.'+doms[5]).css({  
487 - 'background-color': config.tips[1],  
488 - 'padding-right': (config.closeBtn ? '30px' : '')  
489 - });  
490 - layero.css({  
491 - left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),  
492 - top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)  
493 - });  
494 -}  
495 -  
496 -//拖拽层  
497 -Class.pt.move = function(){  
498 - var that = this  
499 - ,config = that.config  
500 - ,_DOC = $(document)  
501 - ,layero = that.layero  
502 - ,moveElem = layero.find(config.move)  
503 - ,resizeElem = layero.find('.layui-layer-resize')  
504 - ,dict = {};  
505 -  
506 - if(config.move){  
507 - moveElem.css('cursor', 'move');  
508 - }  
509 -  
510 - moveElem.on('mousedown', function(e){  
511 - e.preventDefault();  
512 - if(config.move){  
513 - dict.moveStart = true;  
514 - dict.offset = [  
515 - e.clientX - parseFloat(layero.css('left'))  
516 - ,e.clientY - parseFloat(layero.css('top'))  
517 - ];  
518 - ready.moveElem.css('cursor', 'move').show();  
519 - }  
520 - });  
521 -  
522 - resizeElem.on('mousedown', function(e){  
523 - e.preventDefault();  
524 - dict.resizeStart = true;  
525 - dict.offset = [e.clientX, e.clientY];  
526 - dict.area = [  
527 - layero.outerWidth()  
528 - ,layero.outerHeight()  
529 - ];  
530 - ready.moveElem.css('cursor', 'se-resize').show();  
531 - });  
532 -  
533 - _DOC.on('mousemove', function(e){  
534 -  
535 - //拖拽移动  
536 - if(dict.moveStart){  
537 - var X = e.clientX - dict.offset[0]  
538 - ,Y = e.clientY - dict.offset[1]  
539 - ,fixed = layero.css('position') === 'fixed';  
540 -  
541 - e.preventDefault();  
542 -  
543 - dict.stX = fixed ? 0 : win.scrollLeft();  
544 - dict.stY = fixed ? 0 : win.scrollTop();  
545 -  
546 - //控制元素不被拖出窗口外  
547 - if(!config.moveOut){  
548 - var setRig = win.width() - layero.outerWidth() + dict.stX  
549 - ,setBot = win.height() - layero.outerHeight() + dict.stY;  
550 - X < dict.stX && (X = dict.stX);  
551 - X > setRig && (X = setRig);  
552 - Y < dict.stY && (Y = dict.stY);  
553 - Y > setBot && (Y = setBot);  
554 - }  
555 -  
556 - layero.css({  
557 - left: X  
558 - ,top: Y  
559 - });  
560 - }  
561 -  
562 - //Resize  
563 - if(config.resize && dict.resizeStart){  
564 - var X = e.clientX - dict.offset[0]  
565 - ,Y = e.clientY - dict.offset[1];  
566 -  
567 - e.preventDefault();  
568 -  
569 - layer.style(that.index, {  
570 - width: dict.area[0] + X  
571 - ,height: dict.area[1] + Y  
572 - })  
573 - dict.isResize = true;  
574 - config.resizing && config.resizing(layero);  
575 - }  
576 - }).on('mouseup', function(e){  
577 - if(dict.moveStart){  
578 - delete dict.moveStart;  
579 - ready.moveElem.hide();  
580 - config.moveEnd && config.moveEnd(layero);  
581 - }  
582 - if(dict.resizeStart){  
583 - delete dict.resizeStart;  
584 - ready.moveElem.hide();  
585 - }  
586 - });  
587 -  
588 - return that;  
589 -};  
590 -  
591 -Class.pt.callback = function(){  
592 - var that = this, layero = that.layero, config = that.config;  
593 - that.openLayer();  
594 - if(config.success){  
595 - if(config.type == 2){  
596 - layero.find('iframe').on('load', function(){  
597 - config.success(layero, that.index);  
598 - });  
599 - } else {  
600 - config.success(layero, that.index);  
601 - }  
602 - }  
603 - layer.ie == 6 && that.IE6(layero);  
604 -  
605 - //按钮  
606 - layero.find('.'+ doms[6]).children('a').on('click', function(){  
607 - var index = $(this).index();  
608 - if(index === 0){  
609 - if(config.yes){  
610 - config.yes(that.index, layero)  
611 - } else if(config['btn1']){  
612 - config['btn1'](that.index, layero)  
613 - } else {  
614 - layer.close(that.index);  
615 - }  
616 - } else {  
617 - var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);  
618 - close === false || layer.close(that.index);  
619 - }  
620 - });  
621 -  
622 - //取消  
623 - function cancel(){  
624 - var close = config.cancel && config.cancel(that.index, layero);  
625 - close === false || layer.close(that.index);  
626 - }  
627 -  
628 - //右上角关闭回调  
629 - layero.find('.'+ doms[7]).on('click', cancel);  
630 -  
631 - //点遮罩关闭  
632 - if(config.shadeClose){  
633 - $('#layui-layer-shade'+ that.index).on('click', function(){  
634 - layer.close(that.index);  
635 - });  
636 - }  
637 -  
638 - //最小化  
639 - layero.find('.layui-layer-min').on('click', function(){  
640 - var min = config.min && config.min(layero);  
641 - min === false || layer.min(that.index, config);  
642 - });  
643 -  
644 - //全屏/还原  
645 - layero.find('.layui-layer-max').on('click', function(){  
646 - if($(this).hasClass('layui-layer-maxmin')){  
647 - layer.restore(that.index);  
648 - config.restore && config.restore(layero);  
649 - } else {  
650 - layer.full(that.index, config);  
651 - setTimeout(function(){  
652 - config.full && config.full(layero);  
653 - }, 100);  
654 - }  
655 - });  
656 -  
657 - config.end && (ready.end[that.index] = config.end);  
658 -};  
659 -  
660 -//for ie6 恢复select  
661 -ready.reselect = function(){  
662 - $.each($('select'), function(index , value){  
663 - var sthis = $(this);  
664 - if(!sthis.parents('.'+doms[0])[0]){  
665 - (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();  
666 - }  
667 - sthis = null;  
668 - });  
669 -};  
670 -  
671 -Class.pt.IE6 = function(layero){  
672 - //隐藏select  
673 - $('select').each(function(index , value){  
674 - var sthis = $(this);  
675 - if(!sthis.parents('.'+doms[0])[0]){  
676 - sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();  
677 - }  
678 - sthis = null;  
679 - });  
680 -};  
681 -  
682 -//需依赖原型的对外方法  
683 -Class.pt.openLayer = function(){  
684 - var that = this;  
685 -  
686 - //置顶当前窗口  
687 - layer.zIndex = that.config.zIndex;  
688 - layer.setTop = function(layero){  
689 - var setZindex = function(){  
690 - layer.zIndex++;  
691 - layero.css('z-index', layer.zIndex + 1);  
692 - };  
693 - layer.zIndex = parseInt(layero[0].style.zIndex);  
694 - layero.on('mousedown', setZindex);  
695 - return layer.zIndex;  
696 - };  
697 -};  
698 -  
699 -ready.record = function(layero){  
700 - var area = [  
701 - layero.width(),  
702 - layero.height(),  
703 - layero.position().top,  
704 - layero.position().left + parseFloat(layero.css('margin-left'))  
705 - ];  
706 - layero.find('.layui-layer-max').addClass('layui-layer-maxmin');  
707 - layero.attr({area: area});  
708 -};  
709 -  
710 -ready.rescollbar = function(index){  
711 - if(doms.html.attr('layer-full') == index){  
712 - if(doms.html[0].style.removeProperty){  
713 - doms.html[0].style.removeProperty('overflow');  
714 - } else {  
715 - doms.html[0].style.removeAttribute('overflow');  
716 - }  
717 - doms.html.removeAttr('layer-full');  
718 - }  
719 -};  
720 -  
721 -/** 内置成员 */  
722 -  
723 -window.layer = layer;  
724 -  
725 -//获取子iframe的DOM  
726 -layer.getChildFrame = function(selector, index){  
727 - index = index || $('.'+doms[4]).attr('times');  
728 - return $('#'+ doms[0] + index).find('iframe').contents().find(selector);  
729 -};  
730 -  
731 -//得到当前iframe层的索引,子iframe时使用  
732 -layer.getFrameIndex = function(name){  
733 - return $('#'+ name).parents('.'+doms[4]).attr('times');  
734 -};  
735 -  
736 -//iframe层自适应宽高  
737 -layer.iframeAuto = function(index){  
738 - if(!index) return;  
739 - var heg = layer.getChildFrame('html', index).outerHeight();  
740 - var layero = $('#'+ doms[0] + index);  
741 - var titHeight = layero.find(doms[1]).outerHeight() || 0;  
742 - var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;  
743 - layero.css({height: heg + titHeight + btnHeight});  
744 - layero.find('iframe').css({height: heg});  
745 -};  
746 -  
747 -//重置iframe url  
748 -layer.iframeSrc = function(index, url){  
749 - $('#'+ doms[0] + index).find('iframe').attr('src', url);  
750 -};  
751 -  
752 -//设定层的样式  
753 -layer.style = function(index, options, limit){  
754 - var layero = $('#'+ doms[0] + index)  
755 - ,contElem = layero.find('.layui-layer-content')  
756 - ,type = layero.attr('type')  
757 - ,titHeight = layero.find(doms[1]).outerHeight() || 0  
758 - ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0  
759 - ,minLeft = layero.attr('minLeft');  
760 -  
761 - if(type === ready.type[3] || type === ready.type[4]){  
762 - return;  
763 - }  
764 -  
765 - if(!limit){  
766 - if(parseFloat(options.width) <= 260){  
767 - options.width = 260;  
768 - };  
769 -  
770 - if(parseFloat(options.height) - titHeight - btnHeight <= 64){  
771 - options.height = 64 + titHeight + btnHeight;  
772 - };  
773 - }  
774 -  
775 - layero.css(options);  
776 - btnHeight = layero.find('.'+doms[6]).outerHeight();  
777 -  
778 - if(type === ready.type[2]){  
779 - layero.find('iframe').css({  
780 - height: parseFloat(options.height) - titHeight - btnHeight  
781 - });  
782 - } else {  
783 - contElem.css({  
784 - height: parseFloat(options.height) - titHeight - btnHeight  
785 - - parseFloat(contElem.css('padding-top'))  
786 - - parseFloat(contElem.css('padding-bottom'))  
787 - })  
788 - }  
789 -};  
790 -  
791 -//最小化  
792 -layer.min = function(index, options){  
793 - var layero = $('#'+ doms[0] + index)  
794 - ,titHeight = layero.find(doms[1]).outerHeight() || 0  
795 - ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'  
796 - ,position = layero.css('position');  
797 -  
798 - ready.record(layero);  
799 -  
800 - if(ready.minLeft[0]){  
801 - left = ready.minLeft[0];  
802 - ready.minLeft.shift();  
803 - }  
804 -  
805 - layero.attr('position', position);  
806 -  
807 - layer.style(index, {  
808 - width: 180  
809 - ,height: titHeight  
810 - ,left: left  
811 - ,top: win.height() - titHeight  
812 - ,position: 'fixed'  
813 - ,overflow: 'hidden'  
814 - }, true);  
815 -  
816 - layero.find('.layui-layer-min').hide();  
817 - layero.attr('type') === 'page' && layero.find(doms[4]).hide();  
818 - ready.rescollbar(index);  
819 -  
820 - if(!layero.attr('minLeft')){  
821 - ready.minIndex++;  
822 - }  
823 - layero.attr('minLeft', left);  
824 -};  
825 -  
826 -//还原  
827 -layer.restore = function(index){  
828 - var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');  
829 - var type = layero.attr('type');  
830 - layer.style(index, {  
831 - width: parseFloat(area[0]),  
832 - height: parseFloat(area[1]),  
833 - top: parseFloat(area[2]),  
834 - left: parseFloat(area[3]),  
835 - position: layero.attr('position'),  
836 - overflow: 'visible'  
837 - }, true);  
838 - layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');  
839 - layero.find('.layui-layer-min').show();  
840 - layero.attr('type') === 'page' && layero.find(doms[4]).show();  
841 - ready.rescollbar(index);  
842 -};  
843 -  
844 -//全屏  
845 -layer.full = function(index){  
846 - var layero = $('#'+ doms[0] + index), timer;  
847 - ready.record(layero);  
848 - if(!doms.html.attr('layer-full')){  
849 - doms.html.css('overflow','hidden').attr('layer-full', index);  
850 - }  
851 - clearTimeout(timer);  
852 - timer = setTimeout(function(){  
853 - var isfix = layero.css('position') === 'fixed';  
854 - layer.style(index, {  
855 - top: isfix ? 0 : win.scrollTop(),  
856 - left: isfix ? 0 : win.scrollLeft(),  
857 - width: win.width(),  
858 - height: win.height()  
859 - }, true);  
860 - layero.find('.layui-layer-min').hide();  
861 - }, 100);  
862 -};  
863 -  
864 -//改变title  
865 -layer.title = function(name, index){  
866 - var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);  
867 - title.html(name);  
868 -};  
869 -  
870 -//关闭layer总方法  
871 -layer.close = function(index){  
872 - var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';  
873 - if(!layero[0]) return;  
874 - var WRAP = 'layui-layer-wrap', remove = function(){  
875 - if(type === ready.type[1] && layero.attr('conType') === 'object'){  
876 - layero.children(':not(.'+ doms[5] +')').remove();  
877 - var wrap = layero.find('.'+WRAP);  
878 - for(var i = 0; i < 2; i++){  
879 - wrap.unwrap();  
880 - }  
881 - wrap.css('display', wrap.data('display')).removeClass(WRAP);  
882 - } else {  
883 - //低版本IE 回收 iframe  
884 - if(type === ready.type[2]){  
885 - try {  
886 - var iframe = $('#'+doms[4]+index)[0];  
887 - iframe.contentWindow.document.write('');  
888 - iframe.contentWindow.close();  
889 - layero.find('.'+doms[5])[0].removeChild(iframe);  
890 - } catch(e){}  
891 - }  
892 - layero[0].innerHTML = '';  
893 - layero.remove();  
894 - }  
895 - typeof ready.end[index] === 'function' && ready.end[index]();  
896 - delete ready.end[index];  
897 - };  
898 -  
899 - if(layero.data('isOutAnim')){  
900 - layero.addClass(closeAnim);  
901 - }  
902 -  
903 - $('#layui-layer-moves, #layui-layer-shade' + index).remove();  
904 - layer.ie == 6 && ready.reselect();  
905 - ready.rescollbar(index);  
906 - if(layero.attr('minLeft')){  
907 - ready.minIndex--;  
908 - ready.minLeft.push(layero.attr('minLeft'));  
909 - }  
910 -  
911 - if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){  
912 - remove()  
913 - } else {  
914 - setTimeout(function(){  
915 - remove();  
916 - }, 200);  
917 - }  
918 -};  
919 -  
920 -//关闭所有层  
921 -layer.closeAll = function(type){  
922 - $.each($('.'+doms[0]), function(){  
923 - var othis = $(this);  
924 - var is = type ? (othis.attr('type') === type) : 1;  
925 - is && layer.close(othis.attr('times'));  
926 - is = null;  
927 - });  
928 -};  
929 -  
930 -/**  
931 -  
932 - 拓展模块,layui开始合并在一起  
933 -  
934 - */  
935 -  
936 -var cache = layer.cache||{}, skin = function(type){  
937 - return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');  
938 -};  
939 -  
940 -//仿系统prompt  
941 -layer.prompt = function(options, yes){  
942 - var style = '';  
943 - options = options || {};  
944 -  
945 - if(typeof options === 'function') yes = options;  
946 -  
947 - if(options.area){  
948 - var area = options.area;  
949 - style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';  
950 - delete options.area;  
951 - }  
952 - var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){  
953 - return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';  
954 - }();  
955 -  
956 - var success = options.success;  
957 - delete options.success;  
958 -  
959 - return layer.open($.extend({  
960 - type: 1  
961 - ,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']  
962 - ,content: content  
963 - ,skin: 'layui-layer-prompt' + skin('prompt')  
964 - ,maxWidth: win.width()  
965 - ,success: function(layero){  
966 - prompt = layero.find('.layui-layer-input');  
967 - prompt.focus();  
968 - typeof success === 'function' && success(layero);  
969 - }  
970 - ,resize: false  
971 - ,yes: function(index){  
972 - var value = prompt.val();  
973 - if(value === ''){  
974 - prompt.focus();  
975 - } else if(value.length > (options.maxlength||500)) {  
976 - layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});  
977 - } else {  
978 - yes && yes(value, index, prompt);  
979 - }  
980 - }  
981 - }, options));  
982 -};  
983 -  
984 -//tab层  
985 -layer.tab = function(options){  
986 - options = options || {};  
987 -  
988 - var tab = options.tab || {}  
989 - ,success = options.success;  
990 -  
991 - delete options.success;  
992 -  
993 - return layer.open($.extend({  
994 - type: 1,  
995 - skin: 'layui-layer-tab' + skin('tab'),  
996 - resize: false,  
997 - title: function(){  
998 - var len = tab.length, ii = 1, str = '';  
999 - if(len > 0){  
1000 - str = '<span class="layui-layer-tabnow">'+ tab[0].title +'</span>';  
1001 - for(; ii < len; ii++){  
1002 - str += '<span>'+ tab[ii].title +'</span>';  
1003 - }  
1004 - }  
1005 - return str;  
1006 - }(),  
1007 - content: '<ul class="layui-layer-tabmain">'+ function(){  
1008 - var len = tab.length, ii = 1, str = '';  
1009 - if(len > 0){  
1010 - str = '<li class="layui-layer-tabli xubox_tab_layer">'+ (tab[0].content || 'no content') +'</li>';  
1011 - for(; ii < len; ii++){  
1012 - str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';  
1013 - }  
1014 - }  
1015 - return str;  
1016 - }() +'</ul>',  
1017 - success: function(layero){  
1018 - var btn = layero.find('.layui-layer-title').children();  
1019 - var main = layero.find('.layui-layer-tabmain').children();  
1020 - btn.on('mousedown', function(e){  
1021 - e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;  
1022 - var othis = $(this), index = othis.index();  
1023 - othis.addClass('layui-layer-tabnow').siblings().removeClass('layui-layer-tabnow');  
1024 - main.eq(index).show().siblings().hide();  
1025 - typeof options.change === 'function' && options.change(index);  
1026 - });  
1027 - typeof success === 'function' && success(layero);  
1028 - }  
1029 - }, options));  
1030 -};  
1031 -  
1032 -//相册层  
1033 -layer.photos = function(options, loop, key){  
1034 - var dict = {};  
1035 - options = options || {};  
1036 - if(!options.photos) return;  
1037 - var type = options.photos.constructor === Object;  
1038 - var photos = type ? options.photos : {}, data = photos.data || [];  
1039 - var start = photos.start || 0;  
1040 - dict.imgIndex = (start|0) + 1;  
1041 -  
1042 - options.img = options.img || 'img';  
1043 -  
1044 - var success = options.success;  
1045 - delete options.success;  
1046 -  
1047 - if(!type){ //页面直接获取  
1048 - var parent = $(options.photos), pushData = function(){  
1049 - data = [];  
1050 - parent.find(options.img).each(function(index){  
1051 - var othis = $(this);  
1052 - othis.attr('layer-index', index);  
1053 - data.push({  
1054 - alt: othis.attr('alt'),  
1055 - pid: othis.attr('layer-pid'),  
1056 - src: othis.attr('layer-src') || othis.attr('src'),  
1057 - thumb: othis.attr('src')  
1058 - });  
1059 - })  
1060 - };  
1061 -  
1062 - pushData();  
1063 -  
1064 - if (data.length === 0) return;  
1065 -  
1066 - loop || parent.on('click', options.img, function(){  
1067 - var othis = $(this), index = othis.attr('layer-index');  
1068 - layer.photos($.extend(options, {  
1069 - photos: {  
1070 - start: index,  
1071 - data: data,  
1072 - tab: options.tab  
1073 - },  
1074 - full: options.full  
1075 - }), true);  
1076 - pushData();  
1077 - })  
1078 -  
1079 - //不直接弹出  
1080 - if(!loop) return;  
1081 -  
1082 - } else if (data.length === 0){  
1083 - return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');  
1084 - }  
1085 -  
1086 - //上一张  
1087 - dict.imgprev = function(key){  
1088 - dict.imgIndex--;  
1089 - if(dict.imgIndex < 1){  
1090 - dict.imgIndex = data.length;  
1091 - }  
1092 - dict.tabimg(key);  
1093 - };  
1094 -  
1095 - //下一张  
1096 - dict.imgnext = function(key,errorMsg){  
1097 - dict.imgIndex++;  
1098 - if(dict.imgIndex > data.length){  
1099 - dict.imgIndex = 1;  
1100 - if (errorMsg) {return};  
1101 - }  
1102 - dict.tabimg(key)  
1103 - };  
1104 -  
1105 - //方向键  
1106 - dict.keyup = function(event){  
1107 - if(!dict.end){  
1108 - var code = event.keyCode;  
1109 - event.preventDefault();  
1110 - if(code === 37){  
1111 - dict.imgprev(true);  
1112 - } else if(code === 39) {  
1113 - dict.imgnext(true);  
1114 - } else if(code === 27) {  
1115 - layer.close(dict.index);  
1116 - }  
1117 - }  
1118 - }  
1119 -  
1120 - //切换  
1121 - dict.tabimg = function(key){  
1122 - if(data.length <= 1) return;  
1123 - photos.start = dict.imgIndex - 1;  
1124 - layer.close(dict.index);  
1125 - return layer.photos(options, true, key);  
1126 - setTimeout(function(){  
1127 - layer.photos(options, true, key);  
1128 - }, 200);  
1129 - }  
1130 -  
1131 - //一些动作  
1132 - dict.event = function(){  
1133 - dict.bigimg.hover(function(){  
1134 - dict.imgsee.show();  
1135 - }, function(){  
1136 - dict.imgsee.hide();  
1137 - });  
1138 -  
1139 - dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){  
1140 - event.preventDefault();  
1141 - dict.imgprev();  
1142 - });  
1143 -  
1144 - dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){  
1145 - event.preventDefault();  
1146 - dict.imgnext();  
1147 - });  
1148 -  
1149 - $(document).on('keyup', dict.keyup);  
1150 - };  
1151 -  
1152 - //图片预加载  
1153 - function loadImage(url, callback, error) {  
1154 - var img = new Image();  
1155 - img.src = url;  
1156 - if(img.complete){  
1157 - return callback(img);  
1158 - }  
1159 - img.onload = function(){  
1160 - img.onload = null;  
1161 - callback(img);  
1162 - };  
1163 - img.onerror = function(e){  
1164 - img.onerror = null;  
1165 - error(e);  
1166 - };  
1167 - };  
1168 -  
1169 - dict.loadi = layer.load(1, {  
1170 - shade: 'shade' in options ? false : 0.9,  
1171 - scrollbar: false  
1172 - });  
1173 -  
1174 - loadImage(data[start].src, function(img){  
1175 - layer.close(dict.loadi);  
1176 - dict.index = layer.open($.extend({  
1177 - type: 1,  
1178 - id: 'layui-layer-photos',  
1179 - area: function(){  
1180 - var imgarea = [img.width, img.height];  
1181 - var winarea = [$(window).width() - 100, $(window).height() - 100];  
1182 -  
1183 - //如果 实际图片的宽或者高比 屏幕大(那么进行缩放)  
1184 - if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){  
1185 - var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例  
1186 - if(wh[0] > wh[1]){//取缩放比例最大的进行缩放  
1187 - imgarea[0] = imgarea[0]/wh[0];  
1188 - imgarea[1] = imgarea[1]/wh[0];  
1189 - } else if(wh[0] < wh[1]){  
1190 - imgarea[0] = imgarea[0]/wh[1];  
1191 - imgarea[1] = imgarea[1]/wh[1];  
1192 - }  
1193 - }  
1194 -  
1195 - return [imgarea[0]+'px', imgarea[1]+'px'];  
1196 - }(),  
1197 - title: false,  
1198 - shade: 0.9,  
1199 - shadeClose: true,  
1200 - closeBtn: false,  
1201 - move: '.layui-layer-phimg img',  
1202 - moveType: 1,  
1203 - scrollbar: false,  
1204 - moveOut: true,  
1205 - //anim: Math.random()*5|0,  
1206 - isOutAnim: false,  
1207 - skin: 'layui-layer-photos' + skin('photos'),  
1208 - content: '<div class="layui-layer-phimg">'  
1209 - +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'  
1210 - +'<div class="layui-layer-imgsee">'  
1211 - +(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')  
1212 - +'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'  
1213 - +'</div>'  
1214 - +'</div>',  
1215 - success: function(layero, index){  
1216 - dict.bigimg = layero.find('.layui-layer-phimg');  
1217 - dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');  
1218 - dict.event(layero);  
1219 - options.tab && options.tab(data[start], layero);  
1220 - typeof success === 'function' && success(layero);  
1221 - }, end: function(){  
1222 - dict.end = true;  
1223 - $(document).off('keyup', dict.keyup);  
1224 - }  
1225 - }, options));  
1226 - }, function(){  
1227 - layer.close(dict.loadi);  
1228 - layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {  
1229 - time: 30000,  
1230 - btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],  
1231 - yes: function(){  
1232 - data.length > 1 && dict.imgnext(true,true);  
1233 - }  
1234 - });  
1235 - });  
1236 -};  
1237 -  
1238 -//主入口  
1239 -ready.run = function(_$){  
1240 - $ = _$;  
1241 - win = $(window);  
1242 - doms.html = $('html');  
1243 - layer.open = function(deliver){  
1244 - var o = new Class(deliver);  
1245 - return o.index;  
1246 - };  
1247 -};  
1248 -  
1249 -//加载方式  
1250 -window.layui && layui.define ? (  
1251 - layer.ready()  
1252 - ,layui.define('jquery', function(exports){ //layui加载  
1253 - layer.path = layui.cache.dir;  
1254 - ready.run(layui.jquery);  
1255 -  
1256 - //暴露模块  
1257 - window.layer = layer;  
1258 - exports('layer', layer);  
1259 - })  
1260 -) : (  
1261 - (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载  
1262 - ready.run(window.jQuery);  
1263 - return layer;  
1264 - }) : function(){ //普通script标签加载  
1265 - ready.run(window.jQuery);  
1266 - layer.ready();  
1267 - }()  
1268 -);  
1269 -  
1270 -}(window); 1 +/**
  2 +
  3 + @Name:layer v3.0.3 Web弹层组件
  4 + @Author:贤心
  5 + @Site:http://layer.layui.com
  6 + @License:MIT
  7 +
  8 + */
  9 +
  10 +;!function(window, undefined){
  11 +"use strict";
  12 +
  13 +var isLayui = window.layui && layui.define, $, win, ready = {
  14 + getPath: function(){
  15 + var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
  16 + if(script.getAttribute('merge')) return;
  17 + return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
  18 + }(),
  19 +
  20 + config: {}, end: {}, minIndex: 0, minLeft: [],
  21 + btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
  22 +
  23 + //五种原始层模式
  24 + type: ['dialog', 'page', 'iframe', 'loading', 'tips']
  25 +};
  26 +
  27 +//默认内置方法。
  28 +var layer = {
  29 + v: '3.0.3',
  30 + ie: function(){ //ie版本
  31 + var agent = navigator.userAgent.toLowerCase();
  32 + return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
  33 + (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
  34 + ) : false;
  35 + }(),
  36 + index: (window.layer && window.layer.v) ? 100000 : 0,
  37 + path: ready.getPath,
  38 + config: function(options, fn){
  39 + options = options || {};
  40 + layer.cache = ready.config = $.extend({}, ready.config, options);
  41 + layer.path = ready.config.path || layer.path;
  42 + typeof options.extend === 'string' && (options.extend = [options.extend]);
  43 +
  44 + if(ready.config.path) layer.ready();
  45 +
  46 + if(!options.extend) return this;
  47 +
  48 + isLayui
  49 + ? layui.addcss('modules/layer/' + options.extend)
  50 + : layer.link('skin/' + options.extend);
  51 +
  52 + return this;
  53 + },
  54 +
  55 + //载入CSS配件
  56 + link: function(href, fn, cssname){
  57 +
  58 + //未设置路径,则不主动加载css
  59 + if(!layer.path) return;
  60 +
  61 + var head = $('head')[0], link = document.createElement('link');
  62 + if(typeof fn === 'string') cssname = fn;
  63 + var app = (cssname || href).replace(/\.|\//g, '');
  64 + var id = 'layuicss-'+app, timeout = 0;
  65 +
  66 + link.rel = 'stylesheet';
  67 + link.href = layer.path + href;
  68 + link.id = id;
  69 +
  70 + if(!$('#'+ id)[0]){
  71 + head.appendChild(link);
  72 + }
  73 +
  74 + if(typeof fn !== 'function') return;
  75 +
  76 + //轮询css是否加载完毕
  77 +/* (function poll() {
  78 + if(++timeout > 8 * 1000 / 100){
  79 + return window.console && console.error('layer.css: Invalid');
  80 + };
  81 + parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
  82 + }());*/
  83 + },
  84 +
  85 + ready: function(callback){
  86 + /*var cssname = 'skinlayercss', ver = '303';
  87 + isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
  88 + : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);*/
  89 + return this;
  90 + },
  91 +
  92 + //各种快捷引用
  93 + alert: function(content, options, yes){
  94 + var type = typeof options === 'function';
  95 + if(type) yes = options;
  96 + return layer.open($.extend({
  97 + content: content,
  98 + yes: yes
  99 + }, type ? {} : options));
  100 + },
  101 +
  102 + confirm: function(content, options, yes, cancel){
  103 + var type = typeof options === 'function';
  104 + if(type){
  105 + cancel = yes;
  106 + yes = options;
  107 + }
  108 + return layer.open($.extend({
  109 + content: content,
  110 + btn: ready.btn,
  111 + yes: yes,
  112 + btn2: cancel
  113 + }, type ? {} : options));
  114 + },
  115 +
  116 + msg: function(content, options, end){ //最常用提示层
  117 + var type = typeof options === 'function', rskin = ready.config.skin;
  118 + var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
  119 + var anim = doms.anim.length - 1;
  120 + if(type) end = options;
  121 + return layer.open($.extend({
  122 + content: content,
  123 + time: 3000,
  124 + shade: false,
  125 + skin: skin,
  126 + title: false,
  127 + closeBtn: false,
  128 + btn: false,
  129 + resize: false,
  130 + end: end
  131 + }, (type && !ready.config.skin) ? {
  132 + skin: skin + ' layui-layer-hui',
  133 + anim: anim
  134 + } : function(){
  135 + options = options || {};
  136 + if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
  137 + options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
  138 + }
  139 + return options;
  140 + }()));
  141 + },
  142 +
  143 + load: function(icon, options){
  144 + return layer.open($.extend({
  145 + type: 3,
  146 + icon: icon || 0,
  147 + resize: false,
  148 + shade: 0.01
  149 + }, options));
  150 + },
  151 +
  152 + tips: function(content, follow, options){
  153 + return layer.open($.extend({
  154 + type: 4,
  155 + content: [content, follow],
  156 + closeBtn: false,
  157 + time: 3000,
  158 + shade: false,
  159 + resize: false,
  160 + fixed: false,
  161 + maxWidth: 210
  162 + }, options));
  163 + }
  164 +};
  165 +
  166 +var Class = function(setings){
  167 + var that = this;
  168 + that.index = ++layer.index;
  169 + that.config = $.extend({}, that.config, ready.config, setings);
  170 + document.body ? that.creat() : setTimeout(function(){
  171 + that.creat();
  172 + }, 30);
  173 +};
  174 +
  175 +Class.pt = Class.prototype;
  176 +
  177 +//缓存常用字符
  178 +var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
  179 +doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
  180 +
  181 +//默认配置
  182 +Class.pt.config = {
  183 + type: 0,
  184 + shade: 0.3,
  185 + fixed: true,
  186 + move: doms[1],
  187 + title: '&#x4FE1;&#x606F;',
  188 + offset: 'auto',
  189 + area: 'auto',
  190 + closeBtn: 1,
  191 + time: 0, //0表示不自动关闭
  192 + zIndex: 19891014,
  193 + maxWidth: 360,
  194 + anim: 0,
  195 + isOutAnim: true,
  196 + icon: -1,
  197 + moveType: 1,
  198 + resize: true,
  199 + scrollbar: true, //是否允许浏览器滚动条
  200 + tips: 2
  201 +};
  202 +
  203 +//容器
  204 +Class.pt.vessel = function(conType, callback){
  205 + var that = this, times = that.index, config = that.config;
  206 + var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
  207 + var ismax = config.maxmin && (config.type === 1 || config.type === 2);
  208 + var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
  209 + + (titype ? config.title[0] : config.title)
  210 + + '</div>' : '');
  211 +
  212 + config.zIndex = zIndex;
  213 + callback([
  214 + //遮罩
  215 + config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
  216 +
  217 + //主体
  218 + '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
  219 + + (conType && config.type != 2 ? '' : titleHTML)
  220 + + '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
  221 + + (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
  222 + + (config.type == 1 && conType ? '' : (config.content||''))
  223 + + '</div>'
  224 + + '<span class="layui-layer-setwin">'+ function(){
  225 + var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
  226 + config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
  227 + return closebtn;
  228 + }() + '</span>'
  229 + + (config.btn ? function(){
  230 + var button = '';
  231 + typeof config.btn === 'string' && (config.btn = [config.btn]);
  232 + for(var i = 0, len = config.btn.length; i < len; i++){
  233 + button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
  234 + }
  235 + return '<div class="'+ doms[6] + (config.btnAlign ? (' layui-layer-btn-' + config.btnAlign) : '') +'">'+ button +'</div>'
  236 + }() : '')
  237 + + (config.resize ? '<span class="layui-layer-resize"></span>' : '')
  238 + + '</div>'
  239 + ], titleHTML, $('<div class="layui-layer-move"></div>'));
  240 + return that;
  241 +};
  242 +
  243 +//创建骨架
  244 +Class.pt.creat = function(){
  245 + var that = this
  246 + ,config = that.config
  247 + ,times = that.index, nodeIndex
  248 + ,content = config.content
  249 + ,conType = typeof content === 'object'
  250 + ,body = $('body');
  251 +
  252 + if(config.id && $('#'+config.id)[0]) return;
  253 +
  254 + if(typeof config.area === 'string'){
  255 + config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
  256 + }
  257 +
  258 + //anim兼容旧版shift
  259 + if(config.shift){
  260 + config.anim = config.shift;
  261 + }
  262 +
  263 + if(layer.ie == 6){
  264 + config.fixed = false;
  265 + }
  266 +
  267 + switch(config.type){
  268 + case 0:
  269 + config.btn = ('btn' in config) ? config.btn : ready.btn[0];
  270 + layer.closeAll('dialog');
  271 + break;
  272 + case 2:
  273 + var content = config.content = conType ? config.content : [config.content, 'auto'];
  274 + config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
  275 + break;
  276 + case 3:
  277 + delete config.title;
  278 + delete config.closeBtn;
  279 + config.icon === -1 && (config.icon === 0);
  280 + layer.closeAll('loading');
  281 + break;
  282 + case 4:
  283 + conType || (config.content = [config.content, 'body']);
  284 + config.follow = config.content[1];
  285 + config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
  286 + delete config.title;
  287 + config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
  288 + config.tipsMore || layer.closeAll('tips');
  289 + break;
  290 + }
  291 +
  292 + //建立容器
  293 + that.vessel(conType, function(html, titleHTML, moveElem){
  294 + body.append(html[0]);
  295 + conType ? function(){
  296 + (config.type == 2 || config.type == 4) ? function(){
  297 + $('body').append(html[1]);
  298 + }() : function(){
  299 + if(!content.parents('.'+doms[0])[0]){
  300 + content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
  301 + $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
  302 + }
  303 + }();
  304 + }() : body.append(html[1]);
  305 + $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
  306 + that.layero = $('#'+ doms[0] + times);
  307 + config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
  308 + }).auto(times);
  309 +
  310 + config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
  311 +
  312 + //坐标自适应浏览器窗口尺寸
  313 + config.type == 4 ? that.tips() : that.offset();
  314 + if(config.fixed){
  315 + win.on('resize', function(){
  316 + that.offset();
  317 + (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
  318 + config.type == 4 && that.tips();
  319 + });
  320 + }
  321 +
  322 + config.time <= 0 || setTimeout(function(){
  323 + layer.close(that.index)
  324 + }, config.time);
  325 + that.move().callback();
  326 +
  327 + //为兼容jQuery3.0的css动画影响元素尺寸计算
  328 + if(doms.anim[config.anim]){
  329 + that.layero.addClass(doms.anim[config.anim]);
  330 + };
  331 +
  332 + //记录关闭动画
  333 + if(config.isOutAnim){
  334 + that.layero.data('isOutAnim', true);
  335 + }
  336 +};
  337 +
  338 +//自适应
  339 +Class.pt.auto = function(index){
  340 + var that = this, config = that.config, layero = $('#'+ doms[0] + index);
  341 + if(config.area[0] === '' && config.maxWidth > 0){
  342 + //为了修复IE7下一个让人难以理解的bug
  343 + if(layer.ie && layer.ie < 8 && config.btn){
  344 + layero.width(layero.innerWidth());
  345 + }
  346 + layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
  347 + }
  348 + var area = [layero.innerWidth(), layero.innerHeight()];
  349 + var titHeight = layero.find(doms[1]).outerHeight() || 0;
  350 + var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  351 + function setHeight(elem){
  352 + elem = layero.find(elem);
  353 + elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));
  354 + }
  355 + switch(config.type){
  356 + case 2:
  357 + setHeight('iframe');
  358 + break;
  359 + default:
  360 + if(config.area[1] === ''){
  361 + if(config.fixed && area[1] >= win.height()){
  362 + area[1] = win.height();
  363 + setHeight('.'+doms[5]);
  364 + }
  365 + } else {
  366 + setHeight('.'+doms[5]);
  367 + }
  368 + break;
  369 + }
  370 + return that;
  371 +};
  372 +
  373 +//计算坐标
  374 +Class.pt.offset = function(){
  375 + var that = this, config = that.config, layero = that.layero;
  376 + var area = [layero.outerWidth(), layero.outerHeight()];
  377 + var type = typeof config.offset === 'object';
  378 + that.offsetTop = (win.height() - area[1])/2;
  379 + that.offsetLeft = (win.width() - area[0])/2;
  380 +
  381 + if(type){
  382 + that.offsetTop = config.offset[0];
  383 + that.offsetLeft = config.offset[1]||that.offsetLeft;
  384 + } else if(config.offset !== 'auto'){
  385 +
  386 + if(config.offset === 't'){ //上
  387 + that.offsetTop = 0;
  388 + } else if(config.offset === 'r'){ //右
  389 + that.offsetLeft = win.width() - area[0];
  390 + } else if(config.offset === 'b'){ //下
  391 + that.offsetTop = win.height() - area[1];
  392 + } else if(config.offset === 'l'){ //左
  393 + that.offsetLeft = 0;
  394 + } else if(config.offset === 'lt'){ //左上角
  395 + that.offsetTop = 0;
  396 + that.offsetLeft = 0;
  397 + } else if(config.offset === 'lb'){ //左下角
  398 + that.offsetTop = win.height() - area[1];
  399 + that.offsetLeft = 0;
  400 + } else if(config.offset === 'rt'){ //右上角
  401 + that.offsetTop = 0;
  402 + that.offsetLeft = win.width() - area[0];
  403 + } else if(config.offset === 'rb'){ //右下角
  404 + that.offsetTop = win.height() - area[1];
  405 + that.offsetLeft = win.width() - area[0];
  406 + } else {
  407 + that.offsetTop = config.offset;
  408 + }
  409 +
  410 + }
  411 +
  412 + if(!config.fixed){
  413 + that.offsetTop = /%$/.test(that.offsetTop) ?
  414 + win.height()*parseFloat(that.offsetTop)/100
  415 + : parseFloat(that.offsetTop);
  416 + that.offsetLeft = /%$/.test(that.offsetLeft) ?
  417 + win.width()*parseFloat(that.offsetLeft)/100
  418 + : parseFloat(that.offsetLeft);
  419 + that.offsetTop += win.scrollTop();
  420 + that.offsetLeft += win.scrollLeft();
  421 + }
  422 +
  423 + if(layero.attr('minLeft')){
  424 + that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
  425 + that.offsetLeft = layero.css('left');
  426 + }
  427 +
  428 + layero.css({top: that.offsetTop, left: that.offsetLeft});
  429 +};
  430 +
  431 +//Tips
  432 +Class.pt.tips = function(){
  433 + var that = this, config = that.config, layero = that.layero;
  434 + var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);
  435 + if(!follow[0]) follow = $('body');
  436 + var goal = {
  437 + width: follow.outerWidth(),
  438 + height: follow.outerHeight(),
  439 + top: follow.offset().top,
  440 + left: follow.offset().left
  441 + }, tipsG = layero.find('.layui-layer-TipsG');
  442 +
  443 + var guide = config.tips[0];
  444 + config.tips[1] || tipsG.remove();
  445 +
  446 + goal.autoLeft = function(){
  447 + if(goal.left + layArea[0] - win.width() > 0){
  448 + goal.tipLeft = goal.left + goal.width - layArea[0];
  449 + tipsG.css({right: 12, left: 'auto'});
  450 + } else {
  451 + goal.tipLeft = goal.left;
  452 + };
  453 + };
  454 +
  455 + //辨别tips的方位
  456 + goal.where = [function(){ //上
  457 + goal.autoLeft();
  458 + goal.tipTop = goal.top - layArea[1] - 10;
  459 + tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
  460 + }, function(){ //右
  461 + goal.tipLeft = goal.left + goal.width + 10;
  462 + goal.tipTop = goal.top;
  463 + tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
  464 + }, function(){ //下
  465 + goal.autoLeft();
  466 + goal.tipTop = goal.top + goal.height + 10;
  467 + tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
  468 + }, function(){ //左
  469 + goal.tipLeft = goal.left - layArea[0] - 10;
  470 + goal.tipTop = goal.top;
  471 + tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
  472 + }];
  473 + goal.where[guide-1]();
  474 +
  475 + /* 8*2为小三角形占据的空间 */
  476 + if(guide === 1){
  477 + goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
  478 + } else if(guide === 2){
  479 + win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()
  480 + } else if(guide === 3){
  481 + (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();
  482 + } else if(guide === 4){
  483 + layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()
  484 + }
  485 +
  486 + layero.find('.'+doms[5]).css({
  487 + 'background-color': config.tips[1],
  488 + 'padding-right': (config.closeBtn ? '30px' : '')
  489 + });
  490 + layero.css({
  491 + left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
  492 + top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
  493 + });
  494 +}
  495 +
  496 +//拖拽层
  497 +Class.pt.move = function(){
  498 + var that = this
  499 + ,config = that.config
  500 + ,_DOC = $(document)
  501 + ,layero = that.layero
  502 + ,moveElem = layero.find(config.move)
  503 + ,resizeElem = layero.find('.layui-layer-resize')
  504 + ,dict = {};
  505 +
  506 + if(config.move){
  507 + moveElem.css('cursor', 'move');
  508 + }
  509 +
  510 + moveElem.on('mousedown', function(e){
  511 + e.preventDefault();
  512 + if(config.move){
  513 + dict.moveStart = true;
  514 + dict.offset = [
  515 + e.clientX - parseFloat(layero.css('left'))
  516 + ,e.clientY - parseFloat(layero.css('top'))
  517 + ];
  518 + ready.moveElem.css('cursor', 'move').show();
  519 + }
  520 + });
  521 +
  522 + resizeElem.on('mousedown', function(e){
  523 + e.preventDefault();
  524 + dict.resizeStart = true;
  525 + dict.offset = [e.clientX, e.clientY];
  526 + dict.area = [
  527 + layero.outerWidth()
  528 + ,layero.outerHeight()
  529 + ];
  530 + ready.moveElem.css('cursor', 'se-resize').show();
  531 + });
  532 +
  533 + _DOC.on('mousemove', function(e){
  534 +
  535 + //拖拽移动
  536 + if(dict.moveStart){
  537 + var X = e.clientX - dict.offset[0]
  538 + ,Y = e.clientY - dict.offset[1]
  539 + ,fixed = layero.css('position') === 'fixed';
  540 +
  541 + e.preventDefault();
  542 +
  543 + dict.stX = fixed ? 0 : win.scrollLeft();
  544 + dict.stY = fixed ? 0 : win.scrollTop();
  545 +
  546 + //控制元素不被拖出窗口外
  547 + if(!config.moveOut){
  548 + var setRig = win.width() - layero.outerWidth() + dict.stX
  549 + ,setBot = win.height() - layero.outerHeight() + dict.stY;
  550 + X < dict.stX && (X = dict.stX);
  551 + X > setRig && (X = setRig);
  552 + Y < dict.stY && (Y = dict.stY);
  553 + Y > setBot && (Y = setBot);
  554 + }
  555 +
  556 + layero.css({
  557 + left: X
  558 + ,top: Y
  559 + });
  560 + }
  561 +
  562 + //Resize
  563 + if(config.resize && dict.resizeStart){
  564 + var X = e.clientX - dict.offset[0]
  565 + ,Y = e.clientY - dict.offset[1];
  566 +
  567 + e.preventDefault();
  568 +
  569 + layer.style(that.index, {
  570 + width: dict.area[0] + X
  571 + ,height: dict.area[1] + Y
  572 + })
  573 + dict.isResize = true;
  574 + config.resizing && config.resizing(layero);
  575 + }
  576 + }).on('mouseup', function(e){
  577 + if(dict.moveStart){
  578 + delete dict.moveStart;
  579 + ready.moveElem.hide();
  580 + config.moveEnd && config.moveEnd(layero);
  581 + }
  582 + if(dict.resizeStart){
  583 + delete dict.resizeStart;
  584 + ready.moveElem.hide();
  585 + }
  586 + });
  587 +
  588 + return that;
  589 +};
  590 +
  591 +Class.pt.callback = function(){
  592 + var that = this, layero = that.layero, config = that.config;
  593 + that.openLayer();
  594 + if(config.success){
  595 + if(config.type == 2){
  596 + layero.find('iframe').on('load', function(){
  597 + config.success(layero, that.index);
  598 + });
  599 + } else {
  600 + config.success(layero, that.index);
  601 + }
  602 + }
  603 + layer.ie == 6 && that.IE6(layero);
  604 +
  605 + //按钮
  606 + layero.find('.'+ doms[6]).children('a').on('click', function(){
  607 + var index = $(this).index();
  608 + if(index === 0){
  609 + if(config.yes){
  610 + config.yes(that.index, layero)
  611 + } else if(config['btn1']){
  612 + config['btn1'](that.index, layero)
  613 + } else {
  614 + layer.close(that.index);
  615 + }
  616 + } else {
  617 + var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
  618 + close === false || layer.close(that.index);
  619 + }
  620 + });
  621 +
  622 + //取消
  623 + function cancel(){
  624 + var close = config.cancel && config.cancel(that.index, layero);
  625 + close === false || layer.close(that.index);
  626 + }
  627 +
  628 + //右上角关闭回调
  629 + layero.find('.'+ doms[7]).on('click', cancel);
  630 +
  631 + //点遮罩关闭
  632 + if(config.shadeClose){
  633 + $('#layui-layer-shade'+ that.index).on('click', function(){
  634 + layer.close(that.index);
  635 + });
  636 + }
  637 +
  638 + //最小化
  639 + layero.find('.layui-layer-min').on('click', function(){
  640 + var min = config.min && config.min(layero);
  641 + min === false || layer.min(that.index, config);
  642 + });
  643 +
  644 + //全屏/还原
  645 + layero.find('.layui-layer-max').on('click', function(){
  646 + if($(this).hasClass('layui-layer-maxmin')){
  647 + layer.restore(that.index);
  648 + config.restore && config.restore(layero);
  649 + } else {
  650 + layer.full(that.index, config);
  651 + setTimeout(function(){
  652 + config.full && config.full(layero);
  653 + }, 100);
  654 + }
  655 + });
  656 +
  657 + config.end && (ready.end[that.index] = config.end);
  658 +};
  659 +
  660 +//for ie6 恢复select
  661 +ready.reselect = function(){
  662 + $.each($('select'), function(index , value){
  663 + var sthis = $(this);
  664 + if(!sthis.parents('.'+doms[0])[0]){
  665 + (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
  666 + }
  667 + sthis = null;
  668 + });
  669 +};
  670 +
  671 +Class.pt.IE6 = function(layero){
  672 + //隐藏select
  673 + $('select').each(function(index , value){
  674 + var sthis = $(this);
  675 + if(!sthis.parents('.'+doms[0])[0]){
  676 + sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();
  677 + }
  678 + sthis = null;
  679 + });
  680 +};
  681 +
  682 +//需依赖原型的对外方法
  683 +Class.pt.openLayer = function(){
  684 + var that = this;
  685 +
  686 + //置顶当前窗口
  687 + layer.zIndex = that.config.zIndex;
  688 + layer.setTop = function(layero){
  689 + var setZindex = function(){
  690 + layer.zIndex++;
  691 + layero.css('z-index', layer.zIndex + 1);
  692 + };
  693 + layer.zIndex = parseInt(layero[0].style.zIndex);
  694 + layero.on('mousedown', setZindex);
  695 + return layer.zIndex;
  696 + };
  697 +};
  698 +
  699 +ready.record = function(layero){
  700 + var area = [
  701 + layero.width(),
  702 + layero.height(),
  703 + layero.position().top,
  704 + layero.position().left + parseFloat(layero.css('margin-left'))
  705 + ];
  706 + layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
  707 + layero.attr({area: area});
  708 +};
  709 +
  710 +ready.rescollbar = function(index){
  711 + if(doms.html.attr('layer-full') == index){
  712 + if(doms.html[0].style.removeProperty){
  713 + doms.html[0].style.removeProperty('overflow');
  714 + } else {
  715 + doms.html[0].style.removeAttribute('overflow');
  716 + }
  717 + doms.html.removeAttr('layer-full');
  718 + }
  719 +};
  720 +
  721 +/** 内置成员 */
  722 +
  723 +window.layer = layer;
  724 +
  725 +//获取子iframe的DOM
  726 +layer.getChildFrame = function(selector, index){
  727 + index = index || $('.'+doms[4]).attr('times');
  728 + return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
  729 +};
  730 +
  731 +//得到当前iframe层的索引,子iframe时使用
  732 +layer.getFrameIndex = function(name){
  733 + return $('#'+ name).parents('.'+doms[4]).attr('times');
  734 +};
  735 +
  736 +//iframe层自适应宽高
  737 +layer.iframeAuto = function(index){
  738 + if(!index) return;
  739 + var heg = layer.getChildFrame('html', index).outerHeight();
  740 + var layero = $('#'+ doms[0] + index);
  741 + var titHeight = layero.find(doms[1]).outerHeight() || 0;
  742 + var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  743 + layero.css({height: heg + titHeight + btnHeight});
  744 + layero.find('iframe').css({height: heg});
  745 +};
  746 +
  747 +//重置iframe url
  748 +layer.iframeSrc = function(index, url){
  749 + $('#'+ doms[0] + index).find('iframe').attr('src', url);
  750 +};
  751 +
  752 +//设定层的样式
  753 +layer.style = function(index, options, limit){
  754 + var layero = $('#'+ doms[0] + index)
  755 + ,contElem = layero.find('.layui-layer-content')
  756 + ,type = layero.attr('type')
  757 + ,titHeight = layero.find(doms[1]).outerHeight() || 0
  758 + ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
  759 + ,minLeft = layero.attr('minLeft');
  760 +
  761 + if(type === ready.type[3] || type === ready.type[4]){
  762 + return;
  763 + }
  764 +
  765 + if(!limit){
  766 + if(parseFloat(options.width) <= 260){
  767 + options.width = 260;
  768 + };
  769 +
  770 + if(parseFloat(options.height) - titHeight - btnHeight <= 64){
  771 + options.height = 64 + titHeight + btnHeight;
  772 + };
  773 + }
  774 +
  775 + layero.css(options);
  776 + btnHeight = layero.find('.'+doms[6]).outerHeight();
  777 +
  778 + if(type === ready.type[2]){
  779 + layero.find('iframe').css({
  780 + height: parseFloat(options.height) - titHeight - btnHeight
  781 + });
  782 + } else {
  783 + contElem.css({
  784 + height: parseFloat(options.height) - titHeight - btnHeight
  785 + - parseFloat(contElem.css('padding-top'))
  786 + - parseFloat(contElem.css('padding-bottom'))
  787 + })
  788 + }
  789 +};
  790 +
  791 +//最小化
  792 +layer.min = function(index, options){
  793 + var layero = $('#'+ doms[0] + index)
  794 + ,titHeight = layero.find(doms[1]).outerHeight() || 0
  795 + ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
  796 + ,position = layero.css('position');
  797 +
  798 + ready.record(layero);
  799 +
  800 + if(ready.minLeft[0]){
  801 + left = ready.minLeft[0];
  802 + ready.minLeft.shift();
  803 + }
  804 +
  805 + layero.attr('position', position);
  806 +
  807 + layer.style(index, {
  808 + width: 180
  809 + ,height: titHeight
  810 + ,left: left
  811 + ,top: win.height() - titHeight
  812 + ,position: 'fixed'
  813 + ,overflow: 'hidden'
  814 + }, true);
  815 +
  816 + layero.find('.layui-layer-min').hide();
  817 + layero.attr('type') === 'page' && layero.find(doms[4]).hide();
  818 + ready.rescollbar(index);
  819 +
  820 + if(!layero.attr('minLeft')){
  821 + ready.minIndex++;
  822 + }
  823 + layero.attr('minLeft', left);
  824 +};
  825 +
  826 +//还原
  827 +layer.restore = function(index){
  828 + var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
  829 + var type = layero.attr('type');
  830 + layer.style(index, {
  831 + width: parseFloat(area[0]),
  832 + height: parseFloat(area[1]),
  833 + top: parseFloat(area[2]),
  834 + left: parseFloat(area[3]),
  835 + position: layero.attr('position'),
  836 + overflow: 'visible'
  837 + }, true);
  838 + layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
  839 + layero.find('.layui-layer-min').show();
  840 + layero.attr('type') === 'page' && layero.find(doms[4]).show();
  841 + ready.rescollbar(index);
  842 +};
  843 +
  844 +//全屏
  845 +layer.full = function(index){
  846 + var layero = $('#'+ doms[0] + index), timer;
  847 + ready.record(layero);
  848 + if(!doms.html.attr('layer-full')){
  849 + doms.html.css('overflow','hidden').attr('layer-full', index);
  850 + }
  851 + clearTimeout(timer);
  852 + timer = setTimeout(function(){
  853 + var isfix = layero.css('position') === 'fixed';
  854 + layer.style(index, {
  855 + top: isfix ? 0 : win.scrollTop(),
  856 + left: isfix ? 0 : win.scrollLeft(),
  857 + width: win.width(),
  858 + height: win.height()
  859 + }, true);
  860 + layero.find('.layui-layer-min').hide();
  861 + }, 100);
  862 +};
  863 +
  864 +//改变title
  865 +layer.title = function(name, index){
  866 + var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
  867 + title.html(name);
  868 +};
  869 +
  870 +//关闭layer总方法
  871 +layer.close = function(index){
  872 + var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
  873 + if(!layero[0]) return;
  874 + var WRAP = 'layui-layer-wrap', remove = function(){
  875 + if(type === ready.type[1] && layero.attr('conType') === 'object'){
  876 + layero.children(':not(.'+ doms[5] +')').remove();
  877 + var wrap = layero.find('.'+WRAP);
  878 + for(var i = 0; i < 2; i++){
  879 + wrap.unwrap();
  880 + }
  881 + wrap.css('display', wrap.data('display')).removeClass(WRAP);
  882 + } else {
  883 + //低版本IE 回收 iframe
  884 + if(type === ready.type[2]){
  885 + try {
  886 + var iframe = $('#'+doms[4]+index)[0];
  887 + iframe.contentWindow.document.write('');
  888 + iframe.contentWindow.close();
  889 + layero.find('.'+doms[5])[0].removeChild(iframe);
  890 + } catch(e){}
  891 + }
  892 + layero[0].innerHTML = '';
  893 + layero.remove();
  894 + }
  895 + typeof ready.end[index] === 'function' && ready.end[index]();
  896 + delete ready.end[index];
  897 + };
  898 +
  899 + if(layero.data('isOutAnim')){
  900 + layero.addClass(closeAnim);
  901 + }
  902 +
  903 + $('#layui-layer-moves, #layui-layer-shade' + index).remove();
  904 + layer.ie == 6 && ready.reselect();
  905 + ready.rescollbar(index);
  906 + if(layero.attr('minLeft')){
  907 + ready.minIndex--;
  908 + ready.minLeft.push(layero.attr('minLeft'));
  909 + }
  910 +
  911 + if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){
  912 + remove()
  913 + } else {
  914 + setTimeout(function(){
  915 + remove();
  916 + }, 200);
  917 + }
  918 +};
  919 +
  920 +//关闭所有层
  921 +layer.closeAll = function(type){
  922 + $.each($('.'+doms[0]), function(){
  923 + var othis = $(this);
  924 + var is = type ? (othis.attr('type') === type) : 1;
  925 + is && layer.close(othis.attr('times'));
  926 + is = null;
  927 + });
  928 +};
  929 +
  930 +/**
  931 +
  932 + 拓展模块,layui开始合并在一起
  933 +
  934 + */
  935 +
  936 +var cache = layer.cache||{}, skin = function(type){
  937 + return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
  938 +};
  939 +
  940 +//仿系统prompt
  941 +layer.prompt = function(options, yes){
  942 + var style = '';
  943 + options = options || {};
  944 +
  945 + if(typeof options === 'function') yes = options;
  946 +
  947 + if(options.area){
  948 + var area = options.area;
  949 + style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
  950 + delete options.area;
  951 + }
  952 + var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
  953 + return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
  954 + }();
  955 +
  956 + var success = options.success;
  957 + delete options.success;
  958 +
  959 + return layer.open($.extend({
  960 + type: 1
  961 + ,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
  962 + ,content: content
  963 + ,skin: 'layui-layer-prompt' + skin('prompt')
  964 + ,maxWidth: win.width()
  965 + ,success: function(layero){
  966 + prompt = layero.find('.layui-layer-input');
  967 + prompt.focus();
  968 + typeof success === 'function' && success(layero);
  969 + }
  970 + ,resize: false
  971 + ,yes: function(index){
  972 + var value = prompt.val();
  973 + if(value === ''){
  974 + prompt.focus();
  975 + } else if(value.length > (options.maxlength||500)) {
  976 + layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});
  977 + } else {
  978 + yes && yes(value, index, prompt);
  979 + }
  980 + }
  981 + }, options));
  982 +};
  983 +
  984 +//tab层
  985 +layer.tab = function(options){
  986 + options = options || {};
  987 +
  988 + var tab = options.tab || {}
  989 + ,success = options.success;
  990 +
  991 + delete options.success;
  992 +
  993 + return layer.open($.extend({
  994 + type: 1,
  995 + skin: 'layui-layer-tab' + skin('tab'),
  996 + resize: false,
  997 + title: function(){
  998 + var len = tab.length, ii = 1, str = '';
  999 + if(len > 0){
  1000 + str = '<span class="layui-layer-tabnow">'+ tab[0].title +'</span>';
  1001 + for(; ii < len; ii++){
  1002 + str += '<span>'+ tab[ii].title +'</span>';
  1003 + }
  1004 + }
  1005 + return str;
  1006 + }(),
  1007 + content: '<ul class="layui-layer-tabmain">'+ function(){
  1008 + var len = tab.length, ii = 1, str = '';
  1009 + if(len > 0){
  1010 + str = '<li class="layui-layer-tabli xubox_tab_layer">'+ (tab[0].content || 'no content') +'</li>';
  1011 + for(; ii < len; ii++){
  1012 + str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';
  1013 + }
  1014 + }
  1015 + return str;
  1016 + }() +'</ul>',
  1017 + success: function(layero){
  1018 + var btn = layero.find('.layui-layer-title').children();
  1019 + var main = layero.find('.layui-layer-tabmain').children();
  1020 + btn.on('mousedown', function(e){
  1021 + e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
  1022 + var othis = $(this), index = othis.index();
  1023 + othis.addClass('layui-layer-tabnow').siblings().removeClass('layui-layer-tabnow');
  1024 + main.eq(index).show().siblings().hide();
  1025 + typeof options.change === 'function' && options.change(index);
  1026 + });
  1027 + typeof success === 'function' && success(layero);
  1028 + }
  1029 + }, options));
  1030 +};
  1031 +
  1032 +//相册层
  1033 +layer.photos = function(options, loop, key){
  1034 + var dict = {};
  1035 + options = options || {};
  1036 + if(!options.photos) return;
  1037 + var type = options.photos.constructor === Object;
  1038 + var photos = type ? options.photos : {}, data = photos.data || [];
  1039 + var start = photos.start || 0;
  1040 + dict.imgIndex = (start|0) + 1;
  1041 +
  1042 + options.img = options.img || 'img';
  1043 +
  1044 + var success = options.success;
  1045 + delete options.success;
  1046 +
  1047 + if(!type){ //页面直接获取
  1048 + var parent = $(options.photos), pushData = function(){
  1049 + data = [];
  1050 + parent.find(options.img).each(function(index){
  1051 + var othis = $(this);
  1052 + othis.attr('layer-index', index);
  1053 + data.push({
  1054 + alt: othis.attr('alt'),
  1055 + pid: othis.attr('layer-pid'),
  1056 + src: othis.attr('layer-src') || othis.attr('src'),
  1057 + thumb: othis.attr('src')
  1058 + });
  1059 + })
  1060 + };
  1061 +
  1062 + pushData();
  1063 +
  1064 + if (data.length === 0) return;
  1065 +
  1066 + loop || parent.on('click', options.img, function(){
  1067 + var othis = $(this), index = othis.attr('layer-index');
  1068 + layer.photos($.extend(options, {
  1069 + photos: {
  1070 + start: index,
  1071 + data: data,
  1072 + tab: options.tab
  1073 + },
  1074 + full: options.full
  1075 + }), true);
  1076 + pushData();
  1077 + })
  1078 +
  1079 + //不直接弹出
  1080 + if(!loop) return;
  1081 +
  1082 + } else if (data.length === 0){
  1083 + return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');
  1084 + }
  1085 +
  1086 + //上一张
  1087 + dict.imgprev = function(key){
  1088 + dict.imgIndex--;
  1089 + if(dict.imgIndex < 1){
  1090 + dict.imgIndex = data.length;
  1091 + }
  1092 + dict.tabimg(key);
  1093 + };
  1094 +
  1095 + //下一张
  1096 + dict.imgnext = function(key,errorMsg){
  1097 + dict.imgIndex++;
  1098 + if(dict.imgIndex > data.length){
  1099 + dict.imgIndex = 1;
  1100 + if (errorMsg) {return};
  1101 + }
  1102 + dict.tabimg(key)
  1103 + };
  1104 +
  1105 + //方向键
  1106 + dict.keyup = function(event){
  1107 + if(!dict.end){
  1108 + var code = event.keyCode;
  1109 + event.preventDefault();
  1110 + if(code === 37){
  1111 + dict.imgprev(true);
  1112 + } else if(code === 39) {
  1113 + dict.imgnext(true);
  1114 + } else if(code === 27) {
  1115 + layer.close(dict.index);
  1116 + }
  1117 + }
  1118 + }
  1119 +
  1120 + //切换
  1121 + dict.tabimg = function(key){
  1122 + if(data.length <= 1) return;
  1123 + photos.start = dict.imgIndex - 1;
  1124 + layer.close(dict.index);
  1125 + return layer.photos(options, true, key);
  1126 + setTimeout(function(){
  1127 + layer.photos(options, true, key);
  1128 + }, 200);
  1129 + }
  1130 +
  1131 + //一些动作
  1132 + dict.event = function(){
  1133 + dict.bigimg.hover(function(){
  1134 + dict.imgsee.show();
  1135 + }, function(){
  1136 + dict.imgsee.hide();
  1137 + });
  1138 +
  1139 + dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
  1140 + event.preventDefault();
  1141 + dict.imgprev();
  1142 + });
  1143 +
  1144 + dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
  1145 + event.preventDefault();
  1146 + dict.imgnext();
  1147 + });
  1148 +
  1149 + $(document).on('keyup', dict.keyup);
  1150 + };
  1151 +
  1152 + //图片预加载
  1153 + function loadImage(url, callback, error) {
  1154 + var img = new Image();
  1155 + img.src = url;
  1156 + if(img.complete){
  1157 + return callback(img);
  1158 + }
  1159 + img.onload = function(){
  1160 + img.onload = null;
  1161 + callback(img);
  1162 + };
  1163 + img.onerror = function(e){
  1164 + img.onerror = null;
  1165 + error(e);
  1166 + };
  1167 + };
  1168 +
  1169 + dict.loadi = layer.load(1, {
  1170 + shade: 'shade' in options ? false : 0.9,
  1171 + scrollbar: false
  1172 + });
  1173 +
  1174 + loadImage(data[start].src, function(img){
  1175 + layer.close(dict.loadi);
  1176 + dict.index = layer.open($.extend({
  1177 + type: 1,
  1178 + id: 'layui-layer-photos',
  1179 + area: function(){
  1180 + var imgarea = [img.width, img.height];
  1181 + var winarea = [$(window).width() - 100, $(window).height() - 100];
  1182 +
  1183 + //如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
  1184 + if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
  1185 + var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
  1186 + if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
  1187 + imgarea[0] = imgarea[0]/wh[0];
  1188 + imgarea[1] = imgarea[1]/wh[0];
  1189 + } else if(wh[0] < wh[1]){
  1190 + imgarea[0] = imgarea[0]/wh[1];
  1191 + imgarea[1] = imgarea[1]/wh[1];
  1192 + }
  1193 + }
  1194 +
  1195 + return [imgarea[0]+'px', imgarea[1]+'px'];
  1196 + }(),
  1197 + title: false,
  1198 + shade: 0.9,
  1199 + shadeClose: true,
  1200 + closeBtn: false,
  1201 + move: '.layui-layer-phimg img',
  1202 + moveType: 1,
  1203 + scrollbar: false,
  1204 + moveOut: true,
  1205 + //anim: Math.random()*5|0,
  1206 + isOutAnim: false,
  1207 + skin: 'layui-layer-photos' + skin('photos'),
  1208 + content: '<div class="layui-layer-phimg">'
  1209 + +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
  1210 + +'<div class="layui-layer-imgsee">'
  1211 + +(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')
  1212 + +'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
  1213 + +'</div>'
  1214 + +'</div>',
  1215 + success: function(layero, index){
  1216 + dict.bigimg = layero.find('.layui-layer-phimg');
  1217 + dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
  1218 + dict.event(layero);
  1219 + options.tab && options.tab(data[start], layero);
  1220 + typeof success === 'function' && success(layero);
  1221 + }, end: function(){
  1222 + dict.end = true;
  1223 + $(document).off('keyup', dict.keyup);
  1224 + }
  1225 + }, options));
  1226 + }, function(){
  1227 + layer.close(dict.loadi);
  1228 + layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {
  1229 + time: 30000,
  1230 + btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],
  1231 + yes: function(){
  1232 + data.length > 1 && dict.imgnext(true,true);
  1233 + }
  1234 + });
  1235 + });
  1236 +};
  1237 +
  1238 +//主入口
  1239 +ready.run = function(_$){
  1240 + $ = _$;
  1241 + win = $(window);
  1242 + doms.html = $('html');
  1243 + layer.open = function(deliver){
  1244 + var o = new Class(deliver);
  1245 + return o.index;
  1246 + };
  1247 +};
  1248 +
  1249 +//加载方式
  1250 +window.layui && layui.define ? (
  1251 + layer.ready()
  1252 + ,layui.define('jquery', function(exports){ //layui加载
  1253 + layer.path = layui.cache.dir;
  1254 + ready.run(layui.jquery);
  1255 +
  1256 + //暴露模块
  1257 + window.layer = layer;
  1258 + exports('layer', layer);
  1259 + })
  1260 +) : (
  1261 + (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载
  1262 + ready.run(window.jQuery);
  1263 + return layer;
  1264 + }) : function(){ //普通script标签加载
  1265 + ready.run(window.jQuery);
  1266 + layer.ready();
  1267 + }()
  1268 +);
  1269 +
  1270 +}(window);
src/main/resources/static/real_control_v2/assets/plugins/layer3.0.3/skin/default/layer.css
1 -/**  
2 -  
3 - @Name: layer  
4 - @Author: 贤心  
5 -  
6 - **/  
7 -  
8 -*html{background-image: url(about:blank); background-attachment: fixed;}  
9 -html #layuicss-skinlayercss{display: none; position: absolute; width: 1989px;}  
10 -  
11 -/* common */  
12 -.layui-layer-shade, .layui-layer{position:fixed; _position:absolute; pointer-events: auto;}  
13 -.layui-layer-shade{top:0; left:0; width:100%; height:100%; _height:expression(document.body.offsetHeight+"px");}  
14 -.layui-layer{-webkit-overflow-scrolling: touch;}  
15 -.layui-layer{top:150px; left: 0; margin:0; padding:0; background-color:#fff; -webkit-background-clip: content; box-shadow: 1px 1px 50px rgba(0,0,0,.3);}  
16 -.layui-layer-close{position:absolute;}  
17 -.layui-layer-content{position:relative;}  
18 -.layui-layer-border{border: 1px solid #B2B2B2; border: 1px solid rgba(0,0,0,.1); box-shadow: 1px 1px 5px rgba(0,0,0,.2);}  
19 -.layui-layer-load{background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/loading-1.gif") #eee center center no-repeat;}  
20 -.layui-layer-ico{ background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/icon.png") no-repeat;}  
21 -.layui-layer-dialog .layui-layer-ico,  
22 -.layui-layer-setwin a,  
23 -.layui-layer-btn a{display:inline-block; *display:inline; *zoom:1; vertical-align:top;}  
24 -  
25 -.layui-layer-move{display: none; position: fixed; *position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; cursor: move; opacity: 0; filter:alpha(opacity=0); background-color: #fff; z-index: 2147483647;}  
26 -.layui-layer-resize{position: absolute; width: 15px; height: 15px; right: 0; bottom: 0; cursor: se-resize;}  
27 -  
28 -/* 动画 */  
29 -.layui-layer{border-radius: 2px; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.3s; animation-duration:.3s;}  
30 -  
31 -@-webkit-keyframes layer-bounceIn { /* 默认 */  
32 - 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)}  
33 - 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)}  
34 -}  
35 -@keyframes layer-bounceIn {  
36 - 0% {opacity: 0; -webkit-transform: scale(.5); -ms-transform: scale(.5); transform: scale(.5)}  
37 - 100% {opacity: 1; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1)}  
38 -}  
39 -.layer-anim{-webkit-animation-name: layer-bounceIn;animation-name: layer-bounceIn}  
40 -  
41 -@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}  
42 -  
43 -@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}  
44 -  
45 -@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}  
46 -  
47 -@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);-ms-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}  
48 -  
49 -@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}  
50 -  
51 -@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}  
52 -  
53 -/* 标题栏 */  
54 -.layui-layer-title{padding:0 80px 0 20px; height:42px; line-height:42px; border-bottom:1px solid #eee; font-size:14px; color:#333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background-color: #F8F8F8; border-radius: 2px 2px 0 0;}  
55 -.layui-layer-setwin{position:absolute; right:15px; *right:0; top:15px; font-size:0; line-height: initial;}  
56 -.layui-layer-setwin a{position:relative; width: 16px; height:16px; margin-left:10px; font-size:12px; _overflow:hidden;}  
57 -.layui-layer-setwin .layui-layer-min cite{position:absolute; width:14px; height:2px; left:0; top:50%; margin-top:-1px; background-color:#2E2D3C; cursor:pointer; _overflow:hidden;}  
58 -.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA; }  
59 -.layui-layer-setwin .layui-layer-max{background-position:-32px -40px;}  
60 -.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px;}  
61 -.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px;}  
62 -.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px;}  
63 -.layui-layer-setwin .layui-layer-close1{background-position: 1px -40px; cursor: pointer;}  
64 -.layui-layer-setwin .layui-layer-close1:hover{opacity:0.7;}  
65 -.layui-layer-setwin .layui-layer-close2{position:absolute; right:-28px; top:-28px; width:30px; height:30px; margin-left:0; background-position:-149px -31px; *right:-18px; _display:none;}  
66 -.layui-layer-setwin .layui-layer-close2:hover{ background-position:-180px -31px;}  
67 -  
68 -/* 按钮栏 */  
69 -.layui-layer-btn{text-align: right; padding:0 10px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;}  
70 -.layui-layer-btn a{height: 28px; line-height: 28px; margin: 6px 6px 0; padding: 0 15px; border:1px #dedede solid; background-color:#f1f1f1; color: #333; border-radius: 2px; font-weight:400; cursor:pointer; text-decoration: none;}  
71 -.layui-layer-btn a:hover{opacity: 0.9; text-decoration: none;}  
72 -.layui-layer-btn a:active{opacity: 0.8;}  
73 -.layui-layer-btn .layui-layer-btn0{border-color: #4898d5; background-color: #2e8ded; color:#fff;}  
74 -.layui-layer-btn-l{text-align: left;}  
75 -.layui-layer-btn-c{text-align: center;}  
76 -  
77 -/* 定制化 */  
78 -.layui-layer-dialog{min-width:260px;}  
79 -.layui-layer-dialog .layui-layer-content{position: relative; padding:20px; line-height:24px; word-break: break-all; overflow:hidden; font-size:14px; overflow-x: hidden; overflow-y:auto;}  
80 -.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute; top:16px; left:15px; _left:-40px; width:30px; height:30px;}  
81 -.layui-layer-ico1{background-position:-30px 0 }  
82 -.layui-layer-ico2{background-position:-60px 0;}  
83 -.layui-layer-ico3{background-position:-90px 0;}  
84 -.layui-layer-ico4{background-position:-120px 0;}  
85 -.layui-layer-ico5{background-position:-150px 0;}  
86 -.layui-layer-ico6{background-position:-180px 0;}  
87 -.layui-layer-rim{border:6px solid #8D8D8D; border:6px solid rgba(0,0,0,.3); border-radius:5px; box-shadow: none;}  
88 -.layui-layer-msg{min-width:180px; border:1px solid #D3D4D3; box-shadow: none;}  
89 -.layui-layer-hui{min-width:100px; background-color: #000; filter:alpha(opacity=60); background-color: rgba(0,0,0,0.6); color: #fff; border:none;}  
90 -.layui-layer-hui .layui-layer-content{padding:12px 25px; text-align:center;}  
91 -.layui-layer-dialog .layui-layer-padding{padding: 20px 20px 20px 55px; text-align: left;}  
92 -.layui-layer-page .layui-layer-content{position:relative; overflow:auto;}  
93 -.layui-layer-page .layui-layer-btn,.layui-layer-iframe .layui-layer-btn{padding-top:10px;}  
94 -.layui-layer-nobg{background:none;}  
95 -.layui-layer-iframe iframe{display: block; width: 100%;}  
96 -  
97 -.layui-layer-loading{border-radius:100%; background:none; box-shadow:none; border:none;}  
98 -.layui-layer-loading .layui-layer-content{width:60px; height:24px; background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/loading-0.gif") no-repeat;}  
99 -.layui-layer-loading .layui-layer-loading1{width:37px; height:37px; background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/loading-1.gif") no-repeat;}  
100 -.layui-layer-loading .layui-layer-loading2, .layui-layer-ico16{width:32px; height:32px; background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/loading-2.gif") no-repeat;}  
101 -.layui-layer-tips{background: none; box-shadow:none; border:none;}  
102 -.layui-layer-tips .layui-layer-content{position: relative; line-height: 22px; min-width: 12px; padding: 5px 10px; font-size: 12px; _float:left; border-radius: 2px; box-shadow: 1px 1px 3px rgba(0,0,0,.2); background-color: #000; color: #fff;}  
103 -.layui-layer-tips .layui-layer-close{right:-2px; top:-1px;}  
104 -.layui-layer-tips i.layui-layer-TipsG{ position:absolute; width:0; height:0; border-width:8px; border-color:transparent; border-style:dashed; *overflow:hidden;}  
105 -.layui-layer-tips i.layui-layer-TipsT, .layui-layer-tips i.layui-layer-TipsB{left:5px; border-right-style:solid; border-right-color: #000;}  
106 -.layui-layer-tips i.layui-layer-TipsT{bottom:-8px;}  
107 -.layui-layer-tips i.layui-layer-TipsB{top:-8px;}  
108 -.layui-layer-tips i.layui-layer-TipsR, .layui-layer-tips i.layui-layer-TipsL{top:1px; border-bottom-style:solid; border-bottom-color: #000;}  
109 -.layui-layer-tips i.layui-layer-TipsR{left:-8px;}  
110 -.layui-layer-tips i.layui-layer-TipsL{right:-8px;}  
111 -  
112 -/* skin */  
113 -.layui-layer-lan[type="dialog"]{min-width:280px;}  
114 -.layui-layer-lan .layui-layer-title{background:#4476A7; color:#fff; border: none;}  
115 -.layui-layer-lan .layui-layer-btn{padding: 5px 10px 10px; text-align: right; border-top:1px solid #E9E7E7}  
116 -.layui-layer-lan .layui-layer-btn a{background:#BBB5B5; border:none;}  
117 -.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5;}  
118 -.layui-layer-molv .layui-layer-title{background:#009f95; color:#fff; border: none;}  
119 -.layui-layer-molv .layui-layer-btn a{background:#009f95;}  
120 -.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1;}  
121 -  
122 -  
123 -  
124 -/**  
125 -  
126 - @Name: layer拓展样式  
127 -  
128 - */  
129 -  
130 -.layui-layer-iconext{background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/icon-ext.png") no-repeat;}  
131 -  
132 -/* prompt模式 */  
133 -.layui-layer-prompt .layui-layer-input{display:block; width:220px; height:30px; margin:0 auto; line-height:30px; padding: 0 5px; border: 1px solid #ccc; box-shadow: 1px 1px 5px rgba(0,0,0,.1) inset; color:#333;}  
134 -.layui-layer-prompt textarea.layui-layer-input{width:300px; height:100px; line-height:20px;}  
135 -.layui-layer-prompt .layui-layer-content{padding: 20px;}  
136 -.layui-layer-prompt .layui-layer-btn{padding-top: 0;}  
137 -  
138 -/* tab模式 */  
139 -.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4);}  
140 -.layui-layer-tab .layui-layer-title{padding-left:0; border-bottom:1px solid #ccc; background-color:#eee; overflow: visible;}  
141 -.layui-layer-tab .layui-layer-title span{position:relative; float:left; min-width:80px; max-width:260px; padding:0 20px; text-align:center; cursor:default; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}  
142 -.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px; border-left:1px solid #ccc; border-right:1px solid #ccc; background-color:#fff; z-index:10;}  
143 -.layui-layer-tab .layui-layer-title span:first-child{border-left:none;}  
144 -.layui-layer-tabmain{line-height:24px; clear:both;}  
145 -.layui-layer-tabmain .layui-layer-tabli{display:none;}  
146 -.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer{display:block;}  
147 -.xubox_tabclose{position:absolute; right:10px; top:5px; cursor:pointer;}  
148 -  
149 -/* photo模式 */  
150 -.layui-layer-photos{-webkit-animation-duration: .8s; animation-duration: .8s;}  
151 -.layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;}  
152 -.layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;}  
153 -.layui-layer-imguide,.layui-layer-imgbar{display:none;}  
154 -.layui-layer-imgprev, .layui-layer-imgnext{position:absolute; top:50%; width:27px; _width:44px; height:44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());}  
155 -.layui-layer-imgprev{left:10px; background-position:-5px -5px; _background-position:-70px -5px;}  
156 -.layui-layer-imgprev:hover{background-position:-33px -5px; _background-position:-120px -5px;}  
157 -.layui-layer-imgnext{right:10px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;}  
158 -.layui-layer-imgnext:hover{background-position:-33px -50px; _background-position:-120px -50px;}  
159 -.layui-layer-imgbar{position:absolute; left:0; bottom:0; width:100%; height:32px; line-height:32px; background-color:rgba(0,0,0,.8); background-color:#000\9; filter:Alpha(opacity=80); color:#fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;}  
160 -.layui-layer-imgtit{/*position:absolute; left:20px;*/}  
161 -.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;}  
162 -.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;}  
163 -.layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;}  
164 -.layui-layer-imgtit em{padding-left:10px; font-style: normal;}  
165 -  
166 -/* 关闭动画 */  
167 -@-webkit-keyframes layer-bounceOut {  
168 - 100% {opacity: 0; -webkit-transform: scale(.7); transform: scale(.7)}  
169 - 30% {-webkit-transform: scale(1.05); transform: scale(1.05)}  
170 - 0% {-webkit-transform: scale(1); transform: scale(1);}  
171 -}  
172 -@keyframes layer-bounceOut {  
173 - 100% {opacity: 0; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7);}  
174 - 30% {-webkit-transform: scale(1.05); -ms-transform: scale(1.05); transform: scale(1.05);}  
175 - 0% {-webkit-transform: scale(1); -ms-transform: scale(1);transform: scale(1);}  
176 -}  
177 -.layer-anim-close{-webkit-animation-name: layer-bounceOut;animation-name: layer-bounceOut; -webkit-animation-duration:.2s; animation-duration:.2s;}  
178 -  
179 -@media screen and (max-width: 1100px) {  
180 - .layui-layer-iframe{overflow-y: auto; -webkit-overflow-scrolling: touch;}  
181 -}  
182 -  
183 - 1 +/**
  2 +
  3 + @Name: layer
  4 + @Author: 贤心
  5 +
  6 + **/
  7 +
  8 +*html{background-image: url(about:blank); background-attachment: fixed;}
  9 +html #layuicss-skinlayercss{display: none; position: absolute; width: 1989px;}
  10 +
  11 +/* common */
  12 +.layui-layer-shade, .layui-layer{position:fixed; _position:absolute; pointer-events: auto;}
  13 +.layui-layer-shade{top:0; left:0; width:100%; height:100%; _height:expression(document.body.offsetHeight+"px");}
  14 +.layui-layer{-webkit-overflow-scrolling: touch;}
  15 +.layui-layer{top:150px; left: 0; margin:0; padding:0; background-color:#fff; -webkit-background-clip: content; box-shadow: 1px 1px 50px rgba(0,0,0,.3);}
  16 +.layui-layer-close{position:absolute;}
  17 +.layui-layer-content{position:relative;}
  18 +.layui-layer-border{border: 1px solid #B2B2B2; border: 1px solid rgba(0,0,0,.1); box-shadow: 1px 1px 5px rgba(0,0,0,.2);}
  19 +.layui-layer-load{background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/loading-1.gif") #eee center center no-repeat;}
  20 +.layui-layer-ico{ background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/icon.png") no-repeat;}
  21 +.layui-layer-dialog .layui-layer-ico,
  22 +.layui-layer-setwin a,
  23 +.layui-layer-btn a{display:inline-block; *display:inline; *zoom:1; vertical-align:top;}
  24 +
  25 +.layui-layer-move{display: none; position: fixed; *position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; cursor: move; opacity: 0; filter:alpha(opacity=0); background-color: #fff; z-index: 2147483647;}
  26 +.layui-layer-resize{position: absolute; width: 15px; height: 15px; right: 0; bottom: 0; cursor: se-resize;}
  27 +
  28 +/* 动画 */
  29 +.layui-layer{border-radius: 2px; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.3s; animation-duration:.3s;}
  30 +
  31 +@-webkit-keyframes layer-bounceIn { /* 默认 */
  32 + 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)}
  33 + 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)}
  34 +}
  35 +@keyframes layer-bounceIn {
  36 + 0% {opacity: 0; -webkit-transform: scale(.5); -ms-transform: scale(.5); transform: scale(.5)}
  37 + 100% {opacity: 1; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1)}
  38 +}
  39 +.layer-anim{-webkit-animation-name: layer-bounceIn;animation-name: layer-bounceIn}
  40 +
  41 +@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}
  42 +
  43 +@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}
  44 +
  45 +@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}
  46 +
  47 +@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);-ms-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}
  48 +
  49 +@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}
  50 +
  51 +@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}
  52 +
  53 +/* 标题栏 */
  54 +.layui-layer-title{padding:0 80px 0 20px; height:42px; line-height:42px; border-bottom:1px solid #eee; font-size:14px; color:#333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background-color: #F8F8F8; border-radius: 2px 2px 0 0;}
  55 +.layui-layer-setwin{position:absolute; right:15px; *right:0; top:15px; font-size:0; line-height: initial;}
  56 +.layui-layer-setwin a{position:relative; width: 16px; height:16px; margin-left:10px; font-size:12px; _overflow:hidden;}
  57 +.layui-layer-setwin .layui-layer-min cite{position:absolute; width:14px; height:2px; left:0; top:50%; margin-top:-1px; background-color:#2E2D3C; cursor:pointer; _overflow:hidden;}
  58 +.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA; }
  59 +.layui-layer-setwin .layui-layer-max{background-position:-32px -40px;}
  60 +.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px;}
  61 +.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px;}
  62 +.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px;}
  63 +.layui-layer-setwin .layui-layer-close1{background-position: 1px -40px; cursor: pointer;}
  64 +.layui-layer-setwin .layui-layer-close1:hover{opacity:0.7;}
  65 +.layui-layer-setwin .layui-layer-close2{position:absolute; right:-28px; top:-28px; width:30px; height:30px; margin-left:0; background-position:-149px -31px; *right:-18px; _display:none;}
  66 +.layui-layer-setwin .layui-layer-close2:hover{ background-position:-180px -31px;}
  67 +
  68 +/* 按钮栏 */
  69 +.layui-layer-btn{text-align: right; padding:0 10px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;}
  70 +.layui-layer-btn a{height: 28px; line-height: 28px; margin: 6px 6px 0; padding: 0 15px; border:1px #dedede solid; background-color:#f1f1f1; color: #333; border-radius: 2px; font-weight:400; cursor:pointer; text-decoration: none;}
  71 +.layui-layer-btn a:hover{opacity: 0.9; text-decoration: none;}
  72 +.layui-layer-btn a:active{opacity: 0.8;}
  73 +.layui-layer-btn .layui-layer-btn0{border-color: #4898d5; background-color: #2e8ded; color:#fff;}
  74 +.layui-layer-btn-l{text-align: left;}
  75 +.layui-layer-btn-c{text-align: center;}
  76 +
  77 +/* 定制化 */
  78 +.layui-layer-dialog{min-width:260px;}
  79 +.layui-layer-dialog .layui-layer-content{position: relative; padding:20px; line-height:24px; word-break: break-all; overflow:hidden; font-size:14px; overflow-x: hidden; overflow-y:auto;}
  80 +.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute; top:16px; left:15px; _left:-40px; width:30px; height:30px;}
  81 +.layui-layer-ico1{background-position:-30px 0 }
  82 +.layui-layer-ico2{background-position:-60px 0;}
  83 +.layui-layer-ico3{background-position:-90px 0;}
  84 +.layui-layer-ico4{background-position:-120px 0;}
  85 +.layui-layer-ico5{background-position:-150px 0;}
  86 +.layui-layer-ico6{background-position:-180px 0;}
  87 +.layui-layer-rim{border:6px solid #8D8D8D; border:6px solid rgba(0,0,0,.3); border-radius:5px; box-shadow: none;}
  88 +.layui-layer-msg{min-width:180px; border:1px solid #D3D4D3; box-shadow: none;}
  89 +.layui-layer-hui{min-width:100px; background-color: #000; filter:alpha(opacity=60); background-color: rgba(0,0,0,0.6); color: #fff; border:none;}
  90 +.layui-layer-hui .layui-layer-content{padding:12px 25px; text-align:center;}
  91 +.layui-layer-dialog .layui-layer-padding{padding: 20px 20px 20px 55px; text-align: left;}
  92 +.layui-layer-page .layui-layer-content{position:relative; overflow:auto;}
  93 +.layui-layer-page .layui-layer-btn,.layui-layer-iframe .layui-layer-btn{padding-top:10px;}
  94 +.layui-layer-nobg{background:none;}
  95 +.layui-layer-iframe iframe{display: block; width: 100%;}
  96 +
  97 +.layui-layer-loading{border-radius:100%; background:none; box-shadow:none; border:none;}
  98 +.layui-layer-loading .layui-layer-content{width:60px; height:24px; background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/loading-0.gif") no-repeat;}
  99 +.layui-layer-loading .layui-layer-loading1{width:37px; height:37px; background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/loading-1.gif") no-repeat;}
  100 +.layui-layer-loading .layui-layer-loading2, .layui-layer-ico16{width:32px; height:32px; background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/loading-2.gif") no-repeat;}
  101 +.layui-layer-tips{background: none; box-shadow:none; border:none;}
  102 +.layui-layer-tips .layui-layer-content{position: relative; line-height: 22px; min-width: 12px; padding: 5px 10px; font-size: 12px; _float:left; border-radius: 2px; box-shadow: 1px 1px 3px rgba(0,0,0,.2); background-color: #000; color: #fff;}
  103 +.layui-layer-tips .layui-layer-close{right:-2px; top:-1px;}
  104 +.layui-layer-tips i.layui-layer-TipsG{ position:absolute; width:0; height:0; border-width:8px; border-color:transparent; border-style:dashed; *overflow:hidden;}
  105 +.layui-layer-tips i.layui-layer-TipsT, .layui-layer-tips i.layui-layer-TipsB{left:5px; border-right-style:solid; border-right-color: #000;}
  106 +.layui-layer-tips i.layui-layer-TipsT{bottom:-8px;}
  107 +.layui-layer-tips i.layui-layer-TipsB{top:-8px;}
  108 +.layui-layer-tips i.layui-layer-TipsR, .layui-layer-tips i.layui-layer-TipsL{top:1px; border-bottom-style:solid; border-bottom-color: #000;}
  109 +.layui-layer-tips i.layui-layer-TipsR{left:-8px;}
  110 +.layui-layer-tips i.layui-layer-TipsL{right:-8px;}
  111 +
  112 +/* skin */
  113 +.layui-layer-lan[type="dialog"]{min-width:280px;}
  114 +.layui-layer-lan .layui-layer-title{background:#4476A7; color:#fff; border: none;}
  115 +.layui-layer-lan .layui-layer-btn{padding: 5px 10px 10px; text-align: right; border-top:1px solid #E9E7E7}
  116 +.layui-layer-lan .layui-layer-btn a{background:#BBB5B5; border:none;}
  117 +.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5;}
  118 +.layui-layer-molv .layui-layer-title{background:#009f95; color:#fff; border: none;}
  119 +.layui-layer-molv .layui-layer-btn a{background:#009f95;}
  120 +.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1;}
  121 +
  122 +
  123 +
  124 +/**
  125 +
  126 + @Name: layer拓展样式
  127 +
  128 + */
  129 +
  130 +.layui-layer-iconext{background:url("/real_control_v2/assets/plugins/layer3.0.3/skin/default/icon-ext.png") no-repeat;}
  131 +
  132 +/* prompt模式 */
  133 +.layui-layer-prompt .layui-layer-input{display:block; width:220px; height:30px; margin:0 auto; line-height:30px; padding: 0 5px; border: 1px solid #ccc; box-shadow: 1px 1px 5px rgba(0,0,0,.1) inset; color:#333;}
  134 +.layui-layer-prompt textarea.layui-layer-input{width:300px; height:100px; line-height:20px;}
  135 +.layui-layer-prompt .layui-layer-content{padding: 20px;}
  136 +.layui-layer-prompt .layui-layer-btn{padding-top: 0;}
  137 +
  138 +/* tab模式 */
  139 +.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4);}
  140 +.layui-layer-tab .layui-layer-title{padding-left:0; border-bottom:1px solid #ccc; background-color:#eee; overflow: visible;}
  141 +.layui-layer-tab .layui-layer-title span{position:relative; float:left; min-width:80px; max-width:260px; padding:0 20px; text-align:center; cursor:default; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
  142 +.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px; border-left:1px solid #ccc; border-right:1px solid #ccc; background-color:#fff; z-index:10;}
  143 +.layui-layer-tab .layui-layer-title span:first-child{border-left:none;}
  144 +.layui-layer-tabmain{line-height:24px; clear:both;}
  145 +.layui-layer-tabmain .layui-layer-tabli{display:none;}
  146 +.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer{display:block;}
  147 +.xubox_tabclose{position:absolute; right:10px; top:5px; cursor:pointer;}
  148 +
  149 +/* photo模式 */
  150 +.layui-layer-photos{-webkit-animation-duration: .8s; animation-duration: .8s;}
  151 +.layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;}
  152 +.layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;}
  153 +.layui-layer-imguide,.layui-layer-imgbar{display:none;}
  154 +.layui-layer-imgprev, .layui-layer-imgnext{position:absolute; top:50%; width:27px; _width:44px; height:44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());}
  155 +.layui-layer-imgprev{left:10px; background-position:-5px -5px; _background-position:-70px -5px;}
  156 +.layui-layer-imgprev:hover{background-position:-33px -5px; _background-position:-120px -5px;}
  157 +.layui-layer-imgnext{right:10px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;}
  158 +.layui-layer-imgnext:hover{background-position:-33px -50px; _background-position:-120px -50px;}
  159 +.layui-layer-imgbar{position:absolute; left:0; bottom:0; width:100%; height:32px; line-height:32px; background-color:rgba(0,0,0,.8); background-color:#000\9; filter:Alpha(opacity=80); color:#fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;}
  160 +.layui-layer-imgtit{/*position:absolute; left:20px;*/}
  161 +.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;}
  162 +.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;}
  163 +.layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;}
  164 +.layui-layer-imgtit em{padding-left:10px; font-style: normal;}
  165 +
  166 +/* 关闭动画 */
  167 +@-webkit-keyframes layer-bounceOut {
  168 + 100% {opacity: 0; -webkit-transform: scale(.7); transform: scale(.7)}
  169 + 30% {-webkit-transform: scale(1.05); transform: scale(1.05)}
  170 + 0% {-webkit-transform: scale(1); transform: scale(1);}
  171 +}
  172 +@keyframes layer-bounceOut {
  173 + 100% {opacity: 0; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7);}
  174 + 30% {-webkit-transform: scale(1.05); -ms-transform: scale(1.05); transform: scale(1.05);}
  175 + 0% {-webkit-transform: scale(1); -ms-transform: scale(1);transform: scale(1);}
  176 +}
  177 +.layer-anim-close{-webkit-animation-name: layer-bounceOut;animation-name: layer-bounceOut; -webkit-animation-duration:.2s; animation-duration:.2s;}
  178 +
  179 +@media screen and (max-width: 1100px) {
  180 + .layui-layer-iframe{overflow-y: auto; -webkit-overflow-scrolling: touch;}
  181 +}
  182 +
  183 +
src/test/resources/testdata/problem.properties
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 20=排班规则备注 20 20=排班规则备注
21 ##21=时刻表,两点间空驶,算空驶 21 ##21=时刻表,两点间空驶,算空驶
22 22=搭班编码自动生成 22 22=搭班编码自动生成
23 -23=时刻表明细修改终点站停驶(停止1个半小时以上) 23 +##23=时刻表明细修改终点站停驶(停止1个半小时以上)
24 ##24=线路标准里如果里程是0,用标准里程 24 ##24=线路标准里如果里程是0,用标准里程
25 ##25=规则导出的日期格式修正 25 ##25=规则导出的日期格式修正
26 ##26=人员录入,工号规则前加 "{公司编码}-" 26 ##26=人员录入,工号规则前加 "{公司编码}-"